@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.
@@ -0,0 +1,2935 @@
1
+ //#region src/generated/types.d.ts
2
+ /**
3
+ * The discriminator carried by every event.
4
+ */
5
+ declare enum EventType {
6
+ TEXT_MESSAGE_START = "TEXT_MESSAGE_START",
7
+ TEXT_MESSAGE_CONTENT = "TEXT_MESSAGE_CONTENT",
8
+ TEXT_MESSAGE_END = "TEXT_MESSAGE_END",
9
+ TEXT_MESSAGE_CHUNK = "TEXT_MESSAGE_CHUNK",
10
+ TOOL_CALL_START = "TOOL_CALL_START",
11
+ TOOL_CALL_ARGS = "TOOL_CALL_ARGS",
12
+ TOOL_CALL_END = "TOOL_CALL_END",
13
+ TOOL_CALL_CHUNK = "TOOL_CALL_CHUNK",
14
+ TOOL_CALL_RESULT = "TOOL_CALL_RESULT",
15
+ STATE_SNAPSHOT = "STATE_SNAPSHOT",
16
+ STATE_DELTA = "STATE_DELTA",
17
+ MESSAGES_SNAPSHOT = "MESSAGES_SNAPSHOT",
18
+ ACTIVITY_SNAPSHOT = "ACTIVITY_SNAPSHOT",
19
+ ACTIVITY_DELTA = "ACTIVITY_DELTA",
20
+ RAW = "RAW",
21
+ CUSTOM = "CUSTOM",
22
+ RUN_STARTED = "RUN_STARTED",
23
+ RUN_FINISHED = "RUN_FINISHED",
24
+ RUN_ERROR = "RUN_ERROR",
25
+ STEP_STARTED = "STEP_STARTED",
26
+ STEP_FINISHED = "STEP_FINISHED",
27
+ REASONING_START = "REASONING_START",
28
+ REASONING_MESSAGE_START = "REASONING_MESSAGE_START",
29
+ REASONING_MESSAGE_CONTENT = "REASONING_MESSAGE_CONTENT",
30
+ REASONING_MESSAGE_END = "REASONING_MESSAGE_END",
31
+ REASONING_MESSAGE_CHUNK = "REASONING_MESSAGE_CHUNK",
32
+ REASONING_END = "REASONING_END",
33
+ REASONING_ENCRYPTED_VALUE = "REASONING_ENCRYPTED_VALUE",
34
+ SUBAGENT_STARTED = "SUBAGENT_STARTED",
35
+ SUBAGENT_FINISHED = "SUBAGENT_FINISHED",
36
+ SUBAGENT_ERROR = "SUBAGENT_ERROR"
37
+ }
38
+ /**
39
+ * Extra information attached to an event, a message, a tool call, a tool, an
40
+ * interrupt or a resume entry. Open by key: any JSON value is allowed under a
41
+ * key, including null, because a null there is meaningful data. The object
42
+ * itself may be absent but is never null when present. The key ag-ui is
43
+ * reserved for the protocol's own use; reservation is by convention, since
44
+ * validating the shape of a key's value would contradict being open by key.
45
+ */
46
+ type Metadata = Record<string, any>;
47
+ /**
48
+ * An opaque handle for one subagent invocation, not a reusable name for a
49
+ * subagent definition: two invocations of the same subagent carry two
50
+ * different values. Named to mirror runId one level down, the way the
51
+ * subagent's name mirrors agentId.
52
+ */
53
+ type SubagentRunId = string;
54
+ /**
55
+ * The roles a streamed text message may take. Excludes tool, which is carried
56
+ * by TOOL_CALL_RESULT rather than streamed as text.
57
+ */
58
+ type TextMessageRole = "developer" | "system" | "assistant" | "user";
59
+ /**
60
+ * Opens a streamed text message. The content arrives as TEXT_MESSAGE_CONTENT
61
+ * events and the message closes with TEXT_MESSAGE_END.
62
+ */
63
+ type TextMessageStartEvent = {
64
+ /**
65
+ * Which event this is. Each event definition narrows this to a single value.
66
+ */
67
+ type: EventType.TEXT_MESSAGE_START;
68
+ /**
69
+ * When the event was created. Bounded to the range JSON numbers survive a
70
+ * round trip in, so the value a consumer reads is the value the producer
71
+ * wrote. Deliberately not a float. The unit is not constrained here, because
72
+ * it never has been stated normatively; every SDK that sets it in practice
73
+ * uses milliseconds since the Unix epoch, and a producer choosing another
74
+ * unit will be misread by consumers even though it validates. Nothing in the
75
+ * protocol computes with this value.
76
+ */
77
+ timestamp?: number;
78
+ /**
79
+ * The provider-native event this one was translated from, carried verbatim
80
+ * for debugging and for consumers that need detail the protocol does not
81
+ * model. Any JSON value.
82
+ */
83
+ rawEvent?: any;
84
+ /**
85
+ * Extra information attached to this event.
86
+ */
87
+ metadata?: Metadata;
88
+ /**
89
+ * The subagent invocation this belongs to. Absent means the parent agent
90
+ * produced it directly.
91
+ */
92
+ subagentRunId?: SubagentRunId;
93
+ /**
94
+ * Identifies the message this stream builds, and ties the later content and
95
+ * end events to it.
96
+ */
97
+ messageId: string;
98
+ /**
99
+ * Who the message is from. An absent role means assistant; that meaning is
100
+ * normative and stated in the prose, because a validator treats a default as
101
+ * documentation rather than as behaviour.
102
+ * @default "assistant"
103
+ */
104
+ role?: TextMessageRole;
105
+ /**
106
+ * An optional display name for the author, for providers that distinguish
107
+ * several participants in one role.
108
+ */
109
+ name?: string;
110
+ };
111
+ /**
112
+ * Appends a fragment to a streamed text message.
113
+ */
114
+ type TextMessageContentEvent = {
115
+ /**
116
+ * Which event this is. Each event definition narrows this to a single value.
117
+ */
118
+ type: EventType.TEXT_MESSAGE_CONTENT;
119
+ /**
120
+ * When the event was created. Bounded to the range JSON numbers survive a
121
+ * round trip in, so the value a consumer reads is the value the producer
122
+ * wrote. Deliberately not a float. The unit is not constrained here, because
123
+ * it never has been stated normatively; every SDK that sets it in practice
124
+ * uses milliseconds since the Unix epoch, and a producer choosing another
125
+ * unit will be misread by consumers even though it validates. Nothing in the
126
+ * protocol computes with this value.
127
+ */
128
+ timestamp?: number;
129
+ /**
130
+ * The provider-native event this one was translated from, carried verbatim
131
+ * for debugging and for consumers that need detail the protocol does not
132
+ * model. Any JSON value.
133
+ */
134
+ rawEvent?: any;
135
+ /**
136
+ * Extra information attached to this event.
137
+ */
138
+ metadata?: Metadata;
139
+ /**
140
+ * The subagent invocation this belongs to. Absent means the parent agent
141
+ * produced it directly.
142
+ */
143
+ subagentRunId?: SubagentRunId;
144
+ /**
145
+ * The message this fragment belongs to.
146
+ */
147
+ messageId: string;
148
+ /**
149
+ * The fragment to append. May be the empty string: providers emit empty
150
+ * deltas as keep-alives and while a tool call is being decided, and
151
+ * rejecting them would kill runs that are working correctly.
152
+ */
153
+ delta: string;
154
+ };
155
+ /**
156
+ * Closes a streamed text message.
157
+ */
158
+ type TextMessageEndEvent = {
159
+ /**
160
+ * Which event this is. Each event definition narrows this to a single value.
161
+ */
162
+ type: EventType.TEXT_MESSAGE_END;
163
+ /**
164
+ * When the event was created. Bounded to the range JSON numbers survive a
165
+ * round trip in, so the value a consumer reads is the value the producer
166
+ * wrote. Deliberately not a float. The unit is not constrained here, because
167
+ * it never has been stated normatively; every SDK that sets it in practice
168
+ * uses milliseconds since the Unix epoch, and a producer choosing another
169
+ * unit will be misread by consumers even though it validates. Nothing in the
170
+ * protocol computes with this value.
171
+ */
172
+ timestamp?: number;
173
+ /**
174
+ * The provider-native event this one was translated from, carried verbatim
175
+ * for debugging and for consumers that need detail the protocol does not
176
+ * model. Any JSON value.
177
+ */
178
+ rawEvent?: any;
179
+ /**
180
+ * Extra information attached to this event.
181
+ */
182
+ metadata?: Metadata;
183
+ /**
184
+ * The subagent invocation this belongs to. Absent means the parent agent
185
+ * produced it directly.
186
+ */
187
+ subagentRunId?: SubagentRunId;
188
+ /**
189
+ * The message being closed.
190
+ */
191
+ messageId: string;
192
+ };
193
+ /**
194
+ * A shorthand that stands in for a start, content and end sequence, for
195
+ * producers that cannot know in advance where a message begins. Every field is
196
+ * optional because a continuation chunk omits what has not changed; which
197
+ * message a field-less chunk continues is a sequence question the prose
198
+ * specification answers.
199
+ */
200
+ type TextMessageChunkEvent = {
201
+ /**
202
+ * Which event this is. Each event definition narrows this to a single value.
203
+ */
204
+ type: EventType.TEXT_MESSAGE_CHUNK;
205
+ /**
206
+ * When the event was created. Bounded to the range JSON numbers survive a
207
+ * round trip in, so the value a consumer reads is the value the producer
208
+ * wrote. Deliberately not a float. The unit is not constrained here, because
209
+ * it never has been stated normatively; every SDK that sets it in practice
210
+ * uses milliseconds since the Unix epoch, and a producer choosing another
211
+ * unit will be misread by consumers even though it validates. Nothing in the
212
+ * protocol computes with this value.
213
+ */
214
+ timestamp?: number;
215
+ /**
216
+ * The provider-native event this one was translated from, carried verbatim
217
+ * for debugging and for consumers that need detail the protocol does not
218
+ * model. Any JSON value.
219
+ */
220
+ rawEvent?: any;
221
+ /**
222
+ * Extra information attached to this event.
223
+ */
224
+ metadata?: Metadata;
225
+ /**
226
+ * The subagent invocation this belongs to. Absent means the parent agent
227
+ * produced it directly.
228
+ */
229
+ subagentRunId?: SubagentRunId;
230
+ /**
231
+ * The message this chunk belongs to. Absent continues the message already
232
+ * open.
233
+ */
234
+ messageId?: string;
235
+ /**
236
+ * Who the message is from, on the chunk that opens it.
237
+ */
238
+ role?: TextMessageRole;
239
+ /**
240
+ * The fragment to append. May be the empty string.
241
+ */
242
+ delta?: string;
243
+ /**
244
+ * An optional display name for the author.
245
+ */
246
+ name?: string;
247
+ };
248
+ /**
249
+ * Opens a tool call. The arguments arrive as TOOL_CALL_ARGS events and the
250
+ * call closes with TOOL_CALL_END.
251
+ */
252
+ type ToolCallStartEvent = {
253
+ /**
254
+ * Which event this is. Each event definition narrows this to a single value.
255
+ */
256
+ type: EventType.TOOL_CALL_START;
257
+ /**
258
+ * When the event was created. Bounded to the range JSON numbers survive a
259
+ * round trip in, so the value a consumer reads is the value the producer
260
+ * wrote. Deliberately not a float. The unit is not constrained here, because
261
+ * it never has been stated normatively; every SDK that sets it in practice
262
+ * uses milliseconds since the Unix epoch, and a producer choosing another
263
+ * unit will be misread by consumers even though it validates. Nothing in the
264
+ * protocol computes with this value.
265
+ */
266
+ timestamp?: number;
267
+ /**
268
+ * The provider-native event this one was translated from, carried verbatim
269
+ * for debugging and for consumers that need detail the protocol does not
270
+ * model. Any JSON value.
271
+ */
272
+ rawEvent?: any;
273
+ /**
274
+ * Extra information attached to this event.
275
+ */
276
+ metadata?: Metadata;
277
+ /**
278
+ * The subagent invocation this belongs to. Absent means the parent agent
279
+ * produced it directly.
280
+ */
281
+ subagentRunId?: SubagentRunId;
282
+ /**
283
+ * Identifies the call, and ties the later args, end and result events to it.
284
+ */
285
+ toolCallId: string;
286
+ /**
287
+ * Which tool is being called.
288
+ */
289
+ toolCallName: string;
290
+ /**
291
+ * The assistant message that holds this call. Absent means the producer did
292
+ * not attribute it to one.
293
+ */
294
+ parentMessageId?: string;
295
+ };
296
+ /**
297
+ * Appends a fragment of a tool call's arguments.
298
+ */
299
+ type ToolCallArgsEvent = {
300
+ /**
301
+ * Which event this is. Each event definition narrows this to a single value.
302
+ */
303
+ type: EventType.TOOL_CALL_ARGS;
304
+ /**
305
+ * When the event was created. Bounded to the range JSON numbers survive a
306
+ * round trip in, so the value a consumer reads is the value the producer
307
+ * wrote. Deliberately not a float. The unit is not constrained here, because
308
+ * it never has been stated normatively; every SDK that sets it in practice
309
+ * uses milliseconds since the Unix epoch, and a producer choosing another
310
+ * unit will be misread by consumers even though it validates. Nothing in the
311
+ * protocol computes with this value.
312
+ */
313
+ timestamp?: number;
314
+ /**
315
+ * The provider-native event this one was translated from, carried verbatim
316
+ * for debugging and for consumers that need detail the protocol does not
317
+ * model. Any JSON value.
318
+ */
319
+ rawEvent?: any;
320
+ /**
321
+ * Extra information attached to this event.
322
+ */
323
+ metadata?: Metadata;
324
+ /**
325
+ * The subagent invocation this belongs to. Absent means the parent agent
326
+ * produced it directly.
327
+ */
328
+ subagentRunId?: SubagentRunId;
329
+ /**
330
+ * The call these arguments belong to.
331
+ */
332
+ toolCallId: string;
333
+ /**
334
+ * A fragment of the arguments, which concatenate into the call's argument
335
+ * text — conventionally a JSON document, though the protocol does not
336
+ * validate it (see FunctionCall.arguments). Deliberately a string rather
337
+ * than parsed JSON: a fragment is not itself a document. May be the empty
338
+ * string.
339
+ */
340
+ delta: string;
341
+ };
342
+ /**
343
+ * Closes a tool call, meaning its arguments are complete.
344
+ */
345
+ type ToolCallEndEvent = {
346
+ /**
347
+ * Which event this is. Each event definition narrows this to a single value.
348
+ */
349
+ type: EventType.TOOL_CALL_END;
350
+ /**
351
+ * When the event was created. Bounded to the range JSON numbers survive a
352
+ * round trip in, so the value a consumer reads is the value the producer
353
+ * wrote. Deliberately not a float. The unit is not constrained here, because
354
+ * it never has been stated normatively; every SDK that sets it in practice
355
+ * uses milliseconds since the Unix epoch, and a producer choosing another
356
+ * unit will be misread by consumers even though it validates. Nothing in the
357
+ * protocol computes with this value.
358
+ */
359
+ timestamp?: number;
360
+ /**
361
+ * The provider-native event this one was translated from, carried verbatim
362
+ * for debugging and for consumers that need detail the protocol does not
363
+ * model. Any JSON value.
364
+ */
365
+ rawEvent?: any;
366
+ /**
367
+ * Extra information attached to this event.
368
+ */
369
+ metadata?: Metadata;
370
+ /**
371
+ * The subagent invocation this belongs to. Absent means the parent agent
372
+ * produced it directly.
373
+ */
374
+ subagentRunId?: SubagentRunId;
375
+ /**
376
+ * The call being closed.
377
+ */
378
+ toolCallId: string;
379
+ };
380
+ /**
381
+ * A shorthand that stands in for a tool call's start, args and end sequence.
382
+ * Every field is optional for the same reason as TEXT_MESSAGE_CHUNK.
383
+ */
384
+ type ToolCallChunkEvent = {
385
+ /**
386
+ * Which event this is. Each event definition narrows this to a single value.
387
+ */
388
+ type: EventType.TOOL_CALL_CHUNK;
389
+ /**
390
+ * When the event was created. Bounded to the range JSON numbers survive a
391
+ * round trip in, so the value a consumer reads is the value the producer
392
+ * wrote. Deliberately not a float. The unit is not constrained here, because
393
+ * it never has been stated normatively; every SDK that sets it in practice
394
+ * uses milliseconds since the Unix epoch, and a producer choosing another
395
+ * unit will be misread by consumers even though it validates. Nothing in the
396
+ * protocol computes with this value.
397
+ */
398
+ timestamp?: number;
399
+ /**
400
+ * The provider-native event this one was translated from, carried verbatim
401
+ * for debugging and for consumers that need detail the protocol does not
402
+ * model. Any JSON value.
403
+ */
404
+ rawEvent?: any;
405
+ /**
406
+ * Extra information attached to this event.
407
+ */
408
+ metadata?: Metadata;
409
+ /**
410
+ * The subagent invocation this belongs to. Absent means the parent agent
411
+ * produced it directly.
412
+ */
413
+ subagentRunId?: SubagentRunId;
414
+ /**
415
+ * The call this chunk belongs to. Absent continues the call already open.
416
+ */
417
+ toolCallId?: string;
418
+ /**
419
+ * Which tool is being called, on the chunk that opens it.
420
+ */
421
+ toolCallName?: string;
422
+ /**
423
+ * The assistant message that holds this call.
424
+ */
425
+ parentMessageId?: string;
426
+ /**
427
+ * A fragment of the arguments. May be the empty string.
428
+ */
429
+ delta?: string;
430
+ };
431
+ /**
432
+ * A text part.
433
+ */
434
+ type TextPart = {
435
+ /**
436
+ * Discriminator.
437
+ */
438
+ type: "text";
439
+ /**
440
+ * Identifies this part within its message. Optional, and nothing reads it
441
+ * yet: reserved so that a streamed part can be matched to its entry in
442
+ * history once assistant messages carry parts too.
443
+ */
444
+ id?: string;
445
+ /**
446
+ * The text.
447
+ */
448
+ text: string;
449
+ /**
450
+ * Extra information about this part. Unconstrained, as on the media parts.
451
+ * This is where a text search hit carries its source and title, rather than
452
+ * the protocol modelling a search-result part of its own.
453
+ */
454
+ metadata?: any;
455
+ };
456
+ /**
457
+ * Bytes carried inline.
458
+ */
459
+ type DataSource = {
460
+ /**
461
+ * Discriminator.
462
+ */
463
+ type: "data";
464
+ /**
465
+ * The bytes, base64-encoded. contentEncoding is an annotation rather than a
466
+ * constraint in 2020-12, so a malformed string still validates here;
467
+ * rejecting one is the decoder's job.
468
+ * @contentEncoding base64
469
+ */
470
+ value: string;
471
+ /**
472
+ * What the bytes are. Required here, unlike on a URL source, because nothing
473
+ * else can tell a consumer how to read them.
474
+ */
475
+ mimeType: string;
476
+ };
477
+ /**
478
+ * Bytes referenced by URL, fetched by whoever needs them.
479
+ */
480
+ type UrlSource = {
481
+ /**
482
+ * Discriminator.
483
+ */
484
+ type: "url";
485
+ /**
486
+ * The URL. Deliberately not constrained to a URI format, so a scheme a
487
+ * producer already uses is not rejected here.
488
+ */
489
+ value: string;
490
+ /**
491
+ * What the resource is, when the producer knows. Optional, because the
492
+ * response can say.
493
+ */
494
+ mimeType?: string;
495
+ };
496
+ /**
497
+ * Bytes already at the provider, named by a handle the provider issued: an
498
+ * OpenAI or Anthropic file id, a Gemini file URI, a storage URL only that
499
+ * provider can read. No bytes travel and nothing is fetched. Only the provider
500
+ * that minted the handle can resolve it; a peer that cannot drops the part as
501
+ * it drops any part it cannot use.
502
+ */
503
+ type FileSource = {
504
+ /**
505
+ * Discriminator.
506
+ */
507
+ type: "file";
508
+ /**
509
+ * The handle, exactly as the provider issued it. Opaque: a consumer MUST NOT
510
+ * fetch it, parse it or read a scheme out of it.
511
+ */
512
+ value: string;
513
+ /**
514
+ * Who issued the handle, when the producer knows. Optional: an agent already
515
+ * knows which provider it talks to. When present, SHOULD be the lowercase
516
+ * vendor id (openai, anthropic, google) that TokenUsage.provider uses, so a
517
+ * peer can tell before sending whether a handle is one it can use.
518
+ */
519
+ provider?: string;
520
+ /**
521
+ * What the file is, when the producer knows. Optional, because the provider
522
+ * that holds the bytes knows.
523
+ */
524
+ mimeType?: string;
525
+ };
526
+ /**
527
+ * Where a media part's bytes come from: carried inline, referenced by URL, or
528
+ * already at the provider under a handle it issued.
529
+ */
530
+ type PartSource = DataSource | UrlSource | FileSource;
531
+ /**
532
+ * An image part.
533
+ */
534
+ type ImagePart = {
535
+ /**
536
+ * Discriminator.
537
+ */
538
+ type: "image";
539
+ /**
540
+ * Identifies this part within its message. Optional, and nothing reads it
541
+ * yet: reserved as on the text part.
542
+ */
543
+ id?: string;
544
+ /**
545
+ * Where the image comes from.
546
+ */
547
+ source: PartSource;
548
+ /**
549
+ * Extra information about this part. Unconstrained rather than an object:
550
+ * inherited from the SDKs, which declare it unknown rather than a record;
551
+ * listed under known divergences in the README rather than resolved here.
552
+ */
553
+ metadata?: any;
554
+ };
555
+ /**
556
+ * An audio part.
557
+ */
558
+ type AudioPart = {
559
+ /**
560
+ * Discriminator.
561
+ */
562
+ type: "audio";
563
+ /**
564
+ * Identifies this part within its message. Optional, and nothing reads it
565
+ * yet: reserved as on the text part.
566
+ */
567
+ id?: string;
568
+ /**
569
+ * Where the audio comes from.
570
+ */
571
+ source: PartSource;
572
+ /**
573
+ * Extra information about this part. Unconstrained, as on the other media
574
+ * parts.
575
+ */
576
+ metadata?: any;
577
+ };
578
+ /**
579
+ * A video part.
580
+ */
581
+ type VideoPart = {
582
+ /**
583
+ * Discriminator.
584
+ */
585
+ type: "video";
586
+ /**
587
+ * Identifies this part within its message. Optional, and nothing reads it
588
+ * yet: reserved as on the text part.
589
+ */
590
+ id?: string;
591
+ /**
592
+ * Where the video comes from.
593
+ */
594
+ source: PartSource;
595
+ /**
596
+ * Extra information about this part. Unconstrained, as on the other media
597
+ * parts.
598
+ */
599
+ metadata?: any;
600
+ };
601
+ /**
602
+ * A document part.
603
+ */
604
+ type DocumentPart = {
605
+ /**
606
+ * Discriminator.
607
+ */
608
+ type: "document";
609
+ /**
610
+ * Identifies this part within its message. Optional, and nothing reads it
611
+ * yet: reserved as on the text part.
612
+ */
613
+ id?: string;
614
+ /**
615
+ * Where the document comes from.
616
+ */
617
+ source: PartSource;
618
+ /**
619
+ * Extra information about this part. Unconstrained, as on the other media
620
+ * parts.
621
+ */
622
+ metadata?: any;
623
+ };
624
+ /**
625
+ * One part of a message body: what a person sends in a user message, or what a
626
+ * tool returns in a tool message. Discriminated by type. Named by what the
627
+ * part is rather than by direction, because the same part travels into the
628
+ * model inside a user message and back out of the stream inside a tool result.
629
+ */
630
+ type ContentPart = TextPart | ImagePart | AudioPart | VideoPart | DocumentPart;
631
+ /**
632
+ * Carries what a tool returned. Mints a tool message rather than appending to
633
+ * an existing one, which is why it has its own messageId.
634
+ */
635
+ type ToolCallResultEvent = {
636
+ /**
637
+ * Which event this is. Each event definition narrows this to a single value.
638
+ */
639
+ type: EventType.TOOL_CALL_RESULT;
640
+ /**
641
+ * When the event was created. Bounded to the range JSON numbers survive a
642
+ * round trip in, so the value a consumer reads is the value the producer
643
+ * wrote. Deliberately not a float. The unit is not constrained here, because
644
+ * it never has been stated normatively; every SDK that sets it in practice
645
+ * uses milliseconds since the Unix epoch, and a producer choosing another
646
+ * unit will be misread by consumers even though it validates. Nothing in the
647
+ * protocol computes with this value.
648
+ */
649
+ timestamp?: number;
650
+ /**
651
+ * The provider-native event this one was translated from, carried verbatim
652
+ * for debugging and for consumers that need detail the protocol does not
653
+ * model. Any JSON value.
654
+ */
655
+ rawEvent?: any;
656
+ /**
657
+ * Extra information attached to this event.
658
+ */
659
+ metadata?: Metadata;
660
+ /**
661
+ * The subagent invocation this belongs to. Absent means the parent agent
662
+ * produced it directly.
663
+ */
664
+ subagentRunId?: SubagentRunId;
665
+ /**
666
+ * The tool message this result becomes.
667
+ */
668
+ messageId: string;
669
+ /**
670
+ * The call being answered.
671
+ */
672
+ toolCallId: string;
673
+ /**
674
+ * What the tool returned: either plain text, or an ordered list of parts,
675
+ * exactly as on the tool message this event mints. A tool returning
676
+ * structured data serialises it into text; media travel as parts of their
677
+ * own.
678
+ */
679
+ content: string | ContentPart[];
680
+ /**
681
+ * Present only for symmetry with the message it mints; the value is fixed,
682
+ * so a producer may leave it out.
683
+ */
684
+ role?: "tool";
685
+ };
686
+ /**
687
+ * Agent state. Any JSON value: the protocol carries state without interpreting
688
+ * it, so an object, an array, a string and a number are all valid.
689
+ */
690
+ type State = any;
691
+ /**
692
+ * Replaces the agent state wholesale. Sent when a delta cannot express the
693
+ * change, or to resynchronise a consumer.
694
+ */
695
+ type StateSnapshotEvent = {
696
+ /**
697
+ * Which event this is. Each event definition narrows this to a single value.
698
+ */
699
+ type: EventType.STATE_SNAPSHOT;
700
+ /**
701
+ * When the event was created. Bounded to the range JSON numbers survive a
702
+ * round trip in, so the value a consumer reads is the value the producer
703
+ * wrote. Deliberately not a float. The unit is not constrained here, because
704
+ * it never has been stated normatively; every SDK that sets it in practice
705
+ * uses milliseconds since the Unix epoch, and a producer choosing another
706
+ * unit will be misread by consumers even though it validates. Nothing in the
707
+ * protocol computes with this value.
708
+ */
709
+ timestamp?: number;
710
+ /**
711
+ * The provider-native event this one was translated from, carried verbatim
712
+ * for debugging and for consumers that need detail the protocol does not
713
+ * model. Any JSON value.
714
+ */
715
+ rawEvent?: any;
716
+ /**
717
+ * Extra information attached to this event.
718
+ */
719
+ metadata?: Metadata;
720
+ /**
721
+ * The subagent invocation this belongs to. Absent means the parent agent
722
+ * produced it directly.
723
+ */
724
+ subagentRunId?: SubagentRunId;
725
+ /**
726
+ * The complete new state.
727
+ */
728
+ snapshot: State;
729
+ };
730
+ /**
731
+ * A JSON Pointer as defined by RFC 6901. Either the empty string, meaning the
732
+ * whole document, or a sequence of slash-prefixed reference tokens in which a
733
+ * tilde is escaped as ~0 and a slash as ~1. A value with no leading slash, or
734
+ * a tilde followed by anything other than 0 or 1, is not a JSON Pointer.
735
+ */
736
+ type JsonPointer = string;
737
+ /**
738
+ * Inserts value at path. RFC 6902 section 4.1.
739
+ */
740
+ type AddOperation = {
741
+ /**
742
+ * Discriminator for the add operation.
743
+ */
744
+ op: "add";
745
+ /**
746
+ * Where to insert the value.
747
+ */
748
+ path: JsonPointer;
749
+ /**
750
+ * The value to insert. Any JSON value, including null, which is a legitimate
751
+ * thing to add.
752
+ */
753
+ value: any;
754
+ };
755
+ /**
756
+ * Removes the value at path. RFC 6902 section 4.2.
757
+ */
758
+ type RemoveOperation = {
759
+ /**
760
+ * Discriminator for the remove operation.
761
+ */
762
+ op: "remove";
763
+ /**
764
+ * What to remove.
765
+ */
766
+ path: JsonPointer;
767
+ };
768
+ /**
769
+ * Replaces the value at path. RFC 6902 section 4.3.
770
+ */
771
+ type ReplaceOperation = {
772
+ /**
773
+ * Discriminator for the replace operation.
774
+ */
775
+ op: "replace";
776
+ /**
777
+ * What to replace.
778
+ */
779
+ path: JsonPointer;
780
+ /**
781
+ * The replacement. Any JSON value, including null.
782
+ */
783
+ value: any;
784
+ };
785
+ /**
786
+ * Moves the value at from to path. RFC 6902 section 4.4.
787
+ */
788
+ type MoveOperation = {
789
+ /**
790
+ * Discriminator for the move operation.
791
+ */
792
+ op: "move";
793
+ /**
794
+ * Where the value is moved from.
795
+ */
796
+ from: JsonPointer;
797
+ /**
798
+ * Where the value is moved to.
799
+ */
800
+ path: JsonPointer;
801
+ };
802
+ /**
803
+ * Copies the value at from to path. RFC 6902 section 4.5.
804
+ */
805
+ type CopyOperation = {
806
+ /**
807
+ * Discriminator for the copy operation.
808
+ */
809
+ op: "copy";
810
+ /**
811
+ * Where the value is copied from.
812
+ */
813
+ from: JsonPointer;
814
+ /**
815
+ * Where the value is copied to.
816
+ */
817
+ path: JsonPointer;
818
+ };
819
+ /**
820
+ * Asserts that the value at path equals value. RFC 6902 section 4.6.
821
+ */
822
+ type TestOperation = {
823
+ /**
824
+ * Discriminator for the test operation.
825
+ */
826
+ op: "test";
827
+ /**
828
+ * What to compare.
829
+ */
830
+ path: JsonPointer;
831
+ /**
832
+ * The value the target must equal. Any JSON value, including null.
833
+ */
834
+ value: any;
835
+ };
836
+ /**
837
+ * A single RFC 6902 operation. Exactly one of the operation shapes must match,
838
+ * discriminated by op. Unlike the protocol's own objects, the operations are
839
+ * open: RFC 6902 section 4 requires members an operation does not define to be
840
+ * ignored rather than rejected, so a remove carrying a leftover value is a
841
+ * valid patch. Two of the RFC's rules are relations between values rather than
842
+ * shapes, so no static schema can express them and neither is checked here: a
843
+ * move whose from is a proper prefix of its path (section 4.4), and any
844
+ * operation whose pointer does not resolve in the target document. Both are
845
+ * the applier's to reject.
846
+ */
847
+ type JsonPatchOperation = AddOperation | RemoveOperation | ReplaceOperation | MoveOperation | CopyOperation | TestOperation;
848
+ /**
849
+ * A JSON Patch document as defined by RFC 6902, referenced by
850
+ * STATE_DELTA.delta and ACTIVITY_DELTA.patch: an ordered sequence of
851
+ * operations applied to a target document. An empty array is a valid no-op
852
+ * patch. Whether the operations actually apply to the document they target is
853
+ * a runtime question RFC 6902 leaves to the applier; structural validity here
854
+ * says nothing about it.
855
+ */
856
+ type JsonPatch = JsonPatchOperation[];
857
+ /**
858
+ * Changes the agent state incrementally.
859
+ */
860
+ type StateDeltaEvent = {
861
+ /**
862
+ * Which event this is. Each event definition narrows this to a single value.
863
+ */
864
+ type: EventType.STATE_DELTA;
865
+ /**
866
+ * When the event was created. Bounded to the range JSON numbers survive a
867
+ * round trip in, so the value a consumer reads is the value the producer
868
+ * wrote. Deliberately not a float. The unit is not constrained here, because
869
+ * it never has been stated normatively; every SDK that sets it in practice
870
+ * uses milliseconds since the Unix epoch, and a producer choosing another
871
+ * unit will be misread by consumers even though it validates. Nothing in the
872
+ * protocol computes with this value.
873
+ */
874
+ timestamp?: number;
875
+ /**
876
+ * The provider-native event this one was translated from, carried verbatim
877
+ * for debugging and for consumers that need detail the protocol does not
878
+ * model. Any JSON value.
879
+ */
880
+ rawEvent?: any;
881
+ /**
882
+ * Extra information attached to this event.
883
+ */
884
+ metadata?: Metadata;
885
+ /**
886
+ * The subagent invocation this belongs to. Absent means the parent agent
887
+ * produced it directly.
888
+ */
889
+ subagentRunId?: SubagentRunId;
890
+ /**
891
+ * The change, as an RFC 6902 patch against the current state. Structural
892
+ * validity here does not mean the patch applies: a well-formed operation may
893
+ * point at a path that does not exist, which RFC 6902 leaves to the applier.
894
+ */
895
+ delta: JsonPatch;
896
+ };
897
+ /**
898
+ * Instructions from the application developer.
899
+ */
900
+ type DeveloperMessage = {
901
+ /**
902
+ * The subagent invocation this belongs to. Absent means the parent agent
903
+ * produced it directly.
904
+ */
905
+ subagentRunId?: SubagentRunId;
906
+ /**
907
+ * Identifies the message within the conversation.
908
+ */
909
+ id: string;
910
+ /**
911
+ * Who the message is from. Each message definition narrows this to a single
912
+ * value.
913
+ */
914
+ role: "developer";
915
+ /**
916
+ * An optional display name for the author.
917
+ */
918
+ name?: string;
919
+ /**
920
+ * A provider's opaque artefact belonging to this message, stored by a
921
+ * consumer and returned on a later turn.
922
+ */
923
+ encryptedValue?: string;
924
+ /**
925
+ * Extra information attached to this message.
926
+ */
927
+ metadata?: Metadata;
928
+ /**
929
+ * The instructions. Required: a developer message with nothing in it says
930
+ * nothing.
931
+ */
932
+ content: string;
933
+ };
934
+ /**
935
+ * Instructions from the system.
936
+ */
937
+ type SystemMessage = {
938
+ /**
939
+ * The subagent invocation this belongs to. Absent means the parent agent
940
+ * produced it directly.
941
+ */
942
+ subagentRunId?: SubagentRunId;
943
+ /**
944
+ * Identifies the message within the conversation.
945
+ */
946
+ id: string;
947
+ /**
948
+ * Who the message is from. Each message definition narrows this to a single
949
+ * value.
950
+ */
951
+ role: "system";
952
+ /**
953
+ * An optional display name for the author.
954
+ */
955
+ name?: string;
956
+ /**
957
+ * A provider's opaque artefact belonging to this message, stored by a
958
+ * consumer and returned on a later turn.
959
+ */
960
+ encryptedValue?: string;
961
+ /**
962
+ * Extra information attached to this message.
963
+ */
964
+ metadata?: Metadata;
965
+ /**
966
+ * The instructions. Required.
967
+ */
968
+ content: string;
969
+ };
970
+ /**
971
+ * The name and arguments of a tool call.
972
+ */
973
+ type FunctionCall = {
974
+ /**
975
+ * Which tool is being called.
976
+ */
977
+ name: string;
978
+ /**
979
+ * The arguments as a JSON string, not as parsed JSON. Kept as written
980
+ * because a model can emit arguments that are not valid JSON, and losing
981
+ * them at the protocol boundary would hide the fault from the consumer that
982
+ * has to handle it.
983
+ */
984
+ arguments: string;
985
+ };
986
+ /**
987
+ * A call an assistant message made. Carries no subagent attribution of its own
988
+ * and inherits its containing message's, since several calls can share one
989
+ * parent.
990
+ */
991
+ type ToolCall = {
992
+ /**
993
+ * Identifies the call. The answering tool message carries this as its
994
+ * toolCallId.
995
+ */
996
+ id: string;
997
+ /**
998
+ * The only kind of call the protocol models.
999
+ */
1000
+ type: "function";
1001
+ /**
1002
+ * What is being called, and with what.
1003
+ */
1004
+ function: FunctionCall;
1005
+ /**
1006
+ * A provider's opaque artefact belonging to this call.
1007
+ */
1008
+ encryptedValue?: string;
1009
+ /**
1010
+ * Extra information attached to this call. Carried here rather than folded
1011
+ * into the containing message, because several calls can share one parent
1012
+ * and merging them would make the result depend on their order.
1013
+ */
1014
+ metadata?: Metadata;
1015
+ };
1016
+ /**
1017
+ * A message from the agent. Content is optional because a turn may consist
1018
+ * only of tool calls.
1019
+ */
1020
+ type AssistantMessage = {
1021
+ /**
1022
+ * The subagent invocation this belongs to. Absent means the parent agent
1023
+ * produced it directly.
1024
+ */
1025
+ subagentRunId?: SubagentRunId;
1026
+ /**
1027
+ * Identifies the message within the conversation.
1028
+ */
1029
+ id: string;
1030
+ /**
1031
+ * Who the message is from. Each message definition narrows this to a single
1032
+ * value.
1033
+ */
1034
+ role: "assistant";
1035
+ /**
1036
+ * An optional display name for the author.
1037
+ */
1038
+ name?: string;
1039
+ /**
1040
+ * A provider's opaque artefact belonging to this message, stored by a
1041
+ * consumer and returned on a later turn.
1042
+ */
1043
+ encryptedValue?: string;
1044
+ /**
1045
+ * Extra information attached to this message.
1046
+ */
1047
+ metadata?: Metadata;
1048
+ /**
1049
+ * What the agent said, if it said anything.
1050
+ */
1051
+ content?: string;
1052
+ /**
1053
+ * The tool calls this turn made.
1054
+ */
1055
+ toolCalls?: ToolCall[];
1056
+ };
1057
+ /**
1058
+ * A message from the person using the application.
1059
+ */
1060
+ type UserMessage = {
1061
+ /**
1062
+ * The subagent invocation this belongs to. Absent means the parent agent
1063
+ * produced it directly.
1064
+ */
1065
+ subagentRunId?: SubagentRunId;
1066
+ /**
1067
+ * Identifies the message within the conversation.
1068
+ */
1069
+ id: string;
1070
+ /**
1071
+ * Who the message is from. Each message definition narrows this to a single
1072
+ * value.
1073
+ */
1074
+ role: "user";
1075
+ /**
1076
+ * An optional display name for the author.
1077
+ */
1078
+ name?: string;
1079
+ /**
1080
+ * A provider's opaque artefact belonging to this message, stored by a
1081
+ * consumer and returned on a later turn.
1082
+ */
1083
+ encryptedValue?: string;
1084
+ /**
1085
+ * Extra information attached to this message.
1086
+ */
1087
+ metadata?: Metadata;
1088
+ /**
1089
+ * What the person sent: either plain text, or an ordered list of parts for a
1090
+ * multimodal message.
1091
+ */
1092
+ content: string | ContentPart[];
1093
+ };
1094
+ /**
1095
+ * What a tool returned, as a message in the conversation. Stands alone rather
1096
+ * than composing BaseMessage, because it carries no name.
1097
+ */
1098
+ type ToolMessage = {
1099
+ /**
1100
+ * The subagent invocation this belongs to. Absent means the parent agent
1101
+ * produced it directly.
1102
+ */
1103
+ subagentRunId?: SubagentRunId;
1104
+ /**
1105
+ * Identifies the message.
1106
+ */
1107
+ id: string;
1108
+ /**
1109
+ * Fixed. Declared here rather than inherited, because this message does not
1110
+ * compose BaseMessage.
1111
+ */
1112
+ role: "tool";
1113
+ /**
1114
+ * What the tool returned: either plain text, or an ordered list of parts. A
1115
+ * tool returning structured data serialises it into text; media travel as
1116
+ * parts of their own.
1117
+ */
1118
+ content: string | ContentPart[];
1119
+ /**
1120
+ * The call this answers.
1121
+ */
1122
+ toolCallId: string;
1123
+ /**
1124
+ * Why the tool failed, when it did. Present alongside content rather than
1125
+ * instead of it, so a partial result survives a failure.
1126
+ */
1127
+ error?: string;
1128
+ /**
1129
+ * A provider's opaque artefact belonging to this message.
1130
+ */
1131
+ encryptedValue?: string;
1132
+ /**
1133
+ * Extra information attached to this message.
1134
+ */
1135
+ metadata?: Metadata;
1136
+ };
1137
+ /**
1138
+ * Structured progress that is not conversation content, materialised as a
1139
+ * message so it keeps its place in the sequence. Stands alone rather than
1140
+ * composing BaseMessage, because its content is an object rather than a
1141
+ * string.
1142
+ */
1143
+ type ActivityMessage = {
1144
+ /**
1145
+ * The subagent invocation this belongs to. Absent means the parent agent
1146
+ * produced it directly.
1147
+ */
1148
+ subagentRunId?: SubagentRunId;
1149
+ /**
1150
+ * Identifies the message.
1151
+ */
1152
+ id: string;
1153
+ /**
1154
+ * Fixed. Declared here rather than inherited, because this message does not
1155
+ * compose BaseMessage.
1156
+ */
1157
+ role: "activity";
1158
+ /**
1159
+ * What kind of activity this is. An open string: the set is the producer's.
1160
+ */
1161
+ activityType: string;
1162
+ /**
1163
+ * The activity's payload, open by key.
1164
+ */
1165
+ content: Record<string, any>;
1166
+ /**
1167
+ * Extra information attached to this message.
1168
+ */
1169
+ metadata?: Metadata;
1170
+ };
1171
+ /**
1172
+ * A span of the agent's reasoning, materialised as a message. Stands alone
1173
+ * rather than composing BaseMessage, because it carries no name.
1174
+ */
1175
+ type ReasoningMessage = {
1176
+ /**
1177
+ * The subagent invocation this belongs to. Absent means the parent agent
1178
+ * produced it directly.
1179
+ */
1180
+ subagentRunId?: SubagentRunId;
1181
+ /**
1182
+ * Identifies the message.
1183
+ */
1184
+ id: string;
1185
+ /**
1186
+ * Fixed. Declared here rather than inherited, because this message does not
1187
+ * compose BaseMessage.
1188
+ */
1189
+ role: "reasoning";
1190
+ /**
1191
+ * The reasoning text.
1192
+ */
1193
+ content: string;
1194
+ /**
1195
+ * A provider's opaque reasoning artefact belonging to this message.
1196
+ */
1197
+ encryptedValue?: string;
1198
+ /**
1199
+ * Extra information attached to this message.
1200
+ */
1201
+ metadata?: Metadata;
1202
+ };
1203
+ /**
1204
+ * Any message in a conversation. Discriminated by role.
1205
+ */
1206
+ type Message = DeveloperMessage | SystemMessage | AssistantMessage | UserMessage | ToolMessage | ActivityMessage | ReasoningMessage;
1207
+ /**
1208
+ * The complete set of messages the producer owns, in order. Conversation-wide
1209
+ * rather than a plain overwrite: a consumer may keep messages of its own that
1210
+ * no producer tracks, so exactly how a snapshot reconciles with those is
1211
+ * behavioural and belongs in the prose. Being conversation-wide it cannot
1212
+ * belong to a single subagent, so it carries no attribution; it does establish
1213
+ * which subagent owns each message it contains, through the messages
1214
+ * themselves.
1215
+ */
1216
+ type MessagesSnapshotEvent = {
1217
+ /**
1218
+ * Which event this is. Each event definition narrows this to a single value.
1219
+ */
1220
+ type: EventType.MESSAGES_SNAPSHOT;
1221
+ /**
1222
+ * When the event was created. Bounded to the range JSON numbers survive a
1223
+ * round trip in, so the value a consumer reads is the value the producer
1224
+ * wrote. Deliberately not a float. The unit is not constrained here, because
1225
+ * it never has been stated normatively; every SDK that sets it in practice
1226
+ * uses milliseconds since the Unix epoch, and a producer choosing another
1227
+ * unit will be misread by consumers even though it validates. Nothing in the
1228
+ * protocol computes with this value.
1229
+ */
1230
+ timestamp?: number;
1231
+ /**
1232
+ * The provider-native event this one was translated from, carried verbatim
1233
+ * for debugging and for consumers that need detail the protocol does not
1234
+ * model. Any JSON value.
1235
+ */
1236
+ rawEvent?: any;
1237
+ /**
1238
+ * Extra information attached to this event.
1239
+ */
1240
+ metadata?: Metadata;
1241
+ /**
1242
+ * The messages the producer is declaring, in order.
1243
+ */
1244
+ messages: Message[];
1245
+ };
1246
+ /**
1247
+ * Reports structured progress that is not conversation content, such as a step
1248
+ * a UI renders as its own widget.
1249
+ */
1250
+ type ActivitySnapshotEvent = {
1251
+ /**
1252
+ * Which event this is. Each event definition narrows this to a single value.
1253
+ */
1254
+ type: EventType.ACTIVITY_SNAPSHOT;
1255
+ /**
1256
+ * When the event was created. Bounded to the range JSON numbers survive a
1257
+ * round trip in, so the value a consumer reads is the value the producer
1258
+ * wrote. Deliberately not a float. The unit is not constrained here, because
1259
+ * it never has been stated normatively; every SDK that sets it in practice
1260
+ * uses milliseconds since the Unix epoch, and a producer choosing another
1261
+ * unit will be misread by consumers even though it validates. Nothing in the
1262
+ * protocol computes with this value.
1263
+ */
1264
+ timestamp?: number;
1265
+ /**
1266
+ * The provider-native event this one was translated from, carried verbatim
1267
+ * for debugging and for consumers that need detail the protocol does not
1268
+ * model. Any JSON value.
1269
+ */
1270
+ rawEvent?: any;
1271
+ /**
1272
+ * Extra information attached to this event.
1273
+ */
1274
+ metadata?: Metadata;
1275
+ /**
1276
+ * The subagent invocation this belongs to. Absent means the parent agent
1277
+ * produced it directly.
1278
+ */
1279
+ subagentRunId?: SubagentRunId;
1280
+ /**
1281
+ * The activity message this describes.
1282
+ */
1283
+ messageId: string;
1284
+ /**
1285
+ * What kind of activity this is. An open string: the set is the producer's,
1286
+ * not the protocol's.
1287
+ */
1288
+ activityType: string;
1289
+ /**
1290
+ * The activity's payload, open by key.
1291
+ */
1292
+ content: Record<string, any>;
1293
+ /**
1294
+ * Whether this snapshot overwrites the activity's existing content. Absent
1295
+ * means it does, and that meaning is normative; only an explicit false asks
1296
+ * a consumer to leave what is already there. It does not ask for a merge —
1297
+ * ACTIVITY_DELTA is how content is changed incrementally. What a consumer
1298
+ * does with a non-overwriting snapshot is behavioural and belongs in the
1299
+ * prose.
1300
+ * @default true
1301
+ */
1302
+ replace?: boolean;
1303
+ };
1304
+ /**
1305
+ * Changes an activity message's content incrementally.
1306
+ */
1307
+ type ActivityDeltaEvent = {
1308
+ /**
1309
+ * Which event this is. Each event definition narrows this to a single value.
1310
+ */
1311
+ type: EventType.ACTIVITY_DELTA;
1312
+ /**
1313
+ * When the event was created. Bounded to the range JSON numbers survive a
1314
+ * round trip in, so the value a consumer reads is the value the producer
1315
+ * wrote. Deliberately not a float. The unit is not constrained here, because
1316
+ * it never has been stated normatively; every SDK that sets it in practice
1317
+ * uses milliseconds since the Unix epoch, and a producer choosing another
1318
+ * unit will be misread by consumers even though it validates. Nothing in the
1319
+ * protocol computes with this value.
1320
+ */
1321
+ timestamp?: number;
1322
+ /**
1323
+ * The provider-native event this one was translated from, carried verbatim
1324
+ * for debugging and for consumers that need detail the protocol does not
1325
+ * model. Any JSON value.
1326
+ */
1327
+ rawEvent?: any;
1328
+ /**
1329
+ * Extra information attached to this event.
1330
+ */
1331
+ metadata?: Metadata;
1332
+ /**
1333
+ * The subagent invocation this belongs to. Absent means the parent agent
1334
+ * produced it directly.
1335
+ */
1336
+ subagentRunId?: SubagentRunId;
1337
+ /**
1338
+ * The activity message being changed.
1339
+ */
1340
+ messageId: string;
1341
+ /**
1342
+ * What kind of activity this is.
1343
+ */
1344
+ activityType: string;
1345
+ /**
1346
+ * The change, as an RFC 6902 patch against the activity's content.
1347
+ */
1348
+ patch: JsonPatch;
1349
+ };
1350
+ /**
1351
+ * Passes a provider-native event through untranslated, for consumers that need
1352
+ * detail the protocol does not model.
1353
+ */
1354
+ type RawEvent = {
1355
+ /**
1356
+ * Which event this is. Each event definition narrows this to a single value.
1357
+ */
1358
+ type: EventType.RAW;
1359
+ /**
1360
+ * When the event was created. Bounded to the range JSON numbers survive a
1361
+ * round trip in, so the value a consumer reads is the value the producer
1362
+ * wrote. Deliberately not a float. The unit is not constrained here, because
1363
+ * it never has been stated normatively; every SDK that sets it in practice
1364
+ * uses milliseconds since the Unix epoch, and a producer choosing another
1365
+ * unit will be misread by consumers even though it validates. Nothing in the
1366
+ * protocol computes with this value.
1367
+ */
1368
+ timestamp?: number;
1369
+ /**
1370
+ * The provider-native event this one was translated from, carried verbatim
1371
+ * for debugging and for consumers that need detail the protocol does not
1372
+ * model. Any JSON value.
1373
+ */
1374
+ rawEvent?: any;
1375
+ /**
1376
+ * Extra information attached to this event.
1377
+ */
1378
+ metadata?: Metadata;
1379
+ /**
1380
+ * The subagent invocation this belongs to. Absent means the parent agent
1381
+ * produced it directly.
1382
+ */
1383
+ subagentRunId?: SubagentRunId;
1384
+ /**
1385
+ * The provider's own event. Any JSON value, and required: an event whose
1386
+ * only purpose is to carry this would say nothing without it.
1387
+ */
1388
+ event: any;
1389
+ /**
1390
+ * Which provider or framework the event came from.
1391
+ */
1392
+ source?: string;
1393
+ };
1394
+ /**
1395
+ * The protocol's extension point for an application's own events. Anything a
1396
+ * consumer does with one is outside the protocol.
1397
+ */
1398
+ type CustomEvent = {
1399
+ /**
1400
+ * Which event this is. Each event definition narrows this to a single value.
1401
+ */
1402
+ type: EventType.CUSTOM;
1403
+ /**
1404
+ * When the event was created. Bounded to the range JSON numbers survive a
1405
+ * round trip in, so the value a consumer reads is the value the producer
1406
+ * wrote. Deliberately not a float. The unit is not constrained here, because
1407
+ * it never has been stated normatively; every SDK that sets it in practice
1408
+ * uses milliseconds since the Unix epoch, and a producer choosing another
1409
+ * unit will be misread by consumers even though it validates. Nothing in the
1410
+ * protocol computes with this value.
1411
+ */
1412
+ timestamp?: number;
1413
+ /**
1414
+ * The provider-native event this one was translated from, carried verbatim
1415
+ * for debugging and for consumers that need detail the protocol does not
1416
+ * model. Any JSON value.
1417
+ */
1418
+ rawEvent?: any;
1419
+ /**
1420
+ * Extra information attached to this event.
1421
+ */
1422
+ metadata?: Metadata;
1423
+ /**
1424
+ * The subagent invocation this belongs to. Absent means the parent agent
1425
+ * produced it directly.
1426
+ */
1427
+ subagentRunId?: SubagentRunId;
1428
+ /**
1429
+ * What this custom event is. Required: without it a consumer cannot route
1430
+ * the value.
1431
+ */
1432
+ name: string;
1433
+ /**
1434
+ * The payload. Any JSON value, and required.
1435
+ */
1436
+ value: any;
1437
+ };
1438
+ /**
1439
+ * A tool the agent may call.
1440
+ */
1441
+ type Tool = {
1442
+ /**
1443
+ * The tool's name, as the agent will call it.
1444
+ */
1445
+ name: string;
1446
+ /**
1447
+ * What the tool does, for the agent to decide when to use it.
1448
+ */
1449
+ description: string;
1450
+ /**
1451
+ * A JSON Schema describing the tool's arguments. Carried opaquely: the
1452
+ * protocol does not constrain or validate it. Optional, because all three
1453
+ * SDKs already treat it that way and a tool that takes no arguments has
1454
+ * nothing to declare; an absent schema and an empty one mean the same thing
1455
+ * to an agent.
1456
+ */
1457
+ parameters?: any;
1458
+ /**
1459
+ * Extra information about the tool, for consumers that attach their own
1460
+ * rendering or routing information to it.
1461
+ */
1462
+ metadata?: Metadata;
1463
+ };
1464
+ /**
1465
+ * A named piece of ambient information given to the agent for the run,
1466
+ * distinct from the conversation.
1467
+ */
1468
+ type Context = {
1469
+ /**
1470
+ * What this context is, for the agent to interpret.
1471
+ */
1472
+ description: string;
1473
+ /**
1474
+ * The context itself.
1475
+ */
1476
+ value: string;
1477
+ };
1478
+ /**
1479
+ * An answer to one interrupt, sent on the run that continues from it.
1480
+ */
1481
+ type ResumeEntry = {
1482
+ /**
1483
+ * The interrupt being answered.
1484
+ */
1485
+ interruptId: string;
1486
+ /**
1487
+ * Whether the interrupt was answered or abandoned.
1488
+ */
1489
+ status: "resolved" | "cancelled";
1490
+ /**
1491
+ * The answer the agent asked for and will act on. Any JSON value.
1492
+ */
1493
+ payload?: any;
1494
+ /**
1495
+ * Envelope information about the response, such as signatures or routing
1496
+ * keys, as opposed to payload, which is the answer itself.
1497
+ */
1498
+ metadata?: Metadata;
1499
+ };
1500
+ /**
1501
+ * A request to run an agent. Also echoed back as RUN_STARTED.input. Only
1502
+ * threadId, runId and messages are required: those are the three the SDKs
1503
+ * already agree on, and for tools and context an absent key and an empty array
1504
+ * mean the same thing, so requiring them would catch nothing a producer could
1505
+ * get wrong. Requiredness above describes the wire; this TypeScript type
1506
+ * additionally requires every field the SDK materialises.
1507
+ */
1508
+ type RunAgentInput = {
1509
+ /**
1510
+ * The conversation this run belongs to.
1511
+ */
1512
+ threadId: string;
1513
+ /**
1514
+ * Identifies this run.
1515
+ */
1516
+ runId: string;
1517
+ /**
1518
+ * The protocol version this consumer speaks, such as "1.0". Absent means the
1519
+ * input was produced before the protocol carried a version — the versioning
1520
+ * rules in the prose govern what each side does with that. Sent in-band
1521
+ * rather than by the transport, so a recorded exchange stays
1522
+ * self-describing.
1523
+ */
1524
+ protocolVersion?: string;
1525
+ /**
1526
+ * The run that spawned this one.
1527
+ */
1528
+ parentRunId?: string;
1529
+ /**
1530
+ * The state the run starts from.
1531
+ */
1532
+ state?: State;
1533
+ /**
1534
+ * The conversation so far, in order.
1535
+ */
1536
+ messages: Message[];
1537
+ /**
1538
+ * The tools the agent may call. Absent means none. Optional on the wire; the
1539
+ * TypeScript SDK materialises an absent one as an empty list, so this type
1540
+ * requires it.
1541
+ */
1542
+ tools: Tool[];
1543
+ /**
1544
+ * Ambient information for the run. Absent means none. Optional on the wire;
1545
+ * the TypeScript SDK materialises an absent one as an empty list, so this
1546
+ * type requires it.
1547
+ */
1548
+ context: Context[];
1549
+ /**
1550
+ * Application-specific values passed through to the agent untouched. Any
1551
+ * JSON value.
1552
+ */
1553
+ forwardedProps?: any;
1554
+ /**
1555
+ * Answers to the interrupts that ended a previous run, when this run
1556
+ * continues from one.
1557
+ */
1558
+ resume?: ResumeEntry[];
1559
+ };
1560
+ /**
1561
+ * Opens a run. Run-scoped, so it carries no subagent attribution.
1562
+ */
1563
+ type RunStartedEvent = {
1564
+ /**
1565
+ * Which event this is. Each event definition narrows this to a single value.
1566
+ */
1567
+ type: EventType.RUN_STARTED;
1568
+ /**
1569
+ * When the event was created. Bounded to the range JSON numbers survive a
1570
+ * round trip in, so the value a consumer reads is the value the producer
1571
+ * wrote. Deliberately not a float. The unit is not constrained here, because
1572
+ * it never has been stated normatively; every SDK that sets it in practice
1573
+ * uses milliseconds since the Unix epoch, and a producer choosing another
1574
+ * unit will be misread by consumers even though it validates. Nothing in the
1575
+ * protocol computes with this value.
1576
+ */
1577
+ timestamp?: number;
1578
+ /**
1579
+ * The provider-native event this one was translated from, carried verbatim
1580
+ * for debugging and for consumers that need detail the protocol does not
1581
+ * model. Any JSON value.
1582
+ */
1583
+ rawEvent?: any;
1584
+ /**
1585
+ * Extra information attached to this event.
1586
+ */
1587
+ metadata?: Metadata;
1588
+ /**
1589
+ * The conversation this run belongs to.
1590
+ */
1591
+ threadId: string;
1592
+ /**
1593
+ * Identifies this run.
1594
+ */
1595
+ runId: string;
1596
+ /**
1597
+ * The protocol version this producer speaks, such as "1.0" — the producer's
1598
+ * own version, not an echo of the input's, which is what makes the pair a
1599
+ * negotiation: each side declares itself and the consumer sees a downgrade
1600
+ * the moment it happens. Absent means a producer from before the protocol
1601
+ * carried a version.
1602
+ */
1603
+ protocolVersion?: string;
1604
+ /**
1605
+ * The run that spawned this one, when an agent invokes another agent as a
1606
+ * separate run rather than as a subagent within one.
1607
+ */
1608
+ parentRunId?: string;
1609
+ /**
1610
+ * The request this run was started from, echoed back so a consumer that did
1611
+ * not make the request can still see what the agent was asked.
1612
+ */
1613
+ input?: RunAgentInput;
1614
+ };
1615
+ /**
1616
+ * The run completed. Equivalent to an absent outcome. Closed like every other
1617
+ * object, which is also what keeps it from carrying the suspended sibling's
1618
+ * interrupts — a success with an interrupt still pending would be a
1619
+ * contradiction, not an extension. A completed run may still have left
1620
+ * frontend tool calls for the application to answer; pendingToolCallIds names
1621
+ * them.
1622
+ */
1623
+ type RunFinishedSuccessOutcome = {
1624
+ /**
1625
+ * Discriminator.
1626
+ */
1627
+ type: "success";
1628
+ /**
1629
+ * The tool calls this run started and left unanswered — no TOOL_CALL_RESULT
1630
+ * in the run — for the application to answer in the next input's messages,
1631
+ * in the order they were made. Absent or empty means the producer named
1632
+ * none, and a consumer derives the list from the stream; otherwise it is the
1633
+ * list, and it agrees with the stream. On the success outcome rather than
1634
+ * the event because a run that stopped on a frontend tool call is a
1635
+ * completed run: whether the application continues the thread is its own
1636
+ * decision, so the producer reports what it knows and no more. Each item: A
1637
+ * tool call id, as carried by TOOL_CALL_START.
1638
+ */
1639
+ pendingToolCallIds?: string[];
1640
+ };
1641
+ /**
1642
+ * Something a run needs from outside before it can continue, such as an
1643
+ * approval or a missing value.
1644
+ */
1645
+ type Interrupt = {
1646
+ /**
1647
+ * The subagent invocation this belongs to. Absent means the parent agent
1648
+ * produced it directly.
1649
+ */
1650
+ subagentRunId?: SubagentRunId;
1651
+ /**
1652
+ * Identifies the interrupt. A resume entry answers it by this id.
1653
+ */
1654
+ id: string;
1655
+ /**
1656
+ * Why the run stopped. An open string rather than an enumeration: the
1657
+ * protocol does not attempt to classify every reason an agent might need
1658
+ * input.
1659
+ */
1660
+ reason: string;
1661
+ /**
1662
+ * A human-readable prompt for whoever answers.
1663
+ */
1664
+ message?: string;
1665
+ /**
1666
+ * The tool call this interrupt concerns, when it is a tool approval.
1667
+ */
1668
+ toolCallId?: string;
1669
+ /**
1670
+ * A JSON Schema describing the answer this interrupt expects, so a consumer
1671
+ * can build a form for it. Carried opaquely: the protocol does not constrain
1672
+ * or validate it. Restricted to an object because TypeScript and Python both
1673
+ * declare it that way; .NET holds it as any JSON, and the ticket that
1674
+ * commissioned this schema lists it among the arbitrary-JSON fields.
1675
+ * Following the two that constrain it keeps the schema from accepting
1676
+ * documents the reference client rejects, at the cost of rejecting the
1677
+ * boolean schemas JSON Schema also permits — a bare true for "any answer".
1678
+ * Recorded as a known divergence rather than settled.
1679
+ */
1680
+ responseSchema?: Record<string, any>;
1681
+ /**
1682
+ * When the interrupt stops being answerable. Deliberately unconstrained
1683
+ * rather than a date-time format, because producers already disagree about
1684
+ * the representation and tightening it here would reject streams that work
1685
+ * today. The documented convention is ISO 8601, and a consumer comparing
1686
+ * this value will parse it as a date, so a value that is not one leaves the
1687
+ * interrupt looking permanently unexpired.
1688
+ */
1689
+ expiresAt?: string;
1690
+ /**
1691
+ * Extra information attached to this interrupt.
1692
+ */
1693
+ metadata?: Metadata;
1694
+ };
1695
+ /**
1696
+ * The run is paused, waiting for something outside it. Resuming means starting
1697
+ * a new run whose resume entries answer these interrupts.
1698
+ */
1699
+ type RunFinishedInterruptOutcome = {
1700
+ /**
1701
+ * Discriminator.
1702
+ */
1703
+ type: "interrupt";
1704
+ /**
1705
+ * What the run is waiting for. At least one: an interrupt outcome with
1706
+ * nothing to answer would leave a consumer with nothing to do.
1707
+ */
1708
+ interrupts: Interrupt[];
1709
+ };
1710
+ /**
1711
+ * The run was stopped before it completed, by whoever was running it, and did
1712
+ * not fail. Neither success nor interrupt: nothing was produced as a result,
1713
+ * and nothing is waited for, so the next run on the thread is an ordinary new
1714
+ * run rather than a resume. Closed like its siblings: a cancelled run has no
1715
+ * interrupts to carry. Named in the schema before 1.0 because an outcome a
1716
+ * consumer does not recognise is stripped and read as success — a cancellation
1717
+ * added later would reach every 1.0 consumer as a completed run.
1718
+ */
1719
+ type RunFinishedCancelledOutcome = {
1720
+ /**
1721
+ * Discriminator.
1722
+ */
1723
+ type: "cancelled";
1724
+ };
1725
+ /**
1726
+ * Why a run ended.
1727
+ */
1728
+ type RunFinishedOutcome = RunFinishedSuccessOutcome | RunFinishedInterruptOutcome | RunFinishedCancelledOutcome;
1729
+ /**
1730
+ * Token counts for one provider and model, in the protocol's own accounting:
1731
+ * every count is either a total or a named part of one, so entries from
1732
+ * different providers add up without double-counting. inputTokens and
1733
+ * outputTokens are the totals; reasoningTokens, cachedInputTokens and
1734
+ * cacheWriteInputTokens are parts of them, never additions to them;
1735
+ * totalTokens is the two totals summed. Every field is a label or a number —
1736
+ * nothing content-bearing or identifying, no prompts, completions, messages,
1737
+ * or thread, run and user identifiers.
1738
+ */
1739
+ type TokenUsage = {
1740
+ /**
1741
+ * Which provider served the request.
1742
+ */
1743
+ provider?: string;
1744
+ /**
1745
+ * Which model served the request.
1746
+ */
1747
+ model?: string;
1748
+ /**
1749
+ * Every prompt token the call was charged for: tokens read from a provider
1750
+ * cache, tokens written to one, and audio or other non-text input all count
1751
+ * here. cachedInputTokens and cacheWriteInputTokens break this number down
1752
+ * and are never added to it — a provider that reports its cache counts
1753
+ * beside a smaller input count has them added in by the producer before the
1754
+ * entry leaves. Bounded like timestamp and for the same reason: a count
1755
+ * above the JSON safe-integer range does not survive a round trip, so a
1756
+ * consumer would silently read a different number than the producer wrote.
1757
+ */
1758
+ inputTokens?: number;
1759
+ /**
1760
+ * Every generated token, reasoning included where the provider distinguishes
1761
+ * it. reasoningTokens breaks this number down and is never added to it — a
1762
+ * provider that reports reasoning tokens beside a smaller completion count
1763
+ * has them added in by the producer.
1764
+ */
1765
+ outputTokens?: number;
1766
+ /**
1767
+ * inputTokens plus outputTokens, under the accounting above. A producer MAY
1768
+ * compute it rather than copy a provider's total, and copies a provider's
1769
+ * total only when that total counts the same way, so a consumer can read
1770
+ * this field as the sum of the other two.
1771
+ */
1772
+ totalTokens?: number;
1773
+ /**
1774
+ * Output tokens spent on reasoning, where the provider distinguishes them.
1775
+ * Part of outputTokens, not in addition to it.
1776
+ */
1777
+ reasoningTokens?: number;
1778
+ /**
1779
+ * Input tokens read from a provider cache. Part of inputTokens, not in
1780
+ * addition to it, and disjoint from cacheWriteInputTokens.
1781
+ */
1782
+ cachedInputTokens?: number;
1783
+ /**
1784
+ * Input tokens written to a provider cache on this call, where the provider
1785
+ * distinguishes them. Part of inputTokens, not in addition to it, and
1786
+ * disjoint from cachedInputTokens. Its own field because providers price a
1787
+ * cache write differently from a cache read, so a consumer computing cost
1788
+ * cannot do without it.
1789
+ */
1790
+ cacheWriteInputTokens?: number;
1791
+ };
1792
+ /**
1793
+ * Closes a run that did not fail. Run-scoped, so it carries no subagent
1794
+ * attribution.
1795
+ */
1796
+ type RunFinishedEvent = {
1797
+ /**
1798
+ * Which event this is. Each event definition narrows this to a single value.
1799
+ */
1800
+ type: EventType.RUN_FINISHED;
1801
+ /**
1802
+ * When the event was created. Bounded to the range JSON numbers survive a
1803
+ * round trip in, so the value a consumer reads is the value the producer
1804
+ * wrote. Deliberately not a float. The unit is not constrained here, because
1805
+ * it never has been stated normatively; every SDK that sets it in practice
1806
+ * uses milliseconds since the Unix epoch, and a producer choosing another
1807
+ * unit will be misread by consumers even though it validates. Nothing in the
1808
+ * protocol computes with this value.
1809
+ */
1810
+ timestamp?: number;
1811
+ /**
1812
+ * The provider-native event this one was translated from, carried verbatim
1813
+ * for debugging and for consumers that need detail the protocol does not
1814
+ * model. Any JSON value.
1815
+ */
1816
+ rawEvent?: any;
1817
+ /**
1818
+ * Extra information attached to this event.
1819
+ */
1820
+ metadata?: Metadata;
1821
+ /**
1822
+ * The conversation this run belongs to.
1823
+ */
1824
+ threadId: string;
1825
+ /**
1826
+ * The run being closed.
1827
+ */
1828
+ runId: string;
1829
+ /**
1830
+ * The run's return value, if it has one. Any JSON value.
1831
+ */
1832
+ result?: any;
1833
+ /**
1834
+ * Why the run ended. Absent means success, so every producer written before
1835
+ * outcomes existed is already conformant.
1836
+ */
1837
+ outcome?: RunFinishedOutcome;
1838
+ /**
1839
+ * Token usage for the run, one entry per provider and model, so a run that
1840
+ * invoked several models keeps them separate. A consumer that only wants
1841
+ * totals sums across the entries. The run is the accounting boundary: usage
1842
+ * covers every model call made within the run, calls made by its subagents
1843
+ * included; an agent invoked as a separate run under parentRunId reports its
1844
+ * own usage on its own terminal event; and a run that resumes an interrupted
1845
+ * one reports only the calls it made itself, not the interrupted run's.
1846
+ */
1847
+ usage?: TokenUsage[];
1848
+ };
1849
+ /**
1850
+ * Ends a run that failed. Run-scoped, so it carries no subagent attribution; a
1851
+ * subagent that fails without ending the run reports SUBAGENT_ERROR instead.
1852
+ */
1853
+ type RunErrorEvent = {
1854
+ /**
1855
+ * Which event this is. Each event definition narrows this to a single value.
1856
+ */
1857
+ type: EventType.RUN_ERROR;
1858
+ /**
1859
+ * When the event was created. Bounded to the range JSON numbers survive a
1860
+ * round trip in, so the value a consumer reads is the value the producer
1861
+ * wrote. Deliberately not a float. The unit is not constrained here, because
1862
+ * it never has been stated normatively; every SDK that sets it in practice
1863
+ * uses milliseconds since the Unix epoch, and a producer choosing another
1864
+ * unit will be misread by consumers even though it validates. Nothing in the
1865
+ * protocol computes with this value.
1866
+ */
1867
+ timestamp?: number;
1868
+ /**
1869
+ * The provider-native event this one was translated from, carried verbatim
1870
+ * for debugging and for consumers that need detail the protocol does not
1871
+ * model. Any JSON value.
1872
+ */
1873
+ rawEvent?: any;
1874
+ /**
1875
+ * Extra information attached to this event.
1876
+ */
1877
+ metadata?: Metadata;
1878
+ /**
1879
+ * What went wrong, for a person to read.
1880
+ */
1881
+ message: string;
1882
+ /**
1883
+ * A machine-readable error code. An open string: the protocol defines no
1884
+ * vocabulary.
1885
+ */
1886
+ code?: string;
1887
+ /**
1888
+ * Token usage accrued before the failure, for a run that completed one or
1889
+ * more model calls before dying. Scoped as on RUN_FINISHED: the run's own
1890
+ * calls, subagents included.
1891
+ */
1892
+ usage?: TokenUsage[];
1893
+ };
1894
+ /**
1895
+ * Opens a named step within a run, for producers whose frameworks have a step
1896
+ * concept worth surfacing.
1897
+ */
1898
+ type StepStartedEvent = {
1899
+ /**
1900
+ * Which event this is. Each event definition narrows this to a single value.
1901
+ */
1902
+ type: EventType.STEP_STARTED;
1903
+ /**
1904
+ * When the event was created. Bounded to the range JSON numbers survive a
1905
+ * round trip in, so the value a consumer reads is the value the producer
1906
+ * wrote. Deliberately not a float. The unit is not constrained here, because
1907
+ * it never has been stated normatively; every SDK that sets it in practice
1908
+ * uses milliseconds since the Unix epoch, and a producer choosing another
1909
+ * unit will be misread by consumers even though it validates. Nothing in the
1910
+ * protocol computes with this value.
1911
+ */
1912
+ timestamp?: number;
1913
+ /**
1914
+ * The provider-native event this one was translated from, carried verbatim
1915
+ * for debugging and for consumers that need detail the protocol does not
1916
+ * model. Any JSON value.
1917
+ */
1918
+ rawEvent?: any;
1919
+ /**
1920
+ * Extra information attached to this event.
1921
+ */
1922
+ metadata?: Metadata;
1923
+ /**
1924
+ * The subagent invocation this belongs to. Absent means the parent agent
1925
+ * produced it directly.
1926
+ */
1927
+ subagentRunId?: SubagentRunId;
1928
+ /**
1929
+ * The step's name. Identifies it: the matching STEP_FINISHED carries the
1930
+ * same name.
1931
+ */
1932
+ stepName: string;
1933
+ };
1934
+ /**
1935
+ * Closes a named step.
1936
+ */
1937
+ type StepFinishedEvent = {
1938
+ /**
1939
+ * Which event this is. Each event definition narrows this to a single value.
1940
+ */
1941
+ type: EventType.STEP_FINISHED;
1942
+ /**
1943
+ * When the event was created. Bounded to the range JSON numbers survive a
1944
+ * round trip in, so the value a consumer reads is the value the producer
1945
+ * wrote. Deliberately not a float. The unit is not constrained here, because
1946
+ * it never has been stated normatively; every SDK that sets it in practice
1947
+ * uses milliseconds since the Unix epoch, and a producer choosing another
1948
+ * unit will be misread by consumers even though it validates. Nothing in the
1949
+ * protocol computes with this value.
1950
+ */
1951
+ timestamp?: number;
1952
+ /**
1953
+ * The provider-native event this one was translated from, carried verbatim
1954
+ * for debugging and for consumers that need detail the protocol does not
1955
+ * model. Any JSON value.
1956
+ */
1957
+ rawEvent?: any;
1958
+ /**
1959
+ * Extra information attached to this event.
1960
+ */
1961
+ metadata?: Metadata;
1962
+ /**
1963
+ * The subagent invocation this belongs to. Absent means the parent agent
1964
+ * produced it directly.
1965
+ */
1966
+ subagentRunId?: SubagentRunId;
1967
+ /**
1968
+ * The step being closed.
1969
+ */
1970
+ stepName: string;
1971
+ };
1972
+ /**
1973
+ * Opens a span of reasoning. A span may contain several reasoning messages.
1974
+ */
1975
+ type ReasoningStartEvent = {
1976
+ /**
1977
+ * Which event this is. Each event definition narrows this to a single value.
1978
+ */
1979
+ type: EventType.REASONING_START;
1980
+ /**
1981
+ * When the event was created. Bounded to the range JSON numbers survive a
1982
+ * round trip in, so the value a consumer reads is the value the producer
1983
+ * wrote. Deliberately not a float. The unit is not constrained here, because
1984
+ * it never has been stated normatively; every SDK that sets it in practice
1985
+ * uses milliseconds since the Unix epoch, and a producer choosing another
1986
+ * unit will be misread by consumers even though it validates. Nothing in the
1987
+ * protocol computes with this value.
1988
+ */
1989
+ timestamp?: number;
1990
+ /**
1991
+ * The provider-native event this one was translated from, carried verbatim
1992
+ * for debugging and for consumers that need detail the protocol does not
1993
+ * model. Any JSON value.
1994
+ */
1995
+ rawEvent?: any;
1996
+ /**
1997
+ * Extra information attached to this event.
1998
+ */
1999
+ metadata?: Metadata;
2000
+ /**
2001
+ * The subagent invocation this belongs to. Absent means the parent agent
2002
+ * produced it directly.
2003
+ */
2004
+ subagentRunId?: SubagentRunId;
2005
+ /**
2006
+ * The span being opened.
2007
+ */
2008
+ messageId: string;
2009
+ };
2010
+ /**
2011
+ * Opens a streamed reasoning message.
2012
+ */
2013
+ type ReasoningMessageStartEvent = {
2014
+ /**
2015
+ * Which event this is. Each event definition narrows this to a single value.
2016
+ */
2017
+ type: EventType.REASONING_MESSAGE_START;
2018
+ /**
2019
+ * When the event was created. Bounded to the range JSON numbers survive a
2020
+ * round trip in, so the value a consumer reads is the value the producer
2021
+ * wrote. Deliberately not a float. The unit is not constrained here, because
2022
+ * it never has been stated normatively; every SDK that sets it in practice
2023
+ * uses milliseconds since the Unix epoch, and a producer choosing another
2024
+ * unit will be misread by consumers even though it validates. Nothing in the
2025
+ * protocol computes with this value.
2026
+ */
2027
+ timestamp?: number;
2028
+ /**
2029
+ * The provider-native event this one was translated from, carried verbatim
2030
+ * for debugging and for consumers that need detail the protocol does not
2031
+ * model. Any JSON value.
2032
+ */
2033
+ rawEvent?: any;
2034
+ /**
2035
+ * Extra information attached to this event.
2036
+ */
2037
+ metadata?: Metadata;
2038
+ /**
2039
+ * The subagent invocation this belongs to. Absent means the parent agent
2040
+ * produced it directly.
2041
+ */
2042
+ subagentRunId?: SubagentRunId;
2043
+ /**
2044
+ * The reasoning message this stream builds.
2045
+ */
2046
+ messageId: string;
2047
+ /**
2048
+ * Fixed, and required rather than defaulted. The requirement is inherited
2049
+ * from the SDKs rather than chosen.
2050
+ */
2051
+ role: "reasoning";
2052
+ };
2053
+ /**
2054
+ * Appends a fragment to a streamed reasoning message.
2055
+ */
2056
+ type ReasoningMessageContentEvent = {
2057
+ /**
2058
+ * Which event this is. Each event definition narrows this to a single value.
2059
+ */
2060
+ type: EventType.REASONING_MESSAGE_CONTENT;
2061
+ /**
2062
+ * When the event was created. Bounded to the range JSON numbers survive a
2063
+ * round trip in, so the value a consumer reads is the value the producer
2064
+ * wrote. Deliberately not a float. The unit is not constrained here, because
2065
+ * it never has been stated normatively; every SDK that sets it in practice
2066
+ * uses milliseconds since the Unix epoch, and a producer choosing another
2067
+ * unit will be misread by consumers even though it validates. Nothing in the
2068
+ * protocol computes with this value.
2069
+ */
2070
+ timestamp?: number;
2071
+ /**
2072
+ * The provider-native event this one was translated from, carried verbatim
2073
+ * for debugging and for consumers that need detail the protocol does not
2074
+ * model. Any JSON value.
2075
+ */
2076
+ rawEvent?: any;
2077
+ /**
2078
+ * Extra information attached to this event.
2079
+ */
2080
+ metadata?: Metadata;
2081
+ /**
2082
+ * The subagent invocation this belongs to. Absent means the parent agent
2083
+ * produced it directly.
2084
+ */
2085
+ subagentRunId?: SubagentRunId;
2086
+ /**
2087
+ * The reasoning message this fragment belongs to.
2088
+ */
2089
+ messageId: string;
2090
+ /**
2091
+ * The fragment to append. May be the empty string.
2092
+ */
2093
+ delta: string;
2094
+ };
2095
+ /**
2096
+ * Closes a streamed reasoning message.
2097
+ */
2098
+ type ReasoningMessageEndEvent = {
2099
+ /**
2100
+ * Which event this is. Each event definition narrows this to a single value.
2101
+ */
2102
+ type: EventType.REASONING_MESSAGE_END;
2103
+ /**
2104
+ * When the event was created. Bounded to the range JSON numbers survive a
2105
+ * round trip in, so the value a consumer reads is the value the producer
2106
+ * wrote. Deliberately not a float. The unit is not constrained here, because
2107
+ * it never has been stated normatively; every SDK that sets it in practice
2108
+ * uses milliseconds since the Unix epoch, and a producer choosing another
2109
+ * unit will be misread by consumers even though it validates. Nothing in the
2110
+ * protocol computes with this value.
2111
+ */
2112
+ timestamp?: number;
2113
+ /**
2114
+ * The provider-native event this one was translated from, carried verbatim
2115
+ * for debugging and for consumers that need detail the protocol does not
2116
+ * model. Any JSON value.
2117
+ */
2118
+ rawEvent?: any;
2119
+ /**
2120
+ * Extra information attached to this event.
2121
+ */
2122
+ metadata?: Metadata;
2123
+ /**
2124
+ * The subagent invocation this belongs to. Absent means the parent agent
2125
+ * produced it directly.
2126
+ */
2127
+ subagentRunId?: SubagentRunId;
2128
+ /**
2129
+ * The reasoning message being closed.
2130
+ */
2131
+ messageId: string;
2132
+ };
2133
+ /**
2134
+ * A shorthand that stands in for a reasoning message's start, content and end
2135
+ * sequence.
2136
+ */
2137
+ type ReasoningMessageChunkEvent = {
2138
+ /**
2139
+ * Which event this is. Each event definition narrows this to a single value.
2140
+ */
2141
+ type: EventType.REASONING_MESSAGE_CHUNK;
2142
+ /**
2143
+ * When the event was created. Bounded to the range JSON numbers survive a
2144
+ * round trip in, so the value a consumer reads is the value the producer
2145
+ * wrote. Deliberately not a float. The unit is not constrained here, because
2146
+ * it never has been stated normatively; every SDK that sets it in practice
2147
+ * uses milliseconds since the Unix epoch, and a producer choosing another
2148
+ * unit will be misread by consumers even though it validates. Nothing in the
2149
+ * protocol computes with this value.
2150
+ */
2151
+ timestamp?: number;
2152
+ /**
2153
+ * The provider-native event this one was translated from, carried verbatim
2154
+ * for debugging and for consumers that need detail the protocol does not
2155
+ * model. Any JSON value.
2156
+ */
2157
+ rawEvent?: any;
2158
+ /**
2159
+ * Extra information attached to this event.
2160
+ */
2161
+ metadata?: Metadata;
2162
+ /**
2163
+ * The subagent invocation this belongs to. Absent means the parent agent
2164
+ * produced it directly.
2165
+ */
2166
+ subagentRunId?: SubagentRunId;
2167
+ /**
2168
+ * The reasoning message this chunk belongs to. Absent continues the one
2169
+ * already open.
2170
+ */
2171
+ messageId?: string;
2172
+ /**
2173
+ * The fragment to append. May be the empty string.
2174
+ */
2175
+ delta?: string;
2176
+ };
2177
+ /**
2178
+ * Closes a span of reasoning.
2179
+ */
2180
+ type ReasoningEndEvent = {
2181
+ /**
2182
+ * Which event this is. Each event definition narrows this to a single value.
2183
+ */
2184
+ type: EventType.REASONING_END;
2185
+ /**
2186
+ * When the event was created. Bounded to the range JSON numbers survive a
2187
+ * round trip in, so the value a consumer reads is the value the producer
2188
+ * wrote. Deliberately not a float. The unit is not constrained here, because
2189
+ * it never has been stated normatively; every SDK that sets it in practice
2190
+ * uses milliseconds since the Unix epoch, and a producer choosing another
2191
+ * unit will be misread by consumers even though it validates. Nothing in the
2192
+ * protocol computes with this value.
2193
+ */
2194
+ timestamp?: number;
2195
+ /**
2196
+ * The provider-native event this one was translated from, carried verbatim
2197
+ * for debugging and for consumers that need detail the protocol does not
2198
+ * model. Any JSON value.
2199
+ */
2200
+ rawEvent?: any;
2201
+ /**
2202
+ * Extra information attached to this event.
2203
+ */
2204
+ metadata?: Metadata;
2205
+ /**
2206
+ * The subagent invocation this belongs to. Absent means the parent agent
2207
+ * produced it directly.
2208
+ */
2209
+ subagentRunId?: SubagentRunId;
2210
+ /**
2211
+ * The span being closed.
2212
+ */
2213
+ messageId: string;
2214
+ };
2215
+ /**
2216
+ * Whether a REASONING_ENCRYPTED_VALUE belongs to a message or to a tool call.
2217
+ */
2218
+ type ReasoningEncryptedValueSubtype = "tool-call" | "message";
2219
+ /**
2220
+ * Carries a provider's opaque, encrypted reasoning artefact, which a consumer
2221
+ * stores and returns on a later turn without being able to read it.
2222
+ */
2223
+ type ReasoningEncryptedValueEvent = {
2224
+ /**
2225
+ * Which event this is. Each event definition narrows this to a single value.
2226
+ */
2227
+ type: EventType.REASONING_ENCRYPTED_VALUE;
2228
+ /**
2229
+ * When the event was created. Bounded to the range JSON numbers survive a
2230
+ * round trip in, so the value a consumer reads is the value the producer
2231
+ * wrote. Deliberately not a float. The unit is not constrained here, because
2232
+ * it never has been stated normatively; every SDK that sets it in practice
2233
+ * uses milliseconds since the Unix epoch, and a producer choosing another
2234
+ * unit will be misread by consumers even though it validates. Nothing in the
2235
+ * protocol computes with this value.
2236
+ */
2237
+ timestamp?: number;
2238
+ /**
2239
+ * The provider-native event this one was translated from, carried verbatim
2240
+ * for debugging and for consumers that need detail the protocol does not
2241
+ * model. Any JSON value.
2242
+ */
2243
+ rawEvent?: any;
2244
+ /**
2245
+ * Extra information attached to this event.
2246
+ */
2247
+ metadata?: Metadata;
2248
+ /**
2249
+ * The subagent invocation this belongs to. Absent means the parent agent
2250
+ * produced it directly.
2251
+ */
2252
+ subagentRunId?: SubagentRunId;
2253
+ /**
2254
+ * What kind of thing entityId names, which decides where the value is
2255
+ * stored.
2256
+ */
2257
+ subtype: ReasoningEncryptedValueSubtype;
2258
+ /**
2259
+ * What the value belongs to: a message id or a tool call id, according to
2260
+ * subtype.
2261
+ */
2262
+ entityId: string;
2263
+ /**
2264
+ * The provider's opaque artefact.
2265
+ */
2266
+ encryptedValue: string;
2267
+ };
2268
+ /**
2269
+ * Announces that a subagent invocation has begun. Everything the subagent
2270
+ * produces afterwards is attributed by carrying its subagentRunId, so a
2271
+ * consumer can group the work without replaying the stream. Composed from
2272
+ * BaseEvent alone rather than Attributable, because here subagentRunId
2273
+ * identifies the subagent rather than attributing the event to one;
2274
+ * attribution to an enclosing subagent is parentSubagentRunId.
2275
+ */
2276
+ type SubagentStartedEvent = {
2277
+ /**
2278
+ * Which event this is. Each event definition narrows this to a single value.
2279
+ */
2280
+ type: EventType.SUBAGENT_STARTED;
2281
+ /**
2282
+ * When the event was created. Bounded to the range JSON numbers survive a
2283
+ * round trip in, so the value a consumer reads is the value the producer
2284
+ * wrote. Deliberately not a float. The unit is not constrained here, because
2285
+ * it never has been stated normatively; every SDK that sets it in practice
2286
+ * uses milliseconds since the Unix epoch, and a producer choosing another
2287
+ * unit will be misread by consumers even though it validates. Nothing in the
2288
+ * protocol computes with this value.
2289
+ */
2290
+ timestamp?: number;
2291
+ /**
2292
+ * The provider-native event this one was translated from, carried verbatim
2293
+ * for debugging and for consumers that need detail the protocol does not
2294
+ * model. Any JSON value.
2295
+ */
2296
+ rawEvent?: any;
2297
+ /**
2298
+ * Extra information attached to this event.
2299
+ */
2300
+ metadata?: Metadata;
2301
+ /**
2302
+ * The invocation being announced.
2303
+ */
2304
+ subagentRunId: SubagentRunId;
2305
+ /**
2306
+ * The subagent's name, which is reusable across invocations, unlike
2307
+ * subagentRunId.
2308
+ */
2309
+ name: string;
2310
+ /**
2311
+ * What this subagent is for, for a consumer to display.
2312
+ */
2313
+ description?: string;
2314
+ /**
2315
+ * The subagent invocation that spawned this one, for nested delegation.
2316
+ * Absent means the parent agent spawned it directly.
2317
+ */
2318
+ parentSubagentRunId?: SubagentRunId;
2319
+ /**
2320
+ * The tool call that spawned this subagent, for the pattern where agents are
2321
+ * exposed to a model as tools. Lets a consumer tie the subagent to the call
2322
+ * without reading rawEvent.
2323
+ */
2324
+ parentToolCallId?: string;
2325
+ /**
2326
+ * The message that held the spawning tool call.
2327
+ */
2328
+ parentMessageId?: string;
2329
+ };
2330
+ /**
2331
+ * The subagent completed its work. Equivalent to an absent outcome.
2332
+ */
2333
+ type SubagentFinishedSuccessOutcome = {
2334
+ /**
2335
+ * Discriminator.
2336
+ */
2337
+ type: "success";
2338
+ };
2339
+ /**
2340
+ * The subagent is paused awaiting outside input. Terminal for this stream, not
2341
+ * for the subagent: a later run may continue the same invocation once the
2342
+ * interrupts are answered.
2343
+ */
2344
+ type SubagentFinishedSuspendedOutcome = {
2345
+ /**
2346
+ * Discriminator.
2347
+ */
2348
+ type: "suspended";
2349
+ /**
2350
+ * The run-level interrupts this subagent raised itself. May be empty or
2351
+ * absent: a subagent suspended because a descendant interrupted owns no
2352
+ * interrupt of its own. Each item: An Interrupt.id.
2353
+ */
2354
+ interruptIds?: string[];
2355
+ };
2356
+ /**
2357
+ * Why a subagent's segment of a run ended. Mirrors RunFinishedOutcome one
2358
+ * level down.
2359
+ */
2360
+ type SubagentFinishedOutcome = SubagentFinishedSuccessOutcome | SubagentFinishedSuspendedOutcome;
2361
+ /**
2362
+ * Ends a subagent invocation's segment of this run, either because the work
2363
+ * completed or because it is suspended awaiting outside input.
2364
+ */
2365
+ type SubagentFinishedEvent = {
2366
+ /**
2367
+ * Which event this is. Each event definition narrows this to a single value.
2368
+ */
2369
+ type: EventType.SUBAGENT_FINISHED;
2370
+ /**
2371
+ * When the event was created. Bounded to the range JSON numbers survive a
2372
+ * round trip in, so the value a consumer reads is the value the producer
2373
+ * wrote. Deliberately not a float. The unit is not constrained here, because
2374
+ * it never has been stated normatively; every SDK that sets it in practice
2375
+ * uses milliseconds since the Unix epoch, and a producer choosing another
2376
+ * unit will be misread by consumers even though it validates. Nothing in the
2377
+ * protocol computes with this value.
2378
+ */
2379
+ timestamp?: number;
2380
+ /**
2381
+ * The provider-native event this one was translated from, carried verbatim
2382
+ * for debugging and for consumers that need detail the protocol does not
2383
+ * model. Any JSON value.
2384
+ */
2385
+ rawEvent?: any;
2386
+ /**
2387
+ * Extra information attached to this event.
2388
+ */
2389
+ metadata?: Metadata;
2390
+ /**
2391
+ * The invocation being closed.
2392
+ */
2393
+ subagentRunId: SubagentRunId;
2394
+ /**
2395
+ * The subagent's return value, if it has one. Any JSON value, mirroring
2396
+ * RUN_FINISHED.result.
2397
+ */
2398
+ result?: any;
2399
+ /**
2400
+ * Why the segment ended. Absent means success. A suspended subagent is
2401
+ * neither a success nor a failure, which is why saying so needs its own
2402
+ * value rather than being inferred from a later interrupt.
2403
+ */
2404
+ outcome?: SubagentFinishedOutcome;
2405
+ };
2406
+ /**
2407
+ * Reports that a subagent invocation failed. The run may continue: a parent
2408
+ * agent is free to handle a failed subagent, which is why this is not
2409
+ * RUN_ERROR.
2410
+ */
2411
+ type SubagentErrorEvent = {
2412
+ /**
2413
+ * Which event this is. Each event definition narrows this to a single value.
2414
+ */
2415
+ type: EventType.SUBAGENT_ERROR;
2416
+ /**
2417
+ * When the event was created. Bounded to the range JSON numbers survive a
2418
+ * round trip in, so the value a consumer reads is the value the producer
2419
+ * wrote. Deliberately not a float. The unit is not constrained here, because
2420
+ * it never has been stated normatively; every SDK that sets it in practice
2421
+ * uses milliseconds since the Unix epoch, and a producer choosing another
2422
+ * unit will be misread by consumers even though it validates. Nothing in the
2423
+ * protocol computes with this value.
2424
+ */
2425
+ timestamp?: number;
2426
+ /**
2427
+ * The provider-native event this one was translated from, carried verbatim
2428
+ * for debugging and for consumers that need detail the protocol does not
2429
+ * model. Any JSON value.
2430
+ */
2431
+ rawEvent?: any;
2432
+ /**
2433
+ * Extra information attached to this event.
2434
+ */
2435
+ metadata?: Metadata;
2436
+ /**
2437
+ * The invocation that failed.
2438
+ */
2439
+ subagentRunId: SubagentRunId;
2440
+ /**
2441
+ * What went wrong, for a person to read.
2442
+ */
2443
+ message: string;
2444
+ /**
2445
+ * A machine-readable error code. An open string.
2446
+ */
2447
+ code?: string;
2448
+ };
2449
+ /**
2450
+ * Any AG-UI event. Every member is normative: there is no optional tier and no
2451
+ * event a consumer may decline to implement. Discriminated by the type
2452
+ * property.
2453
+ */
2454
+ type Event = TextMessageStartEvent | TextMessageContentEvent | TextMessageEndEvent | TextMessageChunkEvent | ToolCallStartEvent | ToolCallArgsEvent | ToolCallEndEvent | ToolCallChunkEvent | ToolCallResultEvent | StateSnapshotEvent | StateDeltaEvent | MessagesSnapshotEvent | ActivitySnapshotEvent | ActivityDeltaEvent | RawEvent | CustomEvent | RunStartedEvent | RunFinishedEvent | RunErrorEvent | StepStartedEvent | StepFinishedEvent | ReasoningStartEvent | ReasoningMessageStartEvent | ReasoningMessageContentEvent | ReasoningMessageEndEvent | ReasoningMessageChunkEvent | ReasoningEndEvent | ReasoningEncryptedValueEvent | SubagentStartedEvent | SubagentFinishedEvent | SubagentErrorEvent;
2455
+ /**
2456
+ * Every role a materialised message may have.
2457
+ */
2458
+ type Role = "developer" | "system" | "assistant" | "user" | "tool" | "activity" | "reasoning";
2459
+ /**
2460
+ * Describes a subagent that can be invoked by a parent agent.
2461
+ */
2462
+ type SubagentInfo = {
2463
+ /**
2464
+ * Unique name or identifier of the subagent.
2465
+ */
2466
+ name: string;
2467
+ /**
2468
+ * What this subagent specializes in. Helps clients build agent selection
2469
+ * UIs.
2470
+ */
2471
+ description?: string;
2472
+ };
2473
+ /**
2474
+ * Basic metadata about the agent. Useful for discovery UIs, agent
2475
+ * marketplaces, and debugging. Set these when you want clients to display
2476
+ * agent information or when multiple agents are available and users need to
2477
+ * pick one.
2478
+ */
2479
+ type IdentityCapabilities = {
2480
+ /**
2481
+ * Human-readable name shown in UIs and agent selectors.
2482
+ */
2483
+ name?: string;
2484
+ /**
2485
+ * The framework or platform powering this agent (e.g., "langgraph",
2486
+ * "mastra", "crewai").
2487
+ */
2488
+ type?: string;
2489
+ /**
2490
+ * What this agent does — helps users and routing logic decide when to use
2491
+ * it.
2492
+ */
2493
+ description?: string;
2494
+ /**
2495
+ * Semantic version of the agent (e.g., "1.2.0"). Useful for compatibility
2496
+ * checks.
2497
+ */
2498
+ version?: string;
2499
+ /**
2500
+ * Organization or team that maintains this agent.
2501
+ */
2502
+ provider?: string;
2503
+ /**
2504
+ * URL to the agent's documentation or homepage.
2505
+ */
2506
+ documentationUrl?: string;
2507
+ /**
2508
+ * Arbitrary key-value pairs for integration-specific identity info.
2509
+ */
2510
+ metadata?: Metadata;
2511
+ };
2512
+ /**
2513
+ * Declares which transport mechanisms the agent supports. Clients use this to
2514
+ * pick the best connection strategy. Only set flags to true for transports
2515
+ * your agent actually handles — omit or set false for unsupported ones.
2516
+ */
2517
+ type TransportCapabilities = {
2518
+ /**
2519
+ * Set true if the agent streams responses via SSE. Most agents enable this.
2520
+ */
2521
+ streaming?: boolean;
2522
+ /**
2523
+ * Set true if the agent accepts persistent WebSocket connections.
2524
+ */
2525
+ websocket?: boolean;
2526
+ /**
2527
+ * Set true if the agent supports the AG-UI binary protocol (protobuf over
2528
+ * HTTP).
2529
+ */
2530
+ httpBinary?: boolean;
2531
+ /**
2532
+ * Set true if the agent can send async updates via webhooks after a run
2533
+ * finishes.
2534
+ */
2535
+ pushNotifications?: boolean;
2536
+ /**
2537
+ * Set true if the agent supports resuming interrupted streams via sequence
2538
+ * numbers.
2539
+ */
2540
+ resumable?: boolean;
2541
+ };
2542
+ /**
2543
+ * Tool calling capabilities. Distinguishes between tools the agent itself
2544
+ * provides (listed in items) and tools the client passes at runtime via
2545
+ * RunAgentInput.tools. Enable this when your agent can call functions, search
2546
+ * the web, execute code, etc.
2547
+ */
2548
+ type ToolsCapabilities = {
2549
+ /**
2550
+ * Set true if the agent can make tool calls at all. Set false to explicitly
2551
+ * signal tool calling is disabled even if items are present.
2552
+ */
2553
+ supported?: boolean;
2554
+ /**
2555
+ * The tools this agent provides on its own (full JSON Schema definitions).
2556
+ * These are distinct from client-provided tools passed in
2557
+ * RunAgentInput.tools.
2558
+ */
2559
+ items?: Tool[];
2560
+ /**
2561
+ * Set true if the agent can invoke multiple tools concurrently within a
2562
+ * single step.
2563
+ */
2564
+ parallelCalls?: boolean;
2565
+ /**
2566
+ * Set true if the agent accepts and uses tools provided by the client at
2567
+ * runtime.
2568
+ */
2569
+ clientProvided?: boolean;
2570
+ };
2571
+ /**
2572
+ * Output format support. Enable structuredOutput when your agent can return
2573
+ * responses conforming to a JSON schema, which is useful for programmatic
2574
+ * consumption.
2575
+ */
2576
+ type OutputCapabilities = {
2577
+ /**
2578
+ * Set true if the agent can produce structured JSON output matching a
2579
+ * provided schema.
2580
+ */
2581
+ structuredOutput?: boolean;
2582
+ /**
2583
+ * MIME types the agent can produce (e.g., ["text/plain",
2584
+ * "application/json"]). Omit if the agent only produces plain text.
2585
+ */
2586
+ supportedMimeTypes?: string[];
2587
+ };
2588
+ /**
2589
+ * State and memory management capabilities. These tell the client how the
2590
+ * agent handles shared state and whether conversation context persists across
2591
+ * runs.
2592
+ */
2593
+ type StateCapabilities = {
2594
+ /**
2595
+ * Set true if the agent emits STATE_SNAPSHOT events (full state
2596
+ * replacement).
2597
+ */
2598
+ snapshots?: boolean;
2599
+ /**
2600
+ * Set true if the agent emits STATE_DELTA events (JSON Patch incremental
2601
+ * updates).
2602
+ */
2603
+ deltas?: boolean;
2604
+ /**
2605
+ * Set true if the agent has long-term memory beyond the current thread
2606
+ * (e.g., vector store, knowledge base, or cross-session recall).
2607
+ */
2608
+ memory?: boolean;
2609
+ /**
2610
+ * Set true if state is preserved across multiple runs within the same
2611
+ * thread. When false, state resets on each run.
2612
+ */
2613
+ persistentState?: boolean;
2614
+ };
2615
+ /**
2616
+ * Multi-agent coordination capabilities. Enable these when your agent can
2617
+ * orchestrate or hand off work to other agents.
2618
+ */
2619
+ type MultiAgentCapabilities = {
2620
+ /**
2621
+ * Set true if the agent participates in any form of multi-agent
2622
+ * coordination.
2623
+ */
2624
+ supported?: boolean;
2625
+ /**
2626
+ * Set true if the agent can delegate subtasks to other agents while
2627
+ * retaining control.
2628
+ */
2629
+ delegation?: boolean;
2630
+ /**
2631
+ * Set true if the agent can transfer the conversation entirely to another
2632
+ * agent.
2633
+ */
2634
+ handoffs?: boolean;
2635
+ /**
2636
+ * List of subagents this agent can invoke. Helps clients build agent
2637
+ * selection UIs.
2638
+ */
2639
+ subagents?: SubagentInfo[];
2640
+ };
2641
+ /**
2642
+ * Reasoning and thinking capabilities. Enable these when your agent exposes
2643
+ * its internal thought process (e.g., chain-of-thought, extended thinking).
2644
+ */
2645
+ type ReasoningCapabilities = {
2646
+ /**
2647
+ * Set true if the agent produces reasoning/thinking tokens visible to the
2648
+ * client.
2649
+ */
2650
+ supported?: boolean;
2651
+ /**
2652
+ * Set true if reasoning tokens are streamed incrementally (vs. returned all
2653
+ * at once).
2654
+ */
2655
+ streaming?: boolean;
2656
+ /**
2657
+ * Set true if reasoning content is encrypted (zero-data-retention mode).
2658
+ * Clients should expect opaque encryptedValue fields instead of readable
2659
+ * content.
2660
+ */
2661
+ encrypted?: boolean;
2662
+ };
2663
+ /**
2664
+ * Modalities the agent can accept as input. Clients use this to show or hide
2665
+ * file upload buttons, audio recorders, image pickers, etc.
2666
+ */
2667
+ type MultimodalInputCapabilities = {
2668
+ /**
2669
+ * Set true if the agent can process image inputs (e.g., screenshots,
2670
+ * photos).
2671
+ */
2672
+ image?: boolean;
2673
+ /**
2674
+ * Set true if the agent can process audio inputs (speech, recordings).
2675
+ */
2676
+ audio?: boolean;
2677
+ /**
2678
+ * Set true if the agent can process video inputs.
2679
+ */
2680
+ video?: boolean;
2681
+ /**
2682
+ * Set true if the agent can process PDF documents.
2683
+ */
2684
+ pdf?: boolean;
2685
+ /**
2686
+ * Set true if the agent can process arbitrary file uploads: files of a kind
2687
+ * the image, audio, video and document parts do not cover. Says nothing
2688
+ * about how a file arrives; a part's source (inline, URL or provider handle)
2689
+ * is a separate question.
2690
+ */
2691
+ file?: boolean;
2692
+ };
2693
+ /**
2694
+ * Modalities the agent can produce as output. Clients use this to anticipate
2695
+ * rich content in the agent's response.
2696
+ */
2697
+ type MultimodalOutputCapabilities = {
2698
+ /**
2699
+ * Set true if the agent can generate images as part of its response.
2700
+ */
2701
+ image?: boolean;
2702
+ /**
2703
+ * Set true if the agent can produce audio output (text-to-speech, audio
2704
+ * files).
2705
+ */
2706
+ audio?: boolean;
2707
+ };
2708
+ /**
2709
+ * Multimodal input and output support. Organized into input and output
2710
+ * sub-objects so clients can independently query what the agent accepts versus
2711
+ * what it produces.
2712
+ */
2713
+ type MultimodalCapabilities = {
2714
+ /**
2715
+ * Modalities the agent can accept as input (images, audio, video, PDFs,
2716
+ * files).
2717
+ */
2718
+ input?: MultimodalInputCapabilities;
2719
+ /**
2720
+ * Modalities the agent can produce as output (images, audio).
2721
+ */
2722
+ output?: MultimodalOutputCapabilities;
2723
+ };
2724
+ /**
2725
+ * Execution control and limits. Declare these so clients can set expectations
2726
+ * about how long or how many steps an agent run might take.
2727
+ */
2728
+ type ExecutionCapabilities = {
2729
+ /**
2730
+ * Set true if the agent can execute code (e.g., Python, JavaScript) during a
2731
+ * run.
2732
+ */
2733
+ codeExecution?: boolean;
2734
+ /**
2735
+ * Set true if code execution happens in a sandboxed or isolated environment.
2736
+ * Only meaningful when codeExecution is true.
2737
+ */
2738
+ sandboxed?: boolean;
2739
+ /**
2740
+ * Maximum number of tool-call/reasoning iterations the agent will perform
2741
+ * per run. Helps clients display progress or set timeout expectations.
2742
+ */
2743
+ maxIterations?: number;
2744
+ /**
2745
+ * Maximum wall-clock time (in milliseconds) the agent will run before timing
2746
+ * out.
2747
+ */
2748
+ maxExecutionTime?: number;
2749
+ };
2750
+ /**
2751
+ * Human-in-the-loop interaction support. Enable these when your agent can
2752
+ * pause execution to request human input, approval, or feedback before
2753
+ * continuing.
2754
+ */
2755
+ type HumanInTheLoopCapabilities = {
2756
+ /**
2757
+ * Set true if the agent supports any form of human-in-the-loop interaction.
2758
+ */
2759
+ supported?: boolean;
2760
+ /**
2761
+ * Set true if the agent can pause and request explicit approval before
2762
+ * performing sensitive actions (e.g., sending emails, deleting data).
2763
+ */
2764
+ approvals?: boolean;
2765
+ /**
2766
+ * Set true if the agent allows humans to intervene and modify its plan
2767
+ * mid-execution.
2768
+ */
2769
+ interventions?: boolean;
2770
+ /**
2771
+ * Set true if the agent can incorporate user feedback (thumbs up/down,
2772
+ * corrections) to improve its behavior within the current session.
2773
+ */
2774
+ feedback?: boolean;
2775
+ /**
2776
+ * Set true if the agent participates in the AG-UI interrupt protocol: it
2777
+ * ends a run with RUN_FINISHED carrying an interrupt outcome, and accepts
2778
+ * the answers back in RunAgentInput.resume.
2779
+ */
2780
+ interrupts?: boolean;
2781
+ /**
2782
+ * Set true if tool-call interrupts accept editedArgs in the resume payload.
2783
+ * Only meaningful when interrupts is true.
2784
+ */
2785
+ approveWithEdits?: boolean;
2786
+ };
2787
+ /**
2788
+ * A typed, categorized snapshot of an agent's current capabilities. All fields
2789
+ * are optional — agents only declare what they support. An omitted field means
2790
+ * the capability is not declared (unknown), not that it is unsupported. The
2791
+ * custom field is an escape hatch for integration-specific capabilities that
2792
+ * do not fit into the standard categories.
2793
+ */
2794
+ type AgentCapabilities = {
2795
+ /**
2796
+ * Agent identity and metadata.
2797
+ */
2798
+ identity?: IdentityCapabilities;
2799
+ /**
2800
+ * Supported transport mechanisms (SSE, WebSocket, binary, etc.).
2801
+ */
2802
+ transport?: TransportCapabilities;
2803
+ /**
2804
+ * Tools the agent provides and tool calling configuration.
2805
+ */
2806
+ tools?: ToolsCapabilities;
2807
+ /**
2808
+ * Output format support (structured output, MIME types).
2809
+ */
2810
+ output?: OutputCapabilities;
2811
+ /**
2812
+ * State and memory management (snapshots, deltas, persistence).
2813
+ */
2814
+ state?: StateCapabilities;
2815
+ /**
2816
+ * Multi-agent coordination (delegation, handoffs, subagents).
2817
+ */
2818
+ multiAgent?: MultiAgentCapabilities;
2819
+ /**
2820
+ * Reasoning and thinking support (chain-of-thought, encrypted thinking).
2821
+ */
2822
+ reasoning?: ReasoningCapabilities;
2823
+ /**
2824
+ * Multimodal input/output support (images, audio, video, files).
2825
+ */
2826
+ multimodal?: MultimodalCapabilities;
2827
+ /**
2828
+ * Execution control and limits (code execution, timeouts, iteration caps).
2829
+ */
2830
+ execution?: ExecutionCapabilities;
2831
+ /**
2832
+ * Human-in-the-loop support (approvals, interventions, feedback).
2833
+ */
2834
+ humanInTheLoop?: HumanInTheLoopCapabilities;
2835
+ /**
2836
+ * Integration-specific capabilities not covered by the standard categories.
2837
+ * Open by key: any JSON value is allowed under a key, because the categories
2838
+ * above cannot anticipate what an integration declares.
2839
+ */
2840
+ custom?: Record<string, any>;
2841
+ };
2842
+ /**
2843
+ * Composed into everything that can belong to a subagent's work: the events
2844
+ * that describe content or progress, the message types, and each interrupt.
2845
+ * Run-scoped events omit it — RUN_STARTED, RUN_FINISHED and RUN_ERROR describe
2846
+ * the run itself and MESSAGES_SNAPSHOT is conversation-wide, so none of them
2847
+ * can belong to one subagent. A tool call omits it too and inherits its
2848
+ * containing message's attribution.
2849
+ */
2850
+ type Attributable = {
2851
+ /**
2852
+ * The subagent invocation this belongs to. Absent means the parent agent
2853
+ * produced it directly.
2854
+ */
2855
+ subagentRunId?: SubagentRunId;
2856
+ };
2857
+ /**
2858
+ * The fields every event carries, whatever its type. Composed into each event
2859
+ * definition rather than repeated, so a change here reaches every event at
2860
+ * once.
2861
+ */
2862
+ type BaseEvent = {
2863
+ /**
2864
+ * Which event this is. Each event definition narrows this to a single value.
2865
+ */
2866
+ type: EventType;
2867
+ /**
2868
+ * When the event was created. Bounded to the range JSON numbers survive a
2869
+ * round trip in, so the value a consumer reads is the value the producer
2870
+ * wrote. Deliberately not a float. The unit is not constrained here, because
2871
+ * it never has been stated normatively; every SDK that sets it in practice
2872
+ * uses milliseconds since the Unix epoch, and a producer choosing another
2873
+ * unit will be misread by consumers even though it validates. Nothing in the
2874
+ * protocol computes with this value.
2875
+ */
2876
+ timestamp?: number;
2877
+ /**
2878
+ * The provider-native event this one was translated from, carried verbatim
2879
+ * for debugging and for consumers that need detail the protocol does not
2880
+ * model. Any JSON value.
2881
+ */
2882
+ rawEvent?: any;
2883
+ /**
2884
+ * Extra information attached to this event.
2885
+ */
2886
+ metadata?: Metadata;
2887
+ };
2888
+ /**
2889
+ * The fields shared by the developer, system, assistant and user messages.
2890
+ * Deliberately excludes content, because a user message's content may be an
2891
+ * array while the others are strings, and composition here intersects rather
2892
+ * than overrides: a base that constrained content to a string would make an
2893
+ * array content invalid. The tool, activity and reasoning messages do not
2894
+ * compose this, because they carry no name.
2895
+ */
2896
+ type BaseMessage = {
2897
+ /**
2898
+ * The subagent invocation this belongs to. Absent means the parent agent
2899
+ * produced it directly.
2900
+ */
2901
+ subagentRunId?: SubagentRunId;
2902
+ /**
2903
+ * Identifies the message within the conversation.
2904
+ */
2905
+ id: string;
2906
+ /**
2907
+ * Who the message is from. Each message definition narrows this to a single
2908
+ * value.
2909
+ */
2910
+ role: string;
2911
+ /**
2912
+ * An optional display name for the author.
2913
+ */
2914
+ name?: string;
2915
+ /**
2916
+ * A provider's opaque artefact belonging to this message, stored by a
2917
+ * consumer and returned on a later turn.
2918
+ */
2919
+ encryptedValue?: string;
2920
+ /**
2921
+ * Extra information attached to this message.
2922
+ */
2923
+ metadata?: Metadata;
2924
+ };
2925
+ //#endregion
2926
+ //#region src/generated/version.d.ts
2927
+ /**
2928
+ * The protocol version this code was generated from: the version segment of
2929
+ * the schema's $id (https://ag-ui.com/spec/1.0/schema.json). Never typed by a
2930
+ * human.
2931
+ */
2932
+ declare const PROTOCOL_VERSION = "1.0";
2933
+ //#endregion
2934
+ export { ReplaceOperation as $, JsonPointer as A, TextMessageStartEvent as At, PartSource as B, ToolMessage as Bt, FunctionCall as C, SubagentStartedEvent as Ct, Interrupt as D, TextMessageContentEvent as Dt, ImagePart as E, TextMessageChunkEvent as Et, MultiAgentCapabilities as F, ToolCallArgsEvent as Ft, ReasoningEndEvent as G, VideoPart as Gt, ReasoningCapabilities as H, TransportCapabilities as Ht, MultimodalCapabilities as I, ToolCallChunkEvent as It, ReasoningMessageContentEvent as J, ReasoningMessage as K, MultimodalInputCapabilities as L, ToolCallEndEvent as Lt, MessagesSnapshotEvent as M, TokenUsage as Mt, Metadata as N, Tool as Nt, JsonPatch as O, TextMessageEndEvent as Ot, MoveOperation as P, ToolCall as Pt, RemoveOperation as Q, MultimodalOutputCapabilities as R, ToolCallResultEvent as Rt, FileSource as S, SubagentRunId as St, IdentityCapabilities as T, TestOperation as Tt, ReasoningEncryptedValueEvent as U, UrlSource as Ut, RawEvent as V, ToolsCapabilities as Vt, ReasoningEncryptedValueSubtype as W, UserMessage as Wt, ReasoningMessageStartEvent as X, ReasoningMessageEndEvent as Y, ReasoningStartEvent as Z, DeveloperMessage as _, SubagentFinishedEvent as _t, AddOperation as a, RunFinishedEvent as at, EventType as b, SubagentFinishedSuspendedOutcome as bt, Attributable as c, RunFinishedSuccessOutcome as ct, BaseMessage as d, StateCapabilities as dt, ResumeEntry as et, ContentPart as f, StateDeltaEvent as ft, DataSource as g, SubagentErrorEvent as gt, CustomEvent as h, StepStartedEvent as ht, ActivitySnapshotEvent as i, RunFinishedCancelledOutcome as it, Message as j, TextPart as jt, JsonPatchOperation as k, TextMessageRole as kt, AudioPart as l, RunStartedEvent as lt, CopyOperation as m, StepFinishedEvent as mt, ActivityDeltaEvent as n, RunAgentInput as nt, AgentCapabilities as o, RunFinishedInterruptOutcome as ot, Context as p, StateSnapshotEvent as pt, ReasoningMessageChunkEvent as q, ActivityMessage as r, RunErrorEvent as rt, AssistantMessage as s, RunFinishedOutcome as st, PROTOCOL_VERSION as t, Role as tt, BaseEvent as u, State as ut, DocumentPart as v, SubagentFinishedOutcome as vt, HumanInTheLoopCapabilities as w, SystemMessage as wt, ExecutionCapabilities as x, SubagentInfo as xt, Event as y, SubagentFinishedSuccessOutcome as yt, OutputCapabilities as z, ToolCallStartEvent as zt };
2935
+ //# sourceMappingURL=version-Dr0GiU8W.d.mts.map