@ag-ui/core 0.0.27

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,1805 @@
1
+ import { z } from 'zod';
2
+ import { Observable } from 'rxjs';
3
+
4
+ declare const FunctionCallSchema: z.ZodObject<{
5
+ name: z.ZodString;
6
+ arguments: z.ZodString;
7
+ }, "strip", z.ZodTypeAny, {
8
+ name: string;
9
+ arguments: string;
10
+ }, {
11
+ name: string;
12
+ arguments: string;
13
+ }>;
14
+ declare const ToolCallSchema: z.ZodObject<{
15
+ id: z.ZodString;
16
+ type: z.ZodLiteral<"function">;
17
+ function: z.ZodObject<{
18
+ name: z.ZodString;
19
+ arguments: z.ZodString;
20
+ }, "strip", z.ZodTypeAny, {
21
+ name: string;
22
+ arguments: string;
23
+ }, {
24
+ name: string;
25
+ arguments: string;
26
+ }>;
27
+ }, "strip", z.ZodTypeAny, {
28
+ function: {
29
+ name: string;
30
+ arguments: string;
31
+ };
32
+ type: "function";
33
+ id: string;
34
+ }, {
35
+ function: {
36
+ name: string;
37
+ arguments: string;
38
+ };
39
+ type: "function";
40
+ id: string;
41
+ }>;
42
+ declare const BaseMessageSchema: z.ZodObject<{
43
+ id: z.ZodString;
44
+ role: z.ZodString;
45
+ content: z.ZodOptional<z.ZodString>;
46
+ name: z.ZodOptional<z.ZodString>;
47
+ }, "strip", z.ZodTypeAny, {
48
+ id: string;
49
+ role: string;
50
+ name?: string | undefined;
51
+ content?: string | undefined;
52
+ }, {
53
+ id: string;
54
+ role: string;
55
+ name?: string | undefined;
56
+ content?: string | undefined;
57
+ }>;
58
+ declare const DeveloperMessageSchema: z.ZodObject<z.objectUtil.extendShape<{
59
+ id: z.ZodString;
60
+ role: z.ZodString;
61
+ content: z.ZodOptional<z.ZodString>;
62
+ name: z.ZodOptional<z.ZodString>;
63
+ }, {
64
+ role: z.ZodLiteral<"developer">;
65
+ content: z.ZodString;
66
+ }>, "strip", z.ZodTypeAny, {
67
+ id: string;
68
+ role: "developer";
69
+ content: string;
70
+ name?: string | undefined;
71
+ }, {
72
+ id: string;
73
+ role: "developer";
74
+ content: string;
75
+ name?: string | undefined;
76
+ }>;
77
+ declare const SystemMessageSchema: z.ZodObject<z.objectUtil.extendShape<{
78
+ id: z.ZodString;
79
+ role: z.ZodString;
80
+ content: z.ZodOptional<z.ZodString>;
81
+ name: z.ZodOptional<z.ZodString>;
82
+ }, {
83
+ role: z.ZodLiteral<"system">;
84
+ content: z.ZodString;
85
+ }>, "strip", z.ZodTypeAny, {
86
+ id: string;
87
+ role: "system";
88
+ content: string;
89
+ name?: string | undefined;
90
+ }, {
91
+ id: string;
92
+ role: "system";
93
+ content: string;
94
+ name?: string | undefined;
95
+ }>;
96
+ declare const AssistantMessageSchema: z.ZodObject<z.objectUtil.extendShape<{
97
+ id: z.ZodString;
98
+ role: z.ZodString;
99
+ content: z.ZodOptional<z.ZodString>;
100
+ name: z.ZodOptional<z.ZodString>;
101
+ }, {
102
+ role: z.ZodLiteral<"assistant">;
103
+ content: z.ZodOptional<z.ZodString>;
104
+ toolCalls: z.ZodOptional<z.ZodArray<z.ZodObject<{
105
+ id: z.ZodString;
106
+ type: z.ZodLiteral<"function">;
107
+ function: z.ZodObject<{
108
+ name: z.ZodString;
109
+ arguments: z.ZodString;
110
+ }, "strip", z.ZodTypeAny, {
111
+ name: string;
112
+ arguments: string;
113
+ }, {
114
+ name: string;
115
+ arguments: string;
116
+ }>;
117
+ }, "strip", z.ZodTypeAny, {
118
+ function: {
119
+ name: string;
120
+ arguments: string;
121
+ };
122
+ type: "function";
123
+ id: string;
124
+ }, {
125
+ function: {
126
+ name: string;
127
+ arguments: string;
128
+ };
129
+ type: "function";
130
+ id: string;
131
+ }>, "many">>;
132
+ }>, "strip", z.ZodTypeAny, {
133
+ id: string;
134
+ role: "assistant";
135
+ name?: string | undefined;
136
+ content?: string | undefined;
137
+ toolCalls?: {
138
+ function: {
139
+ name: string;
140
+ arguments: string;
141
+ };
142
+ type: "function";
143
+ id: string;
144
+ }[] | undefined;
145
+ }, {
146
+ id: string;
147
+ role: "assistant";
148
+ name?: string | undefined;
149
+ content?: string | undefined;
150
+ toolCalls?: {
151
+ function: {
152
+ name: string;
153
+ arguments: string;
154
+ };
155
+ type: "function";
156
+ id: string;
157
+ }[] | undefined;
158
+ }>;
159
+ declare const UserMessageSchema: z.ZodObject<z.objectUtil.extendShape<{
160
+ id: z.ZodString;
161
+ role: z.ZodString;
162
+ content: z.ZodOptional<z.ZodString>;
163
+ name: z.ZodOptional<z.ZodString>;
164
+ }, {
165
+ role: z.ZodLiteral<"user">;
166
+ content: z.ZodString;
167
+ }>, "strip", z.ZodTypeAny, {
168
+ id: string;
169
+ role: "user";
170
+ content: string;
171
+ name?: string | undefined;
172
+ }, {
173
+ id: string;
174
+ role: "user";
175
+ content: string;
176
+ name?: string | undefined;
177
+ }>;
178
+ declare const ToolMessageSchema: z.ZodObject<{
179
+ id: z.ZodString;
180
+ content: z.ZodString;
181
+ role: z.ZodLiteral<"tool">;
182
+ toolCallId: z.ZodString;
183
+ }, "strip", z.ZodTypeAny, {
184
+ id: string;
185
+ role: "tool";
186
+ content: string;
187
+ toolCallId: string;
188
+ }, {
189
+ id: string;
190
+ role: "tool";
191
+ content: string;
192
+ toolCallId: string;
193
+ }>;
194
+ declare const MessageSchema: z.ZodDiscriminatedUnion<"role", [z.ZodObject<z.objectUtil.extendShape<{
195
+ id: z.ZodString;
196
+ role: z.ZodString;
197
+ content: z.ZodOptional<z.ZodString>;
198
+ name: z.ZodOptional<z.ZodString>;
199
+ }, {
200
+ role: z.ZodLiteral<"developer">;
201
+ content: z.ZodString;
202
+ }>, "strip", z.ZodTypeAny, {
203
+ id: string;
204
+ role: "developer";
205
+ content: string;
206
+ name?: string | undefined;
207
+ }, {
208
+ id: string;
209
+ role: "developer";
210
+ content: string;
211
+ name?: string | undefined;
212
+ }>, z.ZodObject<z.objectUtil.extendShape<{
213
+ id: z.ZodString;
214
+ role: z.ZodString;
215
+ content: z.ZodOptional<z.ZodString>;
216
+ name: z.ZodOptional<z.ZodString>;
217
+ }, {
218
+ role: z.ZodLiteral<"system">;
219
+ content: z.ZodString;
220
+ }>, "strip", z.ZodTypeAny, {
221
+ id: string;
222
+ role: "system";
223
+ content: string;
224
+ name?: string | undefined;
225
+ }, {
226
+ id: string;
227
+ role: "system";
228
+ content: string;
229
+ name?: string | undefined;
230
+ }>, z.ZodObject<z.objectUtil.extendShape<{
231
+ id: z.ZodString;
232
+ role: z.ZodString;
233
+ content: z.ZodOptional<z.ZodString>;
234
+ name: z.ZodOptional<z.ZodString>;
235
+ }, {
236
+ role: z.ZodLiteral<"assistant">;
237
+ content: z.ZodOptional<z.ZodString>;
238
+ toolCalls: z.ZodOptional<z.ZodArray<z.ZodObject<{
239
+ id: z.ZodString;
240
+ type: z.ZodLiteral<"function">;
241
+ function: z.ZodObject<{
242
+ name: z.ZodString;
243
+ arguments: z.ZodString;
244
+ }, "strip", z.ZodTypeAny, {
245
+ name: string;
246
+ arguments: string;
247
+ }, {
248
+ name: string;
249
+ arguments: string;
250
+ }>;
251
+ }, "strip", z.ZodTypeAny, {
252
+ function: {
253
+ name: string;
254
+ arguments: string;
255
+ };
256
+ type: "function";
257
+ id: string;
258
+ }, {
259
+ function: {
260
+ name: string;
261
+ arguments: string;
262
+ };
263
+ type: "function";
264
+ id: string;
265
+ }>, "many">>;
266
+ }>, "strip", z.ZodTypeAny, {
267
+ id: string;
268
+ role: "assistant";
269
+ name?: string | undefined;
270
+ content?: string | undefined;
271
+ toolCalls?: {
272
+ function: {
273
+ name: string;
274
+ arguments: string;
275
+ };
276
+ type: "function";
277
+ id: string;
278
+ }[] | undefined;
279
+ }, {
280
+ id: string;
281
+ role: "assistant";
282
+ name?: string | undefined;
283
+ content?: string | undefined;
284
+ toolCalls?: {
285
+ function: {
286
+ name: string;
287
+ arguments: string;
288
+ };
289
+ type: "function";
290
+ id: string;
291
+ }[] | undefined;
292
+ }>, z.ZodObject<z.objectUtil.extendShape<{
293
+ id: z.ZodString;
294
+ role: z.ZodString;
295
+ content: z.ZodOptional<z.ZodString>;
296
+ name: z.ZodOptional<z.ZodString>;
297
+ }, {
298
+ role: z.ZodLiteral<"user">;
299
+ content: z.ZodString;
300
+ }>, "strip", z.ZodTypeAny, {
301
+ id: string;
302
+ role: "user";
303
+ content: string;
304
+ name?: string | undefined;
305
+ }, {
306
+ id: string;
307
+ role: "user";
308
+ content: string;
309
+ name?: string | undefined;
310
+ }>, z.ZodObject<{
311
+ id: z.ZodString;
312
+ content: z.ZodString;
313
+ role: z.ZodLiteral<"tool">;
314
+ toolCallId: z.ZodString;
315
+ }, "strip", z.ZodTypeAny, {
316
+ id: string;
317
+ role: "tool";
318
+ content: string;
319
+ toolCallId: string;
320
+ }, {
321
+ id: string;
322
+ role: "tool";
323
+ content: string;
324
+ toolCallId: string;
325
+ }>]>;
326
+ declare const RoleSchema: z.ZodUnion<[z.ZodLiteral<"developer">, z.ZodLiteral<"system">, z.ZodLiteral<"assistant">, z.ZodLiteral<"user">, z.ZodLiteral<"tool">]>;
327
+ declare const ContextSchema: z.ZodObject<{
328
+ description: z.ZodString;
329
+ value: z.ZodString;
330
+ }, "strip", z.ZodTypeAny, {
331
+ value: string;
332
+ description: string;
333
+ }, {
334
+ value: string;
335
+ description: string;
336
+ }>;
337
+ declare const ToolSchema: z.ZodObject<{
338
+ name: z.ZodString;
339
+ description: z.ZodString;
340
+ parameters: z.ZodAny;
341
+ }, "strip", z.ZodTypeAny, {
342
+ name: string;
343
+ description: string;
344
+ parameters?: any;
345
+ }, {
346
+ name: string;
347
+ description: string;
348
+ parameters?: any;
349
+ }>;
350
+ declare const RunAgentInputSchema: z.ZodObject<{
351
+ threadId: z.ZodString;
352
+ runId: z.ZodString;
353
+ state: z.ZodAny;
354
+ messages: z.ZodArray<z.ZodDiscriminatedUnion<"role", [z.ZodObject<z.objectUtil.extendShape<{
355
+ id: z.ZodString;
356
+ role: z.ZodString;
357
+ content: z.ZodOptional<z.ZodString>;
358
+ name: z.ZodOptional<z.ZodString>;
359
+ }, {
360
+ role: z.ZodLiteral<"developer">;
361
+ content: z.ZodString;
362
+ }>, "strip", z.ZodTypeAny, {
363
+ id: string;
364
+ role: "developer";
365
+ content: string;
366
+ name?: string | undefined;
367
+ }, {
368
+ id: string;
369
+ role: "developer";
370
+ content: string;
371
+ name?: string | undefined;
372
+ }>, z.ZodObject<z.objectUtil.extendShape<{
373
+ id: z.ZodString;
374
+ role: z.ZodString;
375
+ content: z.ZodOptional<z.ZodString>;
376
+ name: z.ZodOptional<z.ZodString>;
377
+ }, {
378
+ role: z.ZodLiteral<"system">;
379
+ content: z.ZodString;
380
+ }>, "strip", z.ZodTypeAny, {
381
+ id: string;
382
+ role: "system";
383
+ content: string;
384
+ name?: string | undefined;
385
+ }, {
386
+ id: string;
387
+ role: "system";
388
+ content: string;
389
+ name?: string | undefined;
390
+ }>, z.ZodObject<z.objectUtil.extendShape<{
391
+ id: z.ZodString;
392
+ role: z.ZodString;
393
+ content: z.ZodOptional<z.ZodString>;
394
+ name: z.ZodOptional<z.ZodString>;
395
+ }, {
396
+ role: z.ZodLiteral<"assistant">;
397
+ content: z.ZodOptional<z.ZodString>;
398
+ toolCalls: z.ZodOptional<z.ZodArray<z.ZodObject<{
399
+ id: z.ZodString;
400
+ type: z.ZodLiteral<"function">;
401
+ function: z.ZodObject<{
402
+ name: z.ZodString;
403
+ arguments: z.ZodString;
404
+ }, "strip", z.ZodTypeAny, {
405
+ name: string;
406
+ arguments: string;
407
+ }, {
408
+ name: string;
409
+ arguments: string;
410
+ }>;
411
+ }, "strip", z.ZodTypeAny, {
412
+ function: {
413
+ name: string;
414
+ arguments: string;
415
+ };
416
+ type: "function";
417
+ id: string;
418
+ }, {
419
+ function: {
420
+ name: string;
421
+ arguments: string;
422
+ };
423
+ type: "function";
424
+ id: string;
425
+ }>, "many">>;
426
+ }>, "strip", z.ZodTypeAny, {
427
+ id: string;
428
+ role: "assistant";
429
+ name?: string | undefined;
430
+ content?: string | undefined;
431
+ toolCalls?: {
432
+ function: {
433
+ name: string;
434
+ arguments: string;
435
+ };
436
+ type: "function";
437
+ id: string;
438
+ }[] | undefined;
439
+ }, {
440
+ id: string;
441
+ role: "assistant";
442
+ name?: string | undefined;
443
+ content?: string | undefined;
444
+ toolCalls?: {
445
+ function: {
446
+ name: string;
447
+ arguments: string;
448
+ };
449
+ type: "function";
450
+ id: string;
451
+ }[] | undefined;
452
+ }>, z.ZodObject<z.objectUtil.extendShape<{
453
+ id: z.ZodString;
454
+ role: z.ZodString;
455
+ content: z.ZodOptional<z.ZodString>;
456
+ name: z.ZodOptional<z.ZodString>;
457
+ }, {
458
+ role: z.ZodLiteral<"user">;
459
+ content: z.ZodString;
460
+ }>, "strip", z.ZodTypeAny, {
461
+ id: string;
462
+ role: "user";
463
+ content: string;
464
+ name?: string | undefined;
465
+ }, {
466
+ id: string;
467
+ role: "user";
468
+ content: string;
469
+ name?: string | undefined;
470
+ }>, z.ZodObject<{
471
+ id: z.ZodString;
472
+ content: z.ZodString;
473
+ role: z.ZodLiteral<"tool">;
474
+ toolCallId: z.ZodString;
475
+ }, "strip", z.ZodTypeAny, {
476
+ id: string;
477
+ role: "tool";
478
+ content: string;
479
+ toolCallId: string;
480
+ }, {
481
+ id: string;
482
+ role: "tool";
483
+ content: string;
484
+ toolCallId: string;
485
+ }>]>, "many">;
486
+ tools: z.ZodArray<z.ZodObject<{
487
+ name: z.ZodString;
488
+ description: z.ZodString;
489
+ parameters: z.ZodAny;
490
+ }, "strip", z.ZodTypeAny, {
491
+ name: string;
492
+ description: string;
493
+ parameters?: any;
494
+ }, {
495
+ name: string;
496
+ description: string;
497
+ parameters?: any;
498
+ }>, "many">;
499
+ context: z.ZodArray<z.ZodObject<{
500
+ description: z.ZodString;
501
+ value: z.ZodString;
502
+ }, "strip", z.ZodTypeAny, {
503
+ value: string;
504
+ description: string;
505
+ }, {
506
+ value: string;
507
+ description: string;
508
+ }>, "many">;
509
+ forwardedProps: z.ZodAny;
510
+ }, "strip", z.ZodTypeAny, {
511
+ threadId: string;
512
+ runId: string;
513
+ messages: ({
514
+ id: string;
515
+ role: "developer";
516
+ content: string;
517
+ name?: string | undefined;
518
+ } | {
519
+ id: string;
520
+ role: "system";
521
+ content: string;
522
+ name?: string | undefined;
523
+ } | {
524
+ id: string;
525
+ role: "assistant";
526
+ name?: string | undefined;
527
+ content?: string | undefined;
528
+ toolCalls?: {
529
+ function: {
530
+ name: string;
531
+ arguments: string;
532
+ };
533
+ type: "function";
534
+ id: string;
535
+ }[] | undefined;
536
+ } | {
537
+ id: string;
538
+ role: "user";
539
+ content: string;
540
+ name?: string | undefined;
541
+ } | {
542
+ id: string;
543
+ role: "tool";
544
+ content: string;
545
+ toolCallId: string;
546
+ })[];
547
+ tools: {
548
+ name: string;
549
+ description: string;
550
+ parameters?: any;
551
+ }[];
552
+ context: {
553
+ value: string;
554
+ description: string;
555
+ }[];
556
+ state?: any;
557
+ forwardedProps?: any;
558
+ }, {
559
+ threadId: string;
560
+ runId: string;
561
+ messages: ({
562
+ id: string;
563
+ role: "developer";
564
+ content: string;
565
+ name?: string | undefined;
566
+ } | {
567
+ id: string;
568
+ role: "system";
569
+ content: string;
570
+ name?: string | undefined;
571
+ } | {
572
+ id: string;
573
+ role: "assistant";
574
+ name?: string | undefined;
575
+ content?: string | undefined;
576
+ toolCalls?: {
577
+ function: {
578
+ name: string;
579
+ arguments: string;
580
+ };
581
+ type: "function";
582
+ id: string;
583
+ }[] | undefined;
584
+ } | {
585
+ id: string;
586
+ role: "user";
587
+ content: string;
588
+ name?: string | undefined;
589
+ } | {
590
+ id: string;
591
+ role: "tool";
592
+ content: string;
593
+ toolCallId: string;
594
+ })[];
595
+ tools: {
596
+ name: string;
597
+ description: string;
598
+ parameters?: any;
599
+ }[];
600
+ context: {
601
+ value: string;
602
+ description: string;
603
+ }[];
604
+ state?: any;
605
+ forwardedProps?: any;
606
+ }>;
607
+ declare const StateSchema: z.ZodAny;
608
+ type ToolCall = z.infer<typeof ToolCallSchema>;
609
+ type FunctionCall = z.infer<typeof FunctionCallSchema>;
610
+ type DeveloperMessage = z.infer<typeof DeveloperMessageSchema>;
611
+ type SystemMessage = z.infer<typeof SystemMessageSchema>;
612
+ type AssistantMessage = z.infer<typeof AssistantMessageSchema>;
613
+ type UserMessage = z.infer<typeof UserMessageSchema>;
614
+ type ToolMessage = z.infer<typeof ToolMessageSchema>;
615
+ type Message = z.infer<typeof MessageSchema>;
616
+ type Context = z.infer<typeof ContextSchema>;
617
+ type Tool = z.infer<typeof ToolSchema>;
618
+ type RunAgentInput = z.infer<typeof RunAgentInputSchema>;
619
+ type State = z.infer<typeof StateSchema>;
620
+ type Role = z.infer<typeof RoleSchema>;
621
+ declare class AGUIError extends Error {
622
+ constructor(message: string);
623
+ }
624
+
625
+ declare enum EventType {
626
+ TEXT_MESSAGE_START = "TEXT_MESSAGE_START",
627
+ TEXT_MESSAGE_CONTENT = "TEXT_MESSAGE_CONTENT",
628
+ TEXT_MESSAGE_END = "TEXT_MESSAGE_END",
629
+ TOOL_CALL_START = "TOOL_CALL_START",
630
+ TOOL_CALL_ARGS = "TOOL_CALL_ARGS",
631
+ TOOL_CALL_END = "TOOL_CALL_END",
632
+ STATE_SNAPSHOT = "STATE_SNAPSHOT",
633
+ STATE_DELTA = "STATE_DELTA",
634
+ MESSAGES_SNAPSHOT = "MESSAGES_SNAPSHOT",
635
+ RAW = "RAW",
636
+ CUSTOM = "CUSTOM",
637
+ RUN_STARTED = "RUN_STARTED",
638
+ RUN_FINISHED = "RUN_FINISHED",
639
+ RUN_ERROR = "RUN_ERROR",
640
+ STEP_STARTED = "STEP_STARTED",
641
+ STEP_FINISHED = "STEP_FINISHED"
642
+ }
643
+ declare const BaseEventSchema: z.ZodObject<{
644
+ type: z.ZodNativeEnum<typeof EventType>;
645
+ timestamp: z.ZodOptional<z.ZodNumber>;
646
+ rawEvent: z.ZodOptional<z.ZodAny>;
647
+ }, "strip", z.ZodTypeAny, {
648
+ type: EventType;
649
+ timestamp?: number | undefined;
650
+ rawEvent?: any;
651
+ }, {
652
+ type: EventType;
653
+ timestamp?: number | undefined;
654
+ rawEvent?: any;
655
+ }>;
656
+ declare const RunStartedSchema: z.ZodObject<z.objectUtil.extendShape<{
657
+ type: z.ZodNativeEnum<typeof EventType>;
658
+ timestamp: z.ZodOptional<z.ZodNumber>;
659
+ rawEvent: z.ZodOptional<z.ZodAny>;
660
+ }, {
661
+ type: z.ZodLiteral<EventType.RUN_STARTED>;
662
+ threadId: z.ZodString;
663
+ runId: z.ZodString;
664
+ }>, "strip", z.ZodTypeAny, {
665
+ type: EventType.RUN_STARTED;
666
+ threadId: string;
667
+ runId: string;
668
+ timestamp?: number | undefined;
669
+ rawEvent?: any;
670
+ }, {
671
+ type: EventType.RUN_STARTED;
672
+ threadId: string;
673
+ runId: string;
674
+ timestamp?: number | undefined;
675
+ rawEvent?: any;
676
+ }>;
677
+ declare const RunFinishedSchema: z.ZodObject<z.objectUtil.extendShape<{
678
+ type: z.ZodNativeEnum<typeof EventType>;
679
+ timestamp: z.ZodOptional<z.ZodNumber>;
680
+ rawEvent: z.ZodOptional<z.ZodAny>;
681
+ }, {
682
+ type: z.ZodLiteral<EventType.RUN_FINISHED>;
683
+ threadId: z.ZodString;
684
+ runId: z.ZodString;
685
+ }>, "strip", z.ZodTypeAny, {
686
+ type: EventType.RUN_FINISHED;
687
+ threadId: string;
688
+ runId: string;
689
+ timestamp?: number | undefined;
690
+ rawEvent?: any;
691
+ }, {
692
+ type: EventType.RUN_FINISHED;
693
+ threadId: string;
694
+ runId: string;
695
+ timestamp?: number | undefined;
696
+ rawEvent?: any;
697
+ }>;
698
+ declare const RunErrorSchema: z.ZodObject<z.objectUtil.extendShape<{
699
+ type: z.ZodNativeEnum<typeof EventType>;
700
+ timestamp: z.ZodOptional<z.ZodNumber>;
701
+ rawEvent: z.ZodOptional<z.ZodAny>;
702
+ }, {
703
+ type: z.ZodLiteral<EventType.RUN_ERROR>;
704
+ message: z.ZodString;
705
+ code: z.ZodOptional<z.ZodString>;
706
+ }>, "strip", z.ZodTypeAny, {
707
+ message: string;
708
+ type: EventType.RUN_ERROR;
709
+ code?: string | undefined;
710
+ timestamp?: number | undefined;
711
+ rawEvent?: any;
712
+ }, {
713
+ message: string;
714
+ type: EventType.RUN_ERROR;
715
+ code?: string | undefined;
716
+ timestamp?: number | undefined;
717
+ rawEvent?: any;
718
+ }>;
719
+ declare const StepStartedSchema: z.ZodObject<z.objectUtil.extendShape<{
720
+ type: z.ZodNativeEnum<typeof EventType>;
721
+ timestamp: z.ZodOptional<z.ZodNumber>;
722
+ rawEvent: z.ZodOptional<z.ZodAny>;
723
+ }, {
724
+ type: z.ZodLiteral<EventType.STEP_STARTED>;
725
+ stepName: z.ZodString;
726
+ }>, "strip", z.ZodTypeAny, {
727
+ type: EventType.STEP_STARTED;
728
+ stepName: string;
729
+ timestamp?: number | undefined;
730
+ rawEvent?: any;
731
+ }, {
732
+ type: EventType.STEP_STARTED;
733
+ stepName: string;
734
+ timestamp?: number | undefined;
735
+ rawEvent?: any;
736
+ }>;
737
+ declare const StepFinishedSchema: z.ZodObject<z.objectUtil.extendShape<{
738
+ type: z.ZodNativeEnum<typeof EventType>;
739
+ timestamp: z.ZodOptional<z.ZodNumber>;
740
+ rawEvent: z.ZodOptional<z.ZodAny>;
741
+ }, {
742
+ type: z.ZodLiteral<EventType.STEP_FINISHED>;
743
+ stepName: z.ZodString;
744
+ }>, "strip", z.ZodTypeAny, {
745
+ type: EventType.STEP_FINISHED;
746
+ stepName: string;
747
+ timestamp?: number | undefined;
748
+ rawEvent?: any;
749
+ }, {
750
+ type: EventType.STEP_FINISHED;
751
+ stepName: string;
752
+ timestamp?: number | undefined;
753
+ rawEvent?: any;
754
+ }>;
755
+ declare const TextMessageStartEventSchema: z.ZodObject<z.objectUtil.extendShape<{
756
+ type: z.ZodNativeEnum<typeof EventType>;
757
+ timestamp: z.ZodOptional<z.ZodNumber>;
758
+ rawEvent: z.ZodOptional<z.ZodAny>;
759
+ }, {
760
+ type: z.ZodLiteral<EventType.TEXT_MESSAGE_START>;
761
+ messageId: z.ZodString;
762
+ role: z.ZodLiteral<"assistant">;
763
+ }>, "strip", z.ZodTypeAny, {
764
+ type: EventType.TEXT_MESSAGE_START;
765
+ role: "assistant";
766
+ messageId: string;
767
+ timestamp?: number | undefined;
768
+ rawEvent?: any;
769
+ }, {
770
+ type: EventType.TEXT_MESSAGE_START;
771
+ role: "assistant";
772
+ messageId: string;
773
+ timestamp?: number | undefined;
774
+ rawEvent?: any;
775
+ }>;
776
+ declare const TextMessageContentEventSchema: z.ZodObject<z.objectUtil.extendShape<{
777
+ type: z.ZodNativeEnum<typeof EventType>;
778
+ timestamp: z.ZodOptional<z.ZodNumber>;
779
+ rawEvent: z.ZodOptional<z.ZodAny>;
780
+ }, {
781
+ type: z.ZodLiteral<EventType.TEXT_MESSAGE_CONTENT>;
782
+ messageId: z.ZodString;
783
+ delta: z.ZodEffects<z.ZodString, string, string>;
784
+ }>, "strip", z.ZodTypeAny, {
785
+ type: EventType.TEXT_MESSAGE_CONTENT;
786
+ messageId: string;
787
+ delta: string;
788
+ timestamp?: number | undefined;
789
+ rawEvent?: any;
790
+ }, {
791
+ type: EventType.TEXT_MESSAGE_CONTENT;
792
+ messageId: string;
793
+ delta: string;
794
+ timestamp?: number | undefined;
795
+ rawEvent?: any;
796
+ }>;
797
+ declare const TextMessageEndEventSchema: z.ZodObject<z.objectUtil.extendShape<{
798
+ type: z.ZodNativeEnum<typeof EventType>;
799
+ timestamp: z.ZodOptional<z.ZodNumber>;
800
+ rawEvent: z.ZodOptional<z.ZodAny>;
801
+ }, {
802
+ type: z.ZodLiteral<EventType.TEXT_MESSAGE_END>;
803
+ messageId: z.ZodString;
804
+ }>, "strip", z.ZodTypeAny, {
805
+ type: EventType.TEXT_MESSAGE_END;
806
+ messageId: string;
807
+ timestamp?: number | undefined;
808
+ rawEvent?: any;
809
+ }, {
810
+ type: EventType.TEXT_MESSAGE_END;
811
+ messageId: string;
812
+ timestamp?: number | undefined;
813
+ rawEvent?: any;
814
+ }>;
815
+ declare const ToolCallStartEventSchema: z.ZodObject<z.objectUtil.extendShape<{
816
+ type: z.ZodNativeEnum<typeof EventType>;
817
+ timestamp: z.ZodOptional<z.ZodNumber>;
818
+ rawEvent: z.ZodOptional<z.ZodAny>;
819
+ }, {
820
+ type: z.ZodLiteral<EventType.TOOL_CALL_START>;
821
+ toolCallId: z.ZodString;
822
+ toolCallName: z.ZodString;
823
+ parentMessageId: z.ZodOptional<z.ZodString>;
824
+ }>, "strip", z.ZodTypeAny, {
825
+ type: EventType.TOOL_CALL_START;
826
+ toolCallId: string;
827
+ toolCallName: string;
828
+ timestamp?: number | undefined;
829
+ rawEvent?: any;
830
+ parentMessageId?: string | undefined;
831
+ }, {
832
+ type: EventType.TOOL_CALL_START;
833
+ toolCallId: string;
834
+ toolCallName: string;
835
+ timestamp?: number | undefined;
836
+ rawEvent?: any;
837
+ parentMessageId?: string | undefined;
838
+ }>;
839
+ declare const ToolCallArgsEventSchema: z.ZodObject<z.objectUtil.extendShape<{
840
+ type: z.ZodNativeEnum<typeof EventType>;
841
+ timestamp: z.ZodOptional<z.ZodNumber>;
842
+ rawEvent: z.ZodOptional<z.ZodAny>;
843
+ }, {
844
+ type: z.ZodLiteral<EventType.TOOL_CALL_ARGS>;
845
+ toolCallId: z.ZodString;
846
+ delta: z.ZodString;
847
+ }>, "strip", z.ZodTypeAny, {
848
+ type: EventType.TOOL_CALL_ARGS;
849
+ toolCallId: string;
850
+ delta: string;
851
+ timestamp?: number | undefined;
852
+ rawEvent?: any;
853
+ }, {
854
+ type: EventType.TOOL_CALL_ARGS;
855
+ toolCallId: string;
856
+ delta: string;
857
+ timestamp?: number | undefined;
858
+ rawEvent?: any;
859
+ }>;
860
+ declare const ToolCallEndEventSchema: z.ZodObject<z.objectUtil.extendShape<{
861
+ type: z.ZodNativeEnum<typeof EventType>;
862
+ timestamp: z.ZodOptional<z.ZodNumber>;
863
+ rawEvent: z.ZodOptional<z.ZodAny>;
864
+ }, {
865
+ type: z.ZodLiteral<EventType.TOOL_CALL_END>;
866
+ toolCallId: z.ZodString;
867
+ }>, "strip", z.ZodTypeAny, {
868
+ type: EventType.TOOL_CALL_END;
869
+ toolCallId: string;
870
+ timestamp?: number | undefined;
871
+ rawEvent?: any;
872
+ }, {
873
+ type: EventType.TOOL_CALL_END;
874
+ toolCallId: string;
875
+ timestamp?: number | undefined;
876
+ rawEvent?: any;
877
+ }>;
878
+ declare const StateSnapshotEventSchema: z.ZodObject<z.objectUtil.extendShape<{
879
+ type: z.ZodNativeEnum<typeof EventType>;
880
+ timestamp: z.ZodOptional<z.ZodNumber>;
881
+ rawEvent: z.ZodOptional<z.ZodAny>;
882
+ }, {
883
+ type: z.ZodLiteral<EventType.STATE_SNAPSHOT>;
884
+ snapshot: z.ZodAny;
885
+ }>, "strip", z.ZodTypeAny, {
886
+ type: EventType.STATE_SNAPSHOT;
887
+ timestamp?: number | undefined;
888
+ rawEvent?: any;
889
+ snapshot?: any;
890
+ }, {
891
+ type: EventType.STATE_SNAPSHOT;
892
+ timestamp?: number | undefined;
893
+ rawEvent?: any;
894
+ snapshot?: any;
895
+ }>;
896
+ declare const StateDeltaEventSchema: z.ZodObject<z.objectUtil.extendShape<{
897
+ type: z.ZodNativeEnum<typeof EventType>;
898
+ timestamp: z.ZodOptional<z.ZodNumber>;
899
+ rawEvent: z.ZodOptional<z.ZodAny>;
900
+ }, {
901
+ type: z.ZodLiteral<EventType.STATE_DELTA>;
902
+ delta: z.ZodArray<z.ZodAny, "many">;
903
+ }>, "strip", z.ZodTypeAny, {
904
+ type: EventType.STATE_DELTA;
905
+ delta: any[];
906
+ timestamp?: number | undefined;
907
+ rawEvent?: any;
908
+ }, {
909
+ type: EventType.STATE_DELTA;
910
+ delta: any[];
911
+ timestamp?: number | undefined;
912
+ rawEvent?: any;
913
+ }>;
914
+ declare const MessagesSnapshotEventSchema: z.ZodObject<z.objectUtil.extendShape<{
915
+ type: z.ZodNativeEnum<typeof EventType>;
916
+ timestamp: z.ZodOptional<z.ZodNumber>;
917
+ rawEvent: z.ZodOptional<z.ZodAny>;
918
+ }, {
919
+ type: z.ZodLiteral<EventType.MESSAGES_SNAPSHOT>;
920
+ messages: z.ZodArray<z.ZodDiscriminatedUnion<"role", [z.ZodObject<z.objectUtil.extendShape<{
921
+ id: z.ZodString;
922
+ role: z.ZodString;
923
+ content: z.ZodOptional<z.ZodString>;
924
+ name: z.ZodOptional<z.ZodString>;
925
+ }, {
926
+ role: z.ZodLiteral<"developer">;
927
+ content: z.ZodString;
928
+ }>, "strip", z.ZodTypeAny, {
929
+ id: string;
930
+ role: "developer";
931
+ content: string;
932
+ name?: string | undefined;
933
+ }, {
934
+ id: string;
935
+ role: "developer";
936
+ content: string;
937
+ name?: string | undefined;
938
+ }>, z.ZodObject<z.objectUtil.extendShape<{
939
+ id: z.ZodString;
940
+ role: z.ZodString;
941
+ content: z.ZodOptional<z.ZodString>;
942
+ name: z.ZodOptional<z.ZodString>;
943
+ }, {
944
+ role: z.ZodLiteral<"system">;
945
+ content: z.ZodString;
946
+ }>, "strip", z.ZodTypeAny, {
947
+ id: string;
948
+ role: "system";
949
+ content: string;
950
+ name?: string | undefined;
951
+ }, {
952
+ id: string;
953
+ role: "system";
954
+ content: string;
955
+ name?: string | undefined;
956
+ }>, z.ZodObject<z.objectUtil.extendShape<{
957
+ id: z.ZodString;
958
+ role: z.ZodString;
959
+ content: z.ZodOptional<z.ZodString>;
960
+ name: z.ZodOptional<z.ZodString>;
961
+ }, {
962
+ role: z.ZodLiteral<"assistant">;
963
+ content: z.ZodOptional<z.ZodString>;
964
+ toolCalls: z.ZodOptional<z.ZodArray<z.ZodObject<{
965
+ id: z.ZodString;
966
+ type: z.ZodLiteral<"function">;
967
+ function: z.ZodObject<{
968
+ name: z.ZodString;
969
+ arguments: z.ZodString;
970
+ }, "strip", z.ZodTypeAny, {
971
+ name: string;
972
+ arguments: string;
973
+ }, {
974
+ name: string;
975
+ arguments: string;
976
+ }>;
977
+ }, "strip", z.ZodTypeAny, {
978
+ function: {
979
+ name: string;
980
+ arguments: string;
981
+ };
982
+ type: "function";
983
+ id: string;
984
+ }, {
985
+ function: {
986
+ name: string;
987
+ arguments: string;
988
+ };
989
+ type: "function";
990
+ id: string;
991
+ }>, "many">>;
992
+ }>, "strip", z.ZodTypeAny, {
993
+ id: string;
994
+ role: "assistant";
995
+ name?: string | undefined;
996
+ content?: string | undefined;
997
+ toolCalls?: {
998
+ function: {
999
+ name: string;
1000
+ arguments: string;
1001
+ };
1002
+ type: "function";
1003
+ id: string;
1004
+ }[] | undefined;
1005
+ }, {
1006
+ id: string;
1007
+ role: "assistant";
1008
+ name?: string | undefined;
1009
+ content?: string | undefined;
1010
+ toolCalls?: {
1011
+ function: {
1012
+ name: string;
1013
+ arguments: string;
1014
+ };
1015
+ type: "function";
1016
+ id: string;
1017
+ }[] | undefined;
1018
+ }>, z.ZodObject<z.objectUtil.extendShape<{
1019
+ id: z.ZodString;
1020
+ role: z.ZodString;
1021
+ content: z.ZodOptional<z.ZodString>;
1022
+ name: z.ZodOptional<z.ZodString>;
1023
+ }, {
1024
+ role: z.ZodLiteral<"user">;
1025
+ content: z.ZodString;
1026
+ }>, "strip", z.ZodTypeAny, {
1027
+ id: string;
1028
+ role: "user";
1029
+ content: string;
1030
+ name?: string | undefined;
1031
+ }, {
1032
+ id: string;
1033
+ role: "user";
1034
+ content: string;
1035
+ name?: string | undefined;
1036
+ }>, z.ZodObject<{
1037
+ id: z.ZodString;
1038
+ content: z.ZodString;
1039
+ role: z.ZodLiteral<"tool">;
1040
+ toolCallId: z.ZodString;
1041
+ }, "strip", z.ZodTypeAny, {
1042
+ id: string;
1043
+ role: "tool";
1044
+ content: string;
1045
+ toolCallId: string;
1046
+ }, {
1047
+ id: string;
1048
+ role: "tool";
1049
+ content: string;
1050
+ toolCallId: string;
1051
+ }>]>, "many">;
1052
+ }>, "strip", z.ZodTypeAny, {
1053
+ type: EventType.MESSAGES_SNAPSHOT;
1054
+ messages: ({
1055
+ id: string;
1056
+ role: "developer";
1057
+ content: string;
1058
+ name?: string | undefined;
1059
+ } | {
1060
+ id: string;
1061
+ role: "system";
1062
+ content: string;
1063
+ name?: string | undefined;
1064
+ } | {
1065
+ id: string;
1066
+ role: "assistant";
1067
+ name?: string | undefined;
1068
+ content?: string | undefined;
1069
+ toolCalls?: {
1070
+ function: {
1071
+ name: string;
1072
+ arguments: string;
1073
+ };
1074
+ type: "function";
1075
+ id: string;
1076
+ }[] | undefined;
1077
+ } | {
1078
+ id: string;
1079
+ role: "user";
1080
+ content: string;
1081
+ name?: string | undefined;
1082
+ } | {
1083
+ id: string;
1084
+ role: "tool";
1085
+ content: string;
1086
+ toolCallId: string;
1087
+ })[];
1088
+ timestamp?: number | undefined;
1089
+ rawEvent?: any;
1090
+ }, {
1091
+ type: EventType.MESSAGES_SNAPSHOT;
1092
+ messages: ({
1093
+ id: string;
1094
+ role: "developer";
1095
+ content: string;
1096
+ name?: string | undefined;
1097
+ } | {
1098
+ id: string;
1099
+ role: "system";
1100
+ content: string;
1101
+ name?: string | undefined;
1102
+ } | {
1103
+ id: string;
1104
+ role: "assistant";
1105
+ name?: string | undefined;
1106
+ content?: string | undefined;
1107
+ toolCalls?: {
1108
+ function: {
1109
+ name: string;
1110
+ arguments: string;
1111
+ };
1112
+ type: "function";
1113
+ id: string;
1114
+ }[] | undefined;
1115
+ } | {
1116
+ id: string;
1117
+ role: "user";
1118
+ content: string;
1119
+ name?: string | undefined;
1120
+ } | {
1121
+ id: string;
1122
+ role: "tool";
1123
+ content: string;
1124
+ toolCallId: string;
1125
+ })[];
1126
+ timestamp?: number | undefined;
1127
+ rawEvent?: any;
1128
+ }>;
1129
+ declare const RawEventSchema: z.ZodObject<z.objectUtil.extendShape<{
1130
+ type: z.ZodNativeEnum<typeof EventType>;
1131
+ timestamp: z.ZodOptional<z.ZodNumber>;
1132
+ rawEvent: z.ZodOptional<z.ZodAny>;
1133
+ }, {
1134
+ type: z.ZodLiteral<EventType.RAW>;
1135
+ event: z.ZodAny;
1136
+ source: z.ZodOptional<z.ZodString>;
1137
+ }>, "strip", z.ZodTypeAny, {
1138
+ type: EventType.RAW;
1139
+ timestamp?: number | undefined;
1140
+ rawEvent?: any;
1141
+ event?: any;
1142
+ source?: string | undefined;
1143
+ }, {
1144
+ type: EventType.RAW;
1145
+ timestamp?: number | undefined;
1146
+ rawEvent?: any;
1147
+ event?: any;
1148
+ source?: string | undefined;
1149
+ }>;
1150
+ declare const CustomEventSchema: z.ZodObject<z.objectUtil.extendShape<{
1151
+ type: z.ZodNativeEnum<typeof EventType>;
1152
+ timestamp: z.ZodOptional<z.ZodNumber>;
1153
+ rawEvent: z.ZodOptional<z.ZodAny>;
1154
+ }, {
1155
+ type: z.ZodLiteral<EventType.CUSTOM>;
1156
+ name: z.ZodString;
1157
+ value: z.ZodAny;
1158
+ }>, "strip", z.ZodTypeAny, {
1159
+ name: string;
1160
+ type: EventType.CUSTOM;
1161
+ value?: any;
1162
+ timestamp?: number | undefined;
1163
+ rawEvent?: any;
1164
+ }, {
1165
+ name: string;
1166
+ type: EventType.CUSTOM;
1167
+ value?: any;
1168
+ timestamp?: number | undefined;
1169
+ rawEvent?: any;
1170
+ }>;
1171
+ declare const RunStartedEventSchema: z.ZodObject<z.objectUtil.extendShape<{
1172
+ type: z.ZodNativeEnum<typeof EventType>;
1173
+ timestamp: z.ZodOptional<z.ZodNumber>;
1174
+ rawEvent: z.ZodOptional<z.ZodAny>;
1175
+ }, {
1176
+ type: z.ZodLiteral<EventType.RUN_STARTED>;
1177
+ threadId: z.ZodString;
1178
+ runId: z.ZodString;
1179
+ }>, "strip", z.ZodTypeAny, {
1180
+ type: EventType.RUN_STARTED;
1181
+ threadId: string;
1182
+ runId: string;
1183
+ timestamp?: number | undefined;
1184
+ rawEvent?: any;
1185
+ }, {
1186
+ type: EventType.RUN_STARTED;
1187
+ threadId: string;
1188
+ runId: string;
1189
+ timestamp?: number | undefined;
1190
+ rawEvent?: any;
1191
+ }>;
1192
+ declare const RunFinishedEventSchema: z.ZodObject<z.objectUtil.extendShape<{
1193
+ type: z.ZodNativeEnum<typeof EventType>;
1194
+ timestamp: z.ZodOptional<z.ZodNumber>;
1195
+ rawEvent: z.ZodOptional<z.ZodAny>;
1196
+ }, {
1197
+ type: z.ZodLiteral<EventType.RUN_FINISHED>;
1198
+ threadId: z.ZodString;
1199
+ runId: z.ZodString;
1200
+ }>, "strip", z.ZodTypeAny, {
1201
+ type: EventType.RUN_FINISHED;
1202
+ threadId: string;
1203
+ runId: string;
1204
+ timestamp?: number | undefined;
1205
+ rawEvent?: any;
1206
+ }, {
1207
+ type: EventType.RUN_FINISHED;
1208
+ threadId: string;
1209
+ runId: string;
1210
+ timestamp?: number | undefined;
1211
+ rawEvent?: any;
1212
+ }>;
1213
+ declare const RunErrorEventSchema: z.ZodObject<z.objectUtil.extendShape<{
1214
+ type: z.ZodNativeEnum<typeof EventType>;
1215
+ timestamp: z.ZodOptional<z.ZodNumber>;
1216
+ rawEvent: z.ZodOptional<z.ZodAny>;
1217
+ }, {
1218
+ type: z.ZodLiteral<EventType.RUN_ERROR>;
1219
+ message: z.ZodString;
1220
+ code: z.ZodOptional<z.ZodString>;
1221
+ }>, "strip", z.ZodTypeAny, {
1222
+ message: string;
1223
+ type: EventType.RUN_ERROR;
1224
+ code?: string | undefined;
1225
+ timestamp?: number | undefined;
1226
+ rawEvent?: any;
1227
+ }, {
1228
+ message: string;
1229
+ type: EventType.RUN_ERROR;
1230
+ code?: string | undefined;
1231
+ timestamp?: number | undefined;
1232
+ rawEvent?: any;
1233
+ }>;
1234
+ declare const StepStartedEventSchema: z.ZodObject<z.objectUtil.extendShape<{
1235
+ type: z.ZodNativeEnum<typeof EventType>;
1236
+ timestamp: z.ZodOptional<z.ZodNumber>;
1237
+ rawEvent: z.ZodOptional<z.ZodAny>;
1238
+ }, {
1239
+ type: z.ZodLiteral<EventType.STEP_STARTED>;
1240
+ stepName: z.ZodString;
1241
+ }>, "strip", z.ZodTypeAny, {
1242
+ type: EventType.STEP_STARTED;
1243
+ stepName: string;
1244
+ timestamp?: number | undefined;
1245
+ rawEvent?: any;
1246
+ }, {
1247
+ type: EventType.STEP_STARTED;
1248
+ stepName: string;
1249
+ timestamp?: number | undefined;
1250
+ rawEvent?: any;
1251
+ }>;
1252
+ declare const StepFinishedEventSchema: z.ZodObject<z.objectUtil.extendShape<{
1253
+ type: z.ZodNativeEnum<typeof EventType>;
1254
+ timestamp: z.ZodOptional<z.ZodNumber>;
1255
+ rawEvent: z.ZodOptional<z.ZodAny>;
1256
+ }, {
1257
+ type: z.ZodLiteral<EventType.STEP_FINISHED>;
1258
+ stepName: z.ZodString;
1259
+ }>, "strip", z.ZodTypeAny, {
1260
+ type: EventType.STEP_FINISHED;
1261
+ stepName: string;
1262
+ timestamp?: number | undefined;
1263
+ rawEvent?: any;
1264
+ }, {
1265
+ type: EventType.STEP_FINISHED;
1266
+ stepName: string;
1267
+ timestamp?: number | undefined;
1268
+ rawEvent?: any;
1269
+ }>;
1270
+ declare const EventSchemas: z.ZodDiscriminatedUnion<"type", [z.ZodObject<z.objectUtil.extendShape<{
1271
+ type: z.ZodNativeEnum<typeof EventType>;
1272
+ timestamp: z.ZodOptional<z.ZodNumber>;
1273
+ rawEvent: z.ZodOptional<z.ZodAny>;
1274
+ }, {
1275
+ type: z.ZodLiteral<EventType.TEXT_MESSAGE_START>;
1276
+ messageId: z.ZodString;
1277
+ role: z.ZodLiteral<"assistant">;
1278
+ }>, "strip", z.ZodTypeAny, {
1279
+ type: EventType.TEXT_MESSAGE_START;
1280
+ role: "assistant";
1281
+ messageId: string;
1282
+ timestamp?: number | undefined;
1283
+ rawEvent?: any;
1284
+ }, {
1285
+ type: EventType.TEXT_MESSAGE_START;
1286
+ role: "assistant";
1287
+ messageId: string;
1288
+ timestamp?: number | undefined;
1289
+ rawEvent?: any;
1290
+ }>, z.ZodObject<z.objectUtil.extendShape<{
1291
+ type: z.ZodNativeEnum<typeof EventType>;
1292
+ timestamp: z.ZodOptional<z.ZodNumber>;
1293
+ rawEvent: z.ZodOptional<z.ZodAny>;
1294
+ }, {
1295
+ type: z.ZodLiteral<EventType.TEXT_MESSAGE_CONTENT>;
1296
+ messageId: z.ZodString;
1297
+ delta: z.ZodEffects<z.ZodString, string, string>;
1298
+ }>, "strip", z.ZodTypeAny, {
1299
+ type: EventType.TEXT_MESSAGE_CONTENT;
1300
+ messageId: string;
1301
+ delta: string;
1302
+ timestamp?: number | undefined;
1303
+ rawEvent?: any;
1304
+ }, {
1305
+ type: EventType.TEXT_MESSAGE_CONTENT;
1306
+ messageId: string;
1307
+ delta: string;
1308
+ timestamp?: number | undefined;
1309
+ rawEvent?: any;
1310
+ }>, z.ZodObject<z.objectUtil.extendShape<{
1311
+ type: z.ZodNativeEnum<typeof EventType>;
1312
+ timestamp: z.ZodOptional<z.ZodNumber>;
1313
+ rawEvent: z.ZodOptional<z.ZodAny>;
1314
+ }, {
1315
+ type: z.ZodLiteral<EventType.TEXT_MESSAGE_END>;
1316
+ messageId: z.ZodString;
1317
+ }>, "strip", z.ZodTypeAny, {
1318
+ type: EventType.TEXT_MESSAGE_END;
1319
+ messageId: string;
1320
+ timestamp?: number | undefined;
1321
+ rawEvent?: any;
1322
+ }, {
1323
+ type: EventType.TEXT_MESSAGE_END;
1324
+ messageId: string;
1325
+ timestamp?: number | undefined;
1326
+ rawEvent?: any;
1327
+ }>, z.ZodObject<z.objectUtil.extendShape<{
1328
+ type: z.ZodNativeEnum<typeof EventType>;
1329
+ timestamp: z.ZodOptional<z.ZodNumber>;
1330
+ rawEvent: z.ZodOptional<z.ZodAny>;
1331
+ }, {
1332
+ type: z.ZodLiteral<EventType.TOOL_CALL_START>;
1333
+ toolCallId: z.ZodString;
1334
+ toolCallName: z.ZodString;
1335
+ parentMessageId: z.ZodOptional<z.ZodString>;
1336
+ }>, "strip", z.ZodTypeAny, {
1337
+ type: EventType.TOOL_CALL_START;
1338
+ toolCallId: string;
1339
+ toolCallName: string;
1340
+ timestamp?: number | undefined;
1341
+ rawEvent?: any;
1342
+ parentMessageId?: string | undefined;
1343
+ }, {
1344
+ type: EventType.TOOL_CALL_START;
1345
+ toolCallId: string;
1346
+ toolCallName: string;
1347
+ timestamp?: number | undefined;
1348
+ rawEvent?: any;
1349
+ parentMessageId?: string | undefined;
1350
+ }>, z.ZodObject<z.objectUtil.extendShape<{
1351
+ type: z.ZodNativeEnum<typeof EventType>;
1352
+ timestamp: z.ZodOptional<z.ZodNumber>;
1353
+ rawEvent: z.ZodOptional<z.ZodAny>;
1354
+ }, {
1355
+ type: z.ZodLiteral<EventType.TOOL_CALL_ARGS>;
1356
+ toolCallId: z.ZodString;
1357
+ delta: z.ZodString;
1358
+ }>, "strip", z.ZodTypeAny, {
1359
+ type: EventType.TOOL_CALL_ARGS;
1360
+ toolCallId: string;
1361
+ delta: string;
1362
+ timestamp?: number | undefined;
1363
+ rawEvent?: any;
1364
+ }, {
1365
+ type: EventType.TOOL_CALL_ARGS;
1366
+ toolCallId: string;
1367
+ delta: string;
1368
+ timestamp?: number | undefined;
1369
+ rawEvent?: any;
1370
+ }>, z.ZodObject<z.objectUtil.extendShape<{
1371
+ type: z.ZodNativeEnum<typeof EventType>;
1372
+ timestamp: z.ZodOptional<z.ZodNumber>;
1373
+ rawEvent: z.ZodOptional<z.ZodAny>;
1374
+ }, {
1375
+ type: z.ZodLiteral<EventType.TOOL_CALL_END>;
1376
+ toolCallId: z.ZodString;
1377
+ }>, "strip", z.ZodTypeAny, {
1378
+ type: EventType.TOOL_CALL_END;
1379
+ toolCallId: string;
1380
+ timestamp?: number | undefined;
1381
+ rawEvent?: any;
1382
+ }, {
1383
+ type: EventType.TOOL_CALL_END;
1384
+ toolCallId: string;
1385
+ timestamp?: number | undefined;
1386
+ rawEvent?: any;
1387
+ }>, z.ZodObject<z.objectUtil.extendShape<{
1388
+ type: z.ZodNativeEnum<typeof EventType>;
1389
+ timestamp: z.ZodOptional<z.ZodNumber>;
1390
+ rawEvent: z.ZodOptional<z.ZodAny>;
1391
+ }, {
1392
+ type: z.ZodLiteral<EventType.STATE_SNAPSHOT>;
1393
+ snapshot: z.ZodAny;
1394
+ }>, "strip", z.ZodTypeAny, {
1395
+ type: EventType.STATE_SNAPSHOT;
1396
+ timestamp?: number | undefined;
1397
+ rawEvent?: any;
1398
+ snapshot?: any;
1399
+ }, {
1400
+ type: EventType.STATE_SNAPSHOT;
1401
+ timestamp?: number | undefined;
1402
+ rawEvent?: any;
1403
+ snapshot?: any;
1404
+ }>, z.ZodObject<z.objectUtil.extendShape<{
1405
+ type: z.ZodNativeEnum<typeof EventType>;
1406
+ timestamp: z.ZodOptional<z.ZodNumber>;
1407
+ rawEvent: z.ZodOptional<z.ZodAny>;
1408
+ }, {
1409
+ type: z.ZodLiteral<EventType.STATE_DELTA>;
1410
+ delta: z.ZodArray<z.ZodAny, "many">;
1411
+ }>, "strip", z.ZodTypeAny, {
1412
+ type: EventType.STATE_DELTA;
1413
+ delta: any[];
1414
+ timestamp?: number | undefined;
1415
+ rawEvent?: any;
1416
+ }, {
1417
+ type: EventType.STATE_DELTA;
1418
+ delta: any[];
1419
+ timestamp?: number | undefined;
1420
+ rawEvent?: any;
1421
+ }>, z.ZodObject<z.objectUtil.extendShape<{
1422
+ type: z.ZodNativeEnum<typeof EventType>;
1423
+ timestamp: z.ZodOptional<z.ZodNumber>;
1424
+ rawEvent: z.ZodOptional<z.ZodAny>;
1425
+ }, {
1426
+ type: z.ZodLiteral<EventType.MESSAGES_SNAPSHOT>;
1427
+ messages: z.ZodArray<z.ZodDiscriminatedUnion<"role", [z.ZodObject<z.objectUtil.extendShape<{
1428
+ id: z.ZodString;
1429
+ role: z.ZodString;
1430
+ content: z.ZodOptional<z.ZodString>;
1431
+ name: z.ZodOptional<z.ZodString>;
1432
+ }, {
1433
+ role: z.ZodLiteral<"developer">;
1434
+ content: z.ZodString;
1435
+ }>, "strip", z.ZodTypeAny, {
1436
+ id: string;
1437
+ role: "developer";
1438
+ content: string;
1439
+ name?: string | undefined;
1440
+ }, {
1441
+ id: string;
1442
+ role: "developer";
1443
+ content: string;
1444
+ name?: string | undefined;
1445
+ }>, z.ZodObject<z.objectUtil.extendShape<{
1446
+ id: z.ZodString;
1447
+ role: z.ZodString;
1448
+ content: z.ZodOptional<z.ZodString>;
1449
+ name: z.ZodOptional<z.ZodString>;
1450
+ }, {
1451
+ role: z.ZodLiteral<"system">;
1452
+ content: z.ZodString;
1453
+ }>, "strip", z.ZodTypeAny, {
1454
+ id: string;
1455
+ role: "system";
1456
+ content: string;
1457
+ name?: string | undefined;
1458
+ }, {
1459
+ id: string;
1460
+ role: "system";
1461
+ content: string;
1462
+ name?: string | undefined;
1463
+ }>, z.ZodObject<z.objectUtil.extendShape<{
1464
+ id: z.ZodString;
1465
+ role: z.ZodString;
1466
+ content: z.ZodOptional<z.ZodString>;
1467
+ name: z.ZodOptional<z.ZodString>;
1468
+ }, {
1469
+ role: z.ZodLiteral<"assistant">;
1470
+ content: z.ZodOptional<z.ZodString>;
1471
+ toolCalls: z.ZodOptional<z.ZodArray<z.ZodObject<{
1472
+ id: z.ZodString;
1473
+ type: z.ZodLiteral<"function">;
1474
+ function: z.ZodObject<{
1475
+ name: z.ZodString;
1476
+ arguments: z.ZodString;
1477
+ }, "strip", z.ZodTypeAny, {
1478
+ name: string;
1479
+ arguments: string;
1480
+ }, {
1481
+ name: string;
1482
+ arguments: string;
1483
+ }>;
1484
+ }, "strip", z.ZodTypeAny, {
1485
+ function: {
1486
+ name: string;
1487
+ arguments: string;
1488
+ };
1489
+ type: "function";
1490
+ id: string;
1491
+ }, {
1492
+ function: {
1493
+ name: string;
1494
+ arguments: string;
1495
+ };
1496
+ type: "function";
1497
+ id: string;
1498
+ }>, "many">>;
1499
+ }>, "strip", z.ZodTypeAny, {
1500
+ id: string;
1501
+ role: "assistant";
1502
+ name?: string | undefined;
1503
+ content?: string | undefined;
1504
+ toolCalls?: {
1505
+ function: {
1506
+ name: string;
1507
+ arguments: string;
1508
+ };
1509
+ type: "function";
1510
+ id: string;
1511
+ }[] | undefined;
1512
+ }, {
1513
+ id: string;
1514
+ role: "assistant";
1515
+ name?: string | undefined;
1516
+ content?: string | undefined;
1517
+ toolCalls?: {
1518
+ function: {
1519
+ name: string;
1520
+ arguments: string;
1521
+ };
1522
+ type: "function";
1523
+ id: string;
1524
+ }[] | undefined;
1525
+ }>, z.ZodObject<z.objectUtil.extendShape<{
1526
+ id: z.ZodString;
1527
+ role: z.ZodString;
1528
+ content: z.ZodOptional<z.ZodString>;
1529
+ name: z.ZodOptional<z.ZodString>;
1530
+ }, {
1531
+ role: z.ZodLiteral<"user">;
1532
+ content: z.ZodString;
1533
+ }>, "strip", z.ZodTypeAny, {
1534
+ id: string;
1535
+ role: "user";
1536
+ content: string;
1537
+ name?: string | undefined;
1538
+ }, {
1539
+ id: string;
1540
+ role: "user";
1541
+ content: string;
1542
+ name?: string | undefined;
1543
+ }>, z.ZodObject<{
1544
+ id: z.ZodString;
1545
+ content: z.ZodString;
1546
+ role: z.ZodLiteral<"tool">;
1547
+ toolCallId: z.ZodString;
1548
+ }, "strip", z.ZodTypeAny, {
1549
+ id: string;
1550
+ role: "tool";
1551
+ content: string;
1552
+ toolCallId: string;
1553
+ }, {
1554
+ id: string;
1555
+ role: "tool";
1556
+ content: string;
1557
+ toolCallId: string;
1558
+ }>]>, "many">;
1559
+ }>, "strip", z.ZodTypeAny, {
1560
+ type: EventType.MESSAGES_SNAPSHOT;
1561
+ messages: ({
1562
+ id: string;
1563
+ role: "developer";
1564
+ content: string;
1565
+ name?: string | undefined;
1566
+ } | {
1567
+ id: string;
1568
+ role: "system";
1569
+ content: string;
1570
+ name?: string | undefined;
1571
+ } | {
1572
+ id: string;
1573
+ role: "assistant";
1574
+ name?: string | undefined;
1575
+ content?: string | undefined;
1576
+ toolCalls?: {
1577
+ function: {
1578
+ name: string;
1579
+ arguments: string;
1580
+ };
1581
+ type: "function";
1582
+ id: string;
1583
+ }[] | undefined;
1584
+ } | {
1585
+ id: string;
1586
+ role: "user";
1587
+ content: string;
1588
+ name?: string | undefined;
1589
+ } | {
1590
+ id: string;
1591
+ role: "tool";
1592
+ content: string;
1593
+ toolCallId: string;
1594
+ })[];
1595
+ timestamp?: number | undefined;
1596
+ rawEvent?: any;
1597
+ }, {
1598
+ type: EventType.MESSAGES_SNAPSHOT;
1599
+ messages: ({
1600
+ id: string;
1601
+ role: "developer";
1602
+ content: string;
1603
+ name?: string | undefined;
1604
+ } | {
1605
+ id: string;
1606
+ role: "system";
1607
+ content: string;
1608
+ name?: string | undefined;
1609
+ } | {
1610
+ id: string;
1611
+ role: "assistant";
1612
+ name?: string | undefined;
1613
+ content?: string | undefined;
1614
+ toolCalls?: {
1615
+ function: {
1616
+ name: string;
1617
+ arguments: string;
1618
+ };
1619
+ type: "function";
1620
+ id: string;
1621
+ }[] | undefined;
1622
+ } | {
1623
+ id: string;
1624
+ role: "user";
1625
+ content: string;
1626
+ name?: string | undefined;
1627
+ } | {
1628
+ id: string;
1629
+ role: "tool";
1630
+ content: string;
1631
+ toolCallId: string;
1632
+ })[];
1633
+ timestamp?: number | undefined;
1634
+ rawEvent?: any;
1635
+ }>, z.ZodObject<z.objectUtil.extendShape<{
1636
+ type: z.ZodNativeEnum<typeof EventType>;
1637
+ timestamp: z.ZodOptional<z.ZodNumber>;
1638
+ rawEvent: z.ZodOptional<z.ZodAny>;
1639
+ }, {
1640
+ type: z.ZodLiteral<EventType.RAW>;
1641
+ event: z.ZodAny;
1642
+ source: z.ZodOptional<z.ZodString>;
1643
+ }>, "strip", z.ZodTypeAny, {
1644
+ type: EventType.RAW;
1645
+ timestamp?: number | undefined;
1646
+ rawEvent?: any;
1647
+ event?: any;
1648
+ source?: string | undefined;
1649
+ }, {
1650
+ type: EventType.RAW;
1651
+ timestamp?: number | undefined;
1652
+ rawEvent?: any;
1653
+ event?: any;
1654
+ source?: string | undefined;
1655
+ }>, z.ZodObject<z.objectUtil.extendShape<{
1656
+ type: z.ZodNativeEnum<typeof EventType>;
1657
+ timestamp: z.ZodOptional<z.ZodNumber>;
1658
+ rawEvent: z.ZodOptional<z.ZodAny>;
1659
+ }, {
1660
+ type: z.ZodLiteral<EventType.CUSTOM>;
1661
+ name: z.ZodString;
1662
+ value: z.ZodAny;
1663
+ }>, "strip", z.ZodTypeAny, {
1664
+ name: string;
1665
+ type: EventType.CUSTOM;
1666
+ value?: any;
1667
+ timestamp?: number | undefined;
1668
+ rawEvent?: any;
1669
+ }, {
1670
+ name: string;
1671
+ type: EventType.CUSTOM;
1672
+ value?: any;
1673
+ timestamp?: number | undefined;
1674
+ rawEvent?: any;
1675
+ }>, z.ZodObject<z.objectUtil.extendShape<{
1676
+ type: z.ZodNativeEnum<typeof EventType>;
1677
+ timestamp: z.ZodOptional<z.ZodNumber>;
1678
+ rawEvent: z.ZodOptional<z.ZodAny>;
1679
+ }, {
1680
+ type: z.ZodLiteral<EventType.RUN_STARTED>;
1681
+ threadId: z.ZodString;
1682
+ runId: z.ZodString;
1683
+ }>, "strip", z.ZodTypeAny, {
1684
+ type: EventType.RUN_STARTED;
1685
+ threadId: string;
1686
+ runId: string;
1687
+ timestamp?: number | undefined;
1688
+ rawEvent?: any;
1689
+ }, {
1690
+ type: EventType.RUN_STARTED;
1691
+ threadId: string;
1692
+ runId: string;
1693
+ timestamp?: number | undefined;
1694
+ rawEvent?: any;
1695
+ }>, z.ZodObject<z.objectUtil.extendShape<{
1696
+ type: z.ZodNativeEnum<typeof EventType>;
1697
+ timestamp: z.ZodOptional<z.ZodNumber>;
1698
+ rawEvent: z.ZodOptional<z.ZodAny>;
1699
+ }, {
1700
+ type: z.ZodLiteral<EventType.RUN_FINISHED>;
1701
+ threadId: z.ZodString;
1702
+ runId: z.ZodString;
1703
+ }>, "strip", z.ZodTypeAny, {
1704
+ type: EventType.RUN_FINISHED;
1705
+ threadId: string;
1706
+ runId: string;
1707
+ timestamp?: number | undefined;
1708
+ rawEvent?: any;
1709
+ }, {
1710
+ type: EventType.RUN_FINISHED;
1711
+ threadId: string;
1712
+ runId: string;
1713
+ timestamp?: number | undefined;
1714
+ rawEvent?: any;
1715
+ }>, z.ZodObject<z.objectUtil.extendShape<{
1716
+ type: z.ZodNativeEnum<typeof EventType>;
1717
+ timestamp: z.ZodOptional<z.ZodNumber>;
1718
+ rawEvent: z.ZodOptional<z.ZodAny>;
1719
+ }, {
1720
+ type: z.ZodLiteral<EventType.RUN_ERROR>;
1721
+ message: z.ZodString;
1722
+ code: z.ZodOptional<z.ZodString>;
1723
+ }>, "strip", z.ZodTypeAny, {
1724
+ message: string;
1725
+ type: EventType.RUN_ERROR;
1726
+ code?: string | undefined;
1727
+ timestamp?: number | undefined;
1728
+ rawEvent?: any;
1729
+ }, {
1730
+ message: string;
1731
+ type: EventType.RUN_ERROR;
1732
+ code?: string | undefined;
1733
+ timestamp?: number | undefined;
1734
+ rawEvent?: any;
1735
+ }>, z.ZodObject<z.objectUtil.extendShape<{
1736
+ type: z.ZodNativeEnum<typeof EventType>;
1737
+ timestamp: z.ZodOptional<z.ZodNumber>;
1738
+ rawEvent: z.ZodOptional<z.ZodAny>;
1739
+ }, {
1740
+ type: z.ZodLiteral<EventType.STEP_STARTED>;
1741
+ stepName: z.ZodString;
1742
+ }>, "strip", z.ZodTypeAny, {
1743
+ type: EventType.STEP_STARTED;
1744
+ stepName: string;
1745
+ timestamp?: number | undefined;
1746
+ rawEvent?: any;
1747
+ }, {
1748
+ type: EventType.STEP_STARTED;
1749
+ stepName: string;
1750
+ timestamp?: number | undefined;
1751
+ rawEvent?: any;
1752
+ }>, z.ZodObject<z.objectUtil.extendShape<{
1753
+ type: z.ZodNativeEnum<typeof EventType>;
1754
+ timestamp: z.ZodOptional<z.ZodNumber>;
1755
+ rawEvent: z.ZodOptional<z.ZodAny>;
1756
+ }, {
1757
+ type: z.ZodLiteral<EventType.STEP_FINISHED>;
1758
+ stepName: z.ZodString;
1759
+ }>, "strip", z.ZodTypeAny, {
1760
+ type: EventType.STEP_FINISHED;
1761
+ stepName: string;
1762
+ timestamp?: number | undefined;
1763
+ rawEvent?: any;
1764
+ }, {
1765
+ type: EventType.STEP_FINISHED;
1766
+ stepName: string;
1767
+ timestamp?: number | undefined;
1768
+ rawEvent?: any;
1769
+ }>]>;
1770
+ type BaseEvent = z.infer<typeof BaseEventSchema>;
1771
+ type TextMessageStartEvent = z.infer<typeof TextMessageStartEventSchema>;
1772
+ type TextMessageContentEvent = z.infer<typeof TextMessageContentEventSchema>;
1773
+ type TextMessageEndEvent = z.infer<typeof TextMessageEndEventSchema>;
1774
+ type ToolCallStartEvent = z.infer<typeof ToolCallStartEventSchema>;
1775
+ type ToolCallArgsEvent = z.infer<typeof ToolCallArgsEventSchema>;
1776
+ type ToolCallEndEvent = z.infer<typeof ToolCallEndEventSchema>;
1777
+ type StateSnapshotEvent = z.infer<typeof StateSnapshotEventSchema>;
1778
+ type StateDeltaEvent = z.infer<typeof StateDeltaEventSchema>;
1779
+ type MessagesSnapshotEvent = z.infer<typeof MessagesSnapshotEventSchema>;
1780
+ type RawEvent = z.infer<typeof RawEventSchema>;
1781
+ type CustomEvent = z.infer<typeof CustomEventSchema>;
1782
+ type RunStartedEvent = z.infer<typeof RunStartedEventSchema>;
1783
+ type RunFinishedEvent = z.infer<typeof RunFinishedEventSchema>;
1784
+ type RunErrorEvent = z.infer<typeof RunErrorEventSchema>;
1785
+ type StepStartedEvent = z.infer<typeof StepStartedEventSchema>;
1786
+ type StepFinishedEvent = z.infer<typeof StepFinishedEventSchema>;
1787
+
1788
+ /**
1789
+ * Function type for agent runners that process input and return a stream of results.
1790
+ */
1791
+ type RunAgent = (input: RunAgentInput) => Observable<BaseEvent>;
1792
+ /**
1793
+ * The transformed state of an agent.
1794
+ */
1795
+ interface AgentState {
1796
+ messages?: Message[];
1797
+ state?: State;
1798
+ }
1799
+ /**
1800
+ * Maps a stream of BaseEvent objects to a stream of AgentState objects.
1801
+ * @returns A function that transforms an Observable<BaseEvent> into an Observable<TransformedState>
1802
+ */
1803
+ type ApplyEvents = (input: RunAgentInput, events$: Observable<BaseEvent>) => Observable<AgentState>;
1804
+
1805
+ export { AGUIError, type AgentState, type ApplyEvents, type AssistantMessage, AssistantMessageSchema, type BaseEvent, BaseMessageSchema, type Context, ContextSchema, type CustomEvent, CustomEventSchema, type DeveloperMessage, DeveloperMessageSchema, EventSchemas, EventType, type FunctionCall, FunctionCallSchema, type Message, MessageSchema, type MessagesSnapshotEvent, MessagesSnapshotEventSchema, type RawEvent, RawEventSchema, type Role, RoleSchema, type RunAgent, type RunAgentInput, RunAgentInputSchema, type RunErrorEvent, RunErrorEventSchema, RunErrorSchema, type RunFinishedEvent, RunFinishedEventSchema, RunFinishedSchema, type RunStartedEvent, RunStartedEventSchema, RunStartedSchema, type State, type StateDeltaEvent, StateDeltaEventSchema, StateSchema, type StateSnapshotEvent, StateSnapshotEventSchema, type StepFinishedEvent, StepFinishedEventSchema, StepFinishedSchema, type StepStartedEvent, StepStartedEventSchema, StepStartedSchema, type SystemMessage, SystemMessageSchema, type TextMessageContentEvent, TextMessageContentEventSchema, type TextMessageEndEvent, TextMessageEndEventSchema, type TextMessageStartEvent, TextMessageStartEventSchema, type Tool, type ToolCall, type ToolCallArgsEvent, ToolCallArgsEventSchema, type ToolCallEndEvent, ToolCallEndEventSchema, ToolCallSchema, type ToolCallStartEvent, ToolCallStartEventSchema, type ToolMessage, ToolMessageSchema, ToolSchema, type UserMessage, UserMessageSchema };