@aerograph/contracts 0.1.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,4347 @@
1
+ import { z } from "zod";
2
+ export declare const traceEventKindSchema: z.ZodEnum<["prompt", "response", "tool_call", "tool_result", "handoff", "error", "note", "state_snapshot", "retriever", "checkpoint"]>;
3
+ export type TraceEventKind = z.infer<typeof traceEventKindSchema>;
4
+ export declare const traceEventStatusSchema: z.ZodEnum<["ok", "error"]>;
5
+ export type TraceEventStatus = z.infer<typeof traceEventStatusSchema>;
6
+ export declare const traceEventSchemaVersion: "1.0.0";
7
+ export declare const traceEventSchema: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
8
+ schemaVersion: z.ZodLiteral<"1.0.0">;
9
+ traceId: z.ZodString;
10
+ spanId: z.ZodString;
11
+ parentSpanId: z.ZodNullable<z.ZodString>;
12
+ occurredAt: z.ZodString;
13
+ status: z.ZodEnum<["ok", "error"]>;
14
+ title: z.ZodOptional<z.ZodString>;
15
+ links: z.ZodDefault<z.ZodArray<z.ZodObject<{
16
+ rel: z.ZodEnum<["follows", "caused_by", "handoff_to"]>;
17
+ spanId: z.ZodString;
18
+ }, "strip", z.ZodTypeAny, {
19
+ spanId: string;
20
+ rel: "follows" | "caused_by" | "handoff_to";
21
+ }, {
22
+ spanId: string;
23
+ rel: "follows" | "caused_by" | "handoff_to";
24
+ }>, "many">>;
25
+ } & {
26
+ kind: z.ZodLiteral<"prompt">;
27
+ actor: z.ZodObject<{
28
+ id: z.ZodString;
29
+ name: z.ZodOptional<z.ZodString>;
30
+ } & {
31
+ kind: z.ZodLiteral<"agent">;
32
+ }, "strip", z.ZodTypeAny, {
33
+ kind: "agent";
34
+ id: string;
35
+ name?: string | undefined;
36
+ }, {
37
+ kind: "agent";
38
+ id: string;
39
+ name?: string | undefined;
40
+ }>;
41
+ payload: z.ZodObject<{
42
+ text: z.ZodString;
43
+ }, "strip", z.ZodTypeAny, {
44
+ text: string;
45
+ }, {
46
+ text: string;
47
+ }>;
48
+ }, "strip", z.ZodTypeAny, {
49
+ status: "error" | "ok";
50
+ kind: "prompt";
51
+ schemaVersion: "1.0.0";
52
+ traceId: string;
53
+ spanId: string;
54
+ parentSpanId: string | null;
55
+ occurredAt: string;
56
+ actor: {
57
+ kind: "agent";
58
+ id: string;
59
+ name?: string | undefined;
60
+ };
61
+ links: {
62
+ spanId: string;
63
+ rel: "follows" | "caused_by" | "handoff_to";
64
+ }[];
65
+ payload: {
66
+ text: string;
67
+ };
68
+ title?: string | undefined;
69
+ }, {
70
+ status: "error" | "ok";
71
+ kind: "prompt";
72
+ schemaVersion: "1.0.0";
73
+ traceId: string;
74
+ spanId: string;
75
+ parentSpanId: string | null;
76
+ occurredAt: string;
77
+ actor: {
78
+ kind: "agent";
79
+ id: string;
80
+ name?: string | undefined;
81
+ };
82
+ payload: {
83
+ text: string;
84
+ };
85
+ title?: string | undefined;
86
+ links?: {
87
+ spanId: string;
88
+ rel: "follows" | "caused_by" | "handoff_to";
89
+ }[] | undefined;
90
+ }>, z.ZodObject<{
91
+ schemaVersion: z.ZodLiteral<"1.0.0">;
92
+ traceId: z.ZodString;
93
+ spanId: z.ZodString;
94
+ parentSpanId: z.ZodNullable<z.ZodString>;
95
+ occurredAt: z.ZodString;
96
+ status: z.ZodEnum<["ok", "error"]>;
97
+ title: z.ZodOptional<z.ZodString>;
98
+ links: z.ZodDefault<z.ZodArray<z.ZodObject<{
99
+ rel: z.ZodEnum<["follows", "caused_by", "handoff_to"]>;
100
+ spanId: z.ZodString;
101
+ }, "strip", z.ZodTypeAny, {
102
+ spanId: string;
103
+ rel: "follows" | "caused_by" | "handoff_to";
104
+ }, {
105
+ spanId: string;
106
+ rel: "follows" | "caused_by" | "handoff_to";
107
+ }>, "many">>;
108
+ } & {
109
+ kind: z.ZodLiteral<"response">;
110
+ actor: z.ZodObject<{
111
+ id: z.ZodString;
112
+ name: z.ZodOptional<z.ZodString>;
113
+ } & {
114
+ kind: z.ZodLiteral<"agent">;
115
+ }, "strip", z.ZodTypeAny, {
116
+ kind: "agent";
117
+ id: string;
118
+ name?: string | undefined;
119
+ }, {
120
+ kind: "agent";
121
+ id: string;
122
+ name?: string | undefined;
123
+ }>;
124
+ payload: z.ZodObject<{
125
+ text: z.ZodString;
126
+ streamingTelemetry: z.ZodOptional<z.ZodObject<{
127
+ timeToFirstTokenMs: z.ZodNumber;
128
+ totalDurationMs: z.ZodNumber;
129
+ tokensPerSecond: z.ZodNumber;
130
+ tokenCount: z.ZodNumber;
131
+ }, "strip", z.ZodTypeAny, {
132
+ timeToFirstTokenMs: number;
133
+ totalDurationMs: number;
134
+ tokensPerSecond: number;
135
+ tokenCount: number;
136
+ }, {
137
+ timeToFirstTokenMs: number;
138
+ totalDurationMs: number;
139
+ tokensPerSecond: number;
140
+ tokenCount: number;
141
+ }>>;
142
+ }, "strip", z.ZodTypeAny, {
143
+ text: string;
144
+ streamingTelemetry?: {
145
+ timeToFirstTokenMs: number;
146
+ totalDurationMs: number;
147
+ tokensPerSecond: number;
148
+ tokenCount: number;
149
+ } | undefined;
150
+ }, {
151
+ text: string;
152
+ streamingTelemetry?: {
153
+ timeToFirstTokenMs: number;
154
+ totalDurationMs: number;
155
+ tokensPerSecond: number;
156
+ tokenCount: number;
157
+ } | undefined;
158
+ }>;
159
+ }, "strip", z.ZodTypeAny, {
160
+ status: "error" | "ok";
161
+ kind: "response";
162
+ schemaVersion: "1.0.0";
163
+ traceId: string;
164
+ spanId: string;
165
+ parentSpanId: string | null;
166
+ occurredAt: string;
167
+ actor: {
168
+ kind: "agent";
169
+ id: string;
170
+ name?: string | undefined;
171
+ };
172
+ links: {
173
+ spanId: string;
174
+ rel: "follows" | "caused_by" | "handoff_to";
175
+ }[];
176
+ payload: {
177
+ text: string;
178
+ streamingTelemetry?: {
179
+ timeToFirstTokenMs: number;
180
+ totalDurationMs: number;
181
+ tokensPerSecond: number;
182
+ tokenCount: number;
183
+ } | undefined;
184
+ };
185
+ title?: string | undefined;
186
+ }, {
187
+ status: "error" | "ok";
188
+ kind: "response";
189
+ schemaVersion: "1.0.0";
190
+ traceId: string;
191
+ spanId: string;
192
+ parentSpanId: string | null;
193
+ occurredAt: string;
194
+ actor: {
195
+ kind: "agent";
196
+ id: string;
197
+ name?: string | undefined;
198
+ };
199
+ payload: {
200
+ text: string;
201
+ streamingTelemetry?: {
202
+ timeToFirstTokenMs: number;
203
+ totalDurationMs: number;
204
+ tokensPerSecond: number;
205
+ tokenCount: number;
206
+ } | undefined;
207
+ };
208
+ title?: string | undefined;
209
+ links?: {
210
+ spanId: string;
211
+ rel: "follows" | "caused_by" | "handoff_to";
212
+ }[] | undefined;
213
+ }>, z.ZodObject<{
214
+ schemaVersion: z.ZodLiteral<"1.0.0">;
215
+ traceId: z.ZodString;
216
+ spanId: z.ZodString;
217
+ parentSpanId: z.ZodNullable<z.ZodString>;
218
+ occurredAt: z.ZodString;
219
+ status: z.ZodEnum<["ok", "error"]>;
220
+ title: z.ZodOptional<z.ZodString>;
221
+ links: z.ZodDefault<z.ZodArray<z.ZodObject<{
222
+ rel: z.ZodEnum<["follows", "caused_by", "handoff_to"]>;
223
+ spanId: z.ZodString;
224
+ }, "strip", z.ZodTypeAny, {
225
+ spanId: string;
226
+ rel: "follows" | "caused_by" | "handoff_to";
227
+ }, {
228
+ spanId: string;
229
+ rel: "follows" | "caused_by" | "handoff_to";
230
+ }>, "many">>;
231
+ } & {
232
+ kind: z.ZodLiteral<"tool_call">;
233
+ actor: z.ZodObject<{
234
+ id: z.ZodString;
235
+ name: z.ZodOptional<z.ZodString>;
236
+ } & {
237
+ kind: z.ZodLiteral<"tool">;
238
+ }, "strip", z.ZodTypeAny, {
239
+ kind: "tool";
240
+ id: string;
241
+ name?: string | undefined;
242
+ }, {
243
+ kind: "tool";
244
+ id: string;
245
+ name?: string | undefined;
246
+ }>;
247
+ payload: z.ZodObject<{
248
+ input: z.ZodRecord<z.ZodString, z.ZodUnknown>;
249
+ }, "strip", z.ZodTypeAny, {
250
+ input: Record<string, unknown>;
251
+ }, {
252
+ input: Record<string, unknown>;
253
+ }>;
254
+ }, "strip", z.ZodTypeAny, {
255
+ status: "error" | "ok";
256
+ kind: "tool_call";
257
+ schemaVersion: "1.0.0";
258
+ traceId: string;
259
+ spanId: string;
260
+ parentSpanId: string | null;
261
+ occurredAt: string;
262
+ actor: {
263
+ kind: "tool";
264
+ id: string;
265
+ name?: string | undefined;
266
+ };
267
+ links: {
268
+ spanId: string;
269
+ rel: "follows" | "caused_by" | "handoff_to";
270
+ }[];
271
+ payload: {
272
+ input: Record<string, unknown>;
273
+ };
274
+ title?: string | undefined;
275
+ }, {
276
+ status: "error" | "ok";
277
+ kind: "tool_call";
278
+ schemaVersion: "1.0.0";
279
+ traceId: string;
280
+ spanId: string;
281
+ parentSpanId: string | null;
282
+ occurredAt: string;
283
+ actor: {
284
+ kind: "tool";
285
+ id: string;
286
+ name?: string | undefined;
287
+ };
288
+ payload: {
289
+ input: Record<string, unknown>;
290
+ };
291
+ title?: string | undefined;
292
+ links?: {
293
+ spanId: string;
294
+ rel: "follows" | "caused_by" | "handoff_to";
295
+ }[] | undefined;
296
+ }>, z.ZodObject<{
297
+ schemaVersion: z.ZodLiteral<"1.0.0">;
298
+ traceId: z.ZodString;
299
+ spanId: z.ZodString;
300
+ parentSpanId: z.ZodNullable<z.ZodString>;
301
+ occurredAt: z.ZodString;
302
+ status: z.ZodEnum<["ok", "error"]>;
303
+ title: z.ZodOptional<z.ZodString>;
304
+ links: z.ZodDefault<z.ZodArray<z.ZodObject<{
305
+ rel: z.ZodEnum<["follows", "caused_by", "handoff_to"]>;
306
+ spanId: z.ZodString;
307
+ }, "strip", z.ZodTypeAny, {
308
+ spanId: string;
309
+ rel: "follows" | "caused_by" | "handoff_to";
310
+ }, {
311
+ spanId: string;
312
+ rel: "follows" | "caused_by" | "handoff_to";
313
+ }>, "many">>;
314
+ } & {
315
+ kind: z.ZodLiteral<"tool_result">;
316
+ actor: z.ZodObject<{
317
+ id: z.ZodString;
318
+ name: z.ZodOptional<z.ZodString>;
319
+ } & {
320
+ kind: z.ZodLiteral<"tool">;
321
+ }, "strip", z.ZodTypeAny, {
322
+ kind: "tool";
323
+ id: string;
324
+ name?: string | undefined;
325
+ }, {
326
+ kind: "tool";
327
+ id: string;
328
+ name?: string | undefined;
329
+ }>;
330
+ payload: z.ZodObject<{
331
+ output: z.ZodRecord<z.ZodString, z.ZodUnknown>;
332
+ }, "strip", z.ZodTypeAny, {
333
+ output: Record<string, unknown>;
334
+ }, {
335
+ output: Record<string, unknown>;
336
+ }>;
337
+ }, "strip", z.ZodTypeAny, {
338
+ status: "error" | "ok";
339
+ kind: "tool_result";
340
+ schemaVersion: "1.0.0";
341
+ traceId: string;
342
+ spanId: string;
343
+ parentSpanId: string | null;
344
+ occurredAt: string;
345
+ actor: {
346
+ kind: "tool";
347
+ id: string;
348
+ name?: string | undefined;
349
+ };
350
+ links: {
351
+ spanId: string;
352
+ rel: "follows" | "caused_by" | "handoff_to";
353
+ }[];
354
+ payload: {
355
+ output: Record<string, unknown>;
356
+ };
357
+ title?: string | undefined;
358
+ }, {
359
+ status: "error" | "ok";
360
+ kind: "tool_result";
361
+ schemaVersion: "1.0.0";
362
+ traceId: string;
363
+ spanId: string;
364
+ parentSpanId: string | null;
365
+ occurredAt: string;
366
+ actor: {
367
+ kind: "tool";
368
+ id: string;
369
+ name?: string | undefined;
370
+ };
371
+ payload: {
372
+ output: Record<string, unknown>;
373
+ };
374
+ title?: string | undefined;
375
+ links?: {
376
+ spanId: string;
377
+ rel: "follows" | "caused_by" | "handoff_to";
378
+ }[] | undefined;
379
+ }>, z.ZodObject<{
380
+ schemaVersion: z.ZodLiteral<"1.0.0">;
381
+ traceId: z.ZodString;
382
+ spanId: z.ZodString;
383
+ parentSpanId: z.ZodNullable<z.ZodString>;
384
+ occurredAt: z.ZodString;
385
+ status: z.ZodEnum<["ok", "error"]>;
386
+ title: z.ZodOptional<z.ZodString>;
387
+ links: z.ZodDefault<z.ZodArray<z.ZodObject<{
388
+ rel: z.ZodEnum<["follows", "caused_by", "handoff_to"]>;
389
+ spanId: z.ZodString;
390
+ }, "strip", z.ZodTypeAny, {
391
+ spanId: string;
392
+ rel: "follows" | "caused_by" | "handoff_to";
393
+ }, {
394
+ spanId: string;
395
+ rel: "follows" | "caused_by" | "handoff_to";
396
+ }>, "many">>;
397
+ } & {
398
+ kind: z.ZodLiteral<"handoff">;
399
+ actor: z.ZodObject<{
400
+ id: z.ZodString;
401
+ name: z.ZodOptional<z.ZodString>;
402
+ } & {
403
+ kind: z.ZodLiteral<"system">;
404
+ }, "strip", z.ZodTypeAny, {
405
+ kind: "system";
406
+ id: string;
407
+ name?: string | undefined;
408
+ }, {
409
+ kind: "system";
410
+ id: string;
411
+ name?: string | undefined;
412
+ }>;
413
+ payload: z.ZodObject<{
414
+ fromAgentId: z.ZodString;
415
+ toAgentId: z.ZodString;
416
+ reason: z.ZodOptional<z.ZodString>;
417
+ }, "strip", z.ZodTypeAny, {
418
+ fromAgentId: string;
419
+ toAgentId: string;
420
+ reason?: string | undefined;
421
+ }, {
422
+ fromAgentId: string;
423
+ toAgentId: string;
424
+ reason?: string | undefined;
425
+ }>;
426
+ }, "strip", z.ZodTypeAny, {
427
+ status: "error" | "ok";
428
+ kind: "handoff";
429
+ schemaVersion: "1.0.0";
430
+ traceId: string;
431
+ spanId: string;
432
+ parentSpanId: string | null;
433
+ occurredAt: string;
434
+ actor: {
435
+ kind: "system";
436
+ id: string;
437
+ name?: string | undefined;
438
+ };
439
+ links: {
440
+ spanId: string;
441
+ rel: "follows" | "caused_by" | "handoff_to";
442
+ }[];
443
+ payload: {
444
+ fromAgentId: string;
445
+ toAgentId: string;
446
+ reason?: string | undefined;
447
+ };
448
+ title?: string | undefined;
449
+ }, {
450
+ status: "error" | "ok";
451
+ kind: "handoff";
452
+ schemaVersion: "1.0.0";
453
+ traceId: string;
454
+ spanId: string;
455
+ parentSpanId: string | null;
456
+ occurredAt: string;
457
+ actor: {
458
+ kind: "system";
459
+ id: string;
460
+ name?: string | undefined;
461
+ };
462
+ payload: {
463
+ fromAgentId: string;
464
+ toAgentId: string;
465
+ reason?: string | undefined;
466
+ };
467
+ title?: string | undefined;
468
+ links?: {
469
+ spanId: string;
470
+ rel: "follows" | "caused_by" | "handoff_to";
471
+ }[] | undefined;
472
+ }>, z.ZodObject<{
473
+ schemaVersion: z.ZodLiteral<"1.0.0">;
474
+ traceId: z.ZodString;
475
+ spanId: z.ZodString;
476
+ parentSpanId: z.ZodNullable<z.ZodString>;
477
+ occurredAt: z.ZodString;
478
+ actor: z.ZodObject<{
479
+ kind: z.ZodEnum<["agent", "tool", "system"]>;
480
+ id: z.ZodString;
481
+ name: z.ZodOptional<z.ZodString>;
482
+ }, "strip", z.ZodTypeAny, {
483
+ kind: "agent" | "tool" | "system";
484
+ id: string;
485
+ name?: string | undefined;
486
+ }, {
487
+ kind: "agent" | "tool" | "system";
488
+ id: string;
489
+ name?: string | undefined;
490
+ }>;
491
+ status: z.ZodEnum<["ok", "error"]>;
492
+ title: z.ZodOptional<z.ZodString>;
493
+ links: z.ZodDefault<z.ZodArray<z.ZodObject<{
494
+ rel: z.ZodEnum<["follows", "caused_by", "handoff_to"]>;
495
+ spanId: z.ZodString;
496
+ }, "strip", z.ZodTypeAny, {
497
+ spanId: string;
498
+ rel: "follows" | "caused_by" | "handoff_to";
499
+ }, {
500
+ spanId: string;
501
+ rel: "follows" | "caused_by" | "handoff_to";
502
+ }>, "many">>;
503
+ } & {
504
+ kind: z.ZodLiteral<"error">;
505
+ payload: z.ZodObject<{
506
+ message: z.ZodString;
507
+ details: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
508
+ }, "strip", z.ZodTypeAny, {
509
+ message: string;
510
+ details: Record<string, unknown>;
511
+ }, {
512
+ message: string;
513
+ details?: Record<string, unknown> | undefined;
514
+ }>;
515
+ }, "strip", z.ZodTypeAny, {
516
+ status: "error" | "ok";
517
+ kind: "error";
518
+ schemaVersion: "1.0.0";
519
+ traceId: string;
520
+ spanId: string;
521
+ parentSpanId: string | null;
522
+ occurredAt: string;
523
+ actor: {
524
+ kind: "agent" | "tool" | "system";
525
+ id: string;
526
+ name?: string | undefined;
527
+ };
528
+ links: {
529
+ spanId: string;
530
+ rel: "follows" | "caused_by" | "handoff_to";
531
+ }[];
532
+ payload: {
533
+ message: string;
534
+ details: Record<string, unknown>;
535
+ };
536
+ title?: string | undefined;
537
+ }, {
538
+ status: "error" | "ok";
539
+ kind: "error";
540
+ schemaVersion: "1.0.0";
541
+ traceId: string;
542
+ spanId: string;
543
+ parentSpanId: string | null;
544
+ occurredAt: string;
545
+ actor: {
546
+ kind: "agent" | "tool" | "system";
547
+ id: string;
548
+ name?: string | undefined;
549
+ };
550
+ payload: {
551
+ message: string;
552
+ details?: Record<string, unknown> | undefined;
553
+ };
554
+ title?: string | undefined;
555
+ links?: {
556
+ spanId: string;
557
+ rel: "follows" | "caused_by" | "handoff_to";
558
+ }[] | undefined;
559
+ }>, z.ZodObject<{
560
+ schemaVersion: z.ZodLiteral<"1.0.0">;
561
+ traceId: z.ZodString;
562
+ spanId: z.ZodString;
563
+ parentSpanId: z.ZodNullable<z.ZodString>;
564
+ occurredAt: z.ZodString;
565
+ actor: z.ZodObject<{
566
+ kind: z.ZodEnum<["agent", "tool", "system"]>;
567
+ id: z.ZodString;
568
+ name: z.ZodOptional<z.ZodString>;
569
+ }, "strip", z.ZodTypeAny, {
570
+ kind: "agent" | "tool" | "system";
571
+ id: string;
572
+ name?: string | undefined;
573
+ }, {
574
+ kind: "agent" | "tool" | "system";
575
+ id: string;
576
+ name?: string | undefined;
577
+ }>;
578
+ status: z.ZodEnum<["ok", "error"]>;
579
+ title: z.ZodOptional<z.ZodString>;
580
+ links: z.ZodDefault<z.ZodArray<z.ZodObject<{
581
+ rel: z.ZodEnum<["follows", "caused_by", "handoff_to"]>;
582
+ spanId: z.ZodString;
583
+ }, "strip", z.ZodTypeAny, {
584
+ spanId: string;
585
+ rel: "follows" | "caused_by" | "handoff_to";
586
+ }, {
587
+ spanId: string;
588
+ rel: "follows" | "caused_by" | "handoff_to";
589
+ }>, "many">>;
590
+ } & {
591
+ kind: z.ZodLiteral<"note">;
592
+ payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
593
+ }, "strip", z.ZodTypeAny, {
594
+ status: "error" | "ok";
595
+ kind: "note";
596
+ schemaVersion: "1.0.0";
597
+ traceId: string;
598
+ spanId: string;
599
+ parentSpanId: string | null;
600
+ occurredAt: string;
601
+ actor: {
602
+ kind: "agent" | "tool" | "system";
603
+ id: string;
604
+ name?: string | undefined;
605
+ };
606
+ links: {
607
+ spanId: string;
608
+ rel: "follows" | "caused_by" | "handoff_to";
609
+ }[];
610
+ payload: Record<string, unknown>;
611
+ title?: string | undefined;
612
+ }, {
613
+ status: "error" | "ok";
614
+ kind: "note";
615
+ schemaVersion: "1.0.0";
616
+ traceId: string;
617
+ spanId: string;
618
+ parentSpanId: string | null;
619
+ occurredAt: string;
620
+ actor: {
621
+ kind: "agent" | "tool" | "system";
622
+ id: string;
623
+ name?: string | undefined;
624
+ };
625
+ payload: Record<string, unknown>;
626
+ title?: string | undefined;
627
+ links?: {
628
+ spanId: string;
629
+ rel: "follows" | "caused_by" | "handoff_to";
630
+ }[] | undefined;
631
+ }>, z.ZodObject<{
632
+ schemaVersion: z.ZodLiteral<"1.0.0">;
633
+ traceId: z.ZodString;
634
+ spanId: z.ZodString;
635
+ parentSpanId: z.ZodNullable<z.ZodString>;
636
+ occurredAt: z.ZodString;
637
+ status: z.ZodEnum<["ok", "error"]>;
638
+ title: z.ZodOptional<z.ZodString>;
639
+ links: z.ZodDefault<z.ZodArray<z.ZodObject<{
640
+ rel: z.ZodEnum<["follows", "caused_by", "handoff_to"]>;
641
+ spanId: z.ZodString;
642
+ }, "strip", z.ZodTypeAny, {
643
+ spanId: string;
644
+ rel: "follows" | "caused_by" | "handoff_to";
645
+ }, {
646
+ spanId: string;
647
+ rel: "follows" | "caused_by" | "handoff_to";
648
+ }>, "many">>;
649
+ } & {
650
+ kind: z.ZodLiteral<"state_snapshot">;
651
+ actor: z.ZodObject<{
652
+ id: z.ZodString;
653
+ name: z.ZodOptional<z.ZodString>;
654
+ } & {
655
+ kind: z.ZodLiteral<"system">;
656
+ }, "strip", z.ZodTypeAny, {
657
+ kind: "system";
658
+ id: string;
659
+ name?: string | undefined;
660
+ }, {
661
+ kind: "system";
662
+ id: string;
663
+ name?: string | undefined;
664
+ }>;
665
+ payload: z.ZodObject<{
666
+ nodeName: z.ZodString;
667
+ stateHash: z.ZodString;
668
+ stateDiff: z.ZodRecord<z.ZodString, z.ZodUnknown>;
669
+ removedKeys: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
670
+ fullState: z.ZodRecord<z.ZodString, z.ZodUnknown>;
671
+ }, "strip", z.ZodTypeAny, {
672
+ nodeName: string;
673
+ stateHash: string;
674
+ stateDiff: Record<string, unknown>;
675
+ fullState: Record<string, unknown>;
676
+ removedKeys?: string[] | undefined;
677
+ }, {
678
+ nodeName: string;
679
+ stateHash: string;
680
+ stateDiff: Record<string, unknown>;
681
+ fullState: Record<string, unknown>;
682
+ removedKeys?: string[] | undefined;
683
+ }>;
684
+ }, "strip", z.ZodTypeAny, {
685
+ status: "error" | "ok";
686
+ kind: "state_snapshot";
687
+ schemaVersion: "1.0.0";
688
+ traceId: string;
689
+ spanId: string;
690
+ parentSpanId: string | null;
691
+ occurredAt: string;
692
+ actor: {
693
+ kind: "system";
694
+ id: string;
695
+ name?: string | undefined;
696
+ };
697
+ links: {
698
+ spanId: string;
699
+ rel: "follows" | "caused_by" | "handoff_to";
700
+ }[];
701
+ payload: {
702
+ nodeName: string;
703
+ stateHash: string;
704
+ stateDiff: Record<string, unknown>;
705
+ fullState: Record<string, unknown>;
706
+ removedKeys?: string[] | undefined;
707
+ };
708
+ title?: string | undefined;
709
+ }, {
710
+ status: "error" | "ok";
711
+ kind: "state_snapshot";
712
+ schemaVersion: "1.0.0";
713
+ traceId: string;
714
+ spanId: string;
715
+ parentSpanId: string | null;
716
+ occurredAt: string;
717
+ actor: {
718
+ kind: "system";
719
+ id: string;
720
+ name?: string | undefined;
721
+ };
722
+ payload: {
723
+ nodeName: string;
724
+ stateHash: string;
725
+ stateDiff: Record<string, unknown>;
726
+ fullState: Record<string, unknown>;
727
+ removedKeys?: string[] | undefined;
728
+ };
729
+ title?: string | undefined;
730
+ links?: {
731
+ spanId: string;
732
+ rel: "follows" | "caused_by" | "handoff_to";
733
+ }[] | undefined;
734
+ }>, z.ZodObject<{
735
+ schemaVersion: z.ZodLiteral<"1.0.0">;
736
+ traceId: z.ZodString;
737
+ spanId: z.ZodString;
738
+ parentSpanId: z.ZodNullable<z.ZodString>;
739
+ occurredAt: z.ZodString;
740
+ status: z.ZodEnum<["ok", "error"]>;
741
+ title: z.ZodOptional<z.ZodString>;
742
+ links: z.ZodDefault<z.ZodArray<z.ZodObject<{
743
+ rel: z.ZodEnum<["follows", "caused_by", "handoff_to"]>;
744
+ spanId: z.ZodString;
745
+ }, "strip", z.ZodTypeAny, {
746
+ spanId: string;
747
+ rel: "follows" | "caused_by" | "handoff_to";
748
+ }, {
749
+ spanId: string;
750
+ rel: "follows" | "caused_by" | "handoff_to";
751
+ }>, "many">>;
752
+ } & {
753
+ kind: z.ZodLiteral<"retriever">;
754
+ actor: z.ZodObject<{
755
+ id: z.ZodString;
756
+ name: z.ZodOptional<z.ZodString>;
757
+ } & {
758
+ kind: z.ZodLiteral<"tool">;
759
+ }, "strip", z.ZodTypeAny, {
760
+ kind: "tool";
761
+ id: string;
762
+ name?: string | undefined;
763
+ }, {
764
+ kind: "tool";
765
+ id: string;
766
+ name?: string | undefined;
767
+ }>;
768
+ payload: z.ZodObject<{
769
+ query: z.ZodString;
770
+ documents: z.ZodArray<z.ZodObject<{
771
+ pageContent: z.ZodString;
772
+ metadata: z.ZodRecord<z.ZodString, z.ZodUnknown>;
773
+ score: z.ZodOptional<z.ZodNumber>;
774
+ }, "strip", z.ZodTypeAny, {
775
+ pageContent: string;
776
+ metadata: Record<string, unknown>;
777
+ score?: number | undefined;
778
+ }, {
779
+ pageContent: string;
780
+ metadata: Record<string, unknown>;
781
+ score?: number | undefined;
782
+ }>, "many">;
783
+ }, "strip", z.ZodTypeAny, {
784
+ query: string;
785
+ documents: {
786
+ pageContent: string;
787
+ metadata: Record<string, unknown>;
788
+ score?: number | undefined;
789
+ }[];
790
+ }, {
791
+ query: string;
792
+ documents: {
793
+ pageContent: string;
794
+ metadata: Record<string, unknown>;
795
+ score?: number | undefined;
796
+ }[];
797
+ }>;
798
+ }, "strip", z.ZodTypeAny, {
799
+ status: "error" | "ok";
800
+ kind: "retriever";
801
+ schemaVersion: "1.0.0";
802
+ traceId: string;
803
+ spanId: string;
804
+ parentSpanId: string | null;
805
+ occurredAt: string;
806
+ actor: {
807
+ kind: "tool";
808
+ id: string;
809
+ name?: string | undefined;
810
+ };
811
+ links: {
812
+ spanId: string;
813
+ rel: "follows" | "caused_by" | "handoff_to";
814
+ }[];
815
+ payload: {
816
+ query: string;
817
+ documents: {
818
+ pageContent: string;
819
+ metadata: Record<string, unknown>;
820
+ score?: number | undefined;
821
+ }[];
822
+ };
823
+ title?: string | undefined;
824
+ }, {
825
+ status: "error" | "ok";
826
+ kind: "retriever";
827
+ schemaVersion: "1.0.0";
828
+ traceId: string;
829
+ spanId: string;
830
+ parentSpanId: string | null;
831
+ occurredAt: string;
832
+ actor: {
833
+ kind: "tool";
834
+ id: string;
835
+ name?: string | undefined;
836
+ };
837
+ payload: {
838
+ query: string;
839
+ documents: {
840
+ pageContent: string;
841
+ metadata: Record<string, unknown>;
842
+ score?: number | undefined;
843
+ }[];
844
+ };
845
+ title?: string | undefined;
846
+ links?: {
847
+ spanId: string;
848
+ rel: "follows" | "caused_by" | "handoff_to";
849
+ }[] | undefined;
850
+ }>, z.ZodObject<{
851
+ schemaVersion: z.ZodLiteral<"1.0.0">;
852
+ traceId: z.ZodString;
853
+ spanId: z.ZodString;
854
+ parentSpanId: z.ZodNullable<z.ZodString>;
855
+ occurredAt: z.ZodString;
856
+ status: z.ZodEnum<["ok", "error"]>;
857
+ title: z.ZodOptional<z.ZodString>;
858
+ links: z.ZodDefault<z.ZodArray<z.ZodObject<{
859
+ rel: z.ZodEnum<["follows", "caused_by", "handoff_to"]>;
860
+ spanId: z.ZodString;
861
+ }, "strip", z.ZodTypeAny, {
862
+ spanId: string;
863
+ rel: "follows" | "caused_by" | "handoff_to";
864
+ }, {
865
+ spanId: string;
866
+ rel: "follows" | "caused_by" | "handoff_to";
867
+ }>, "many">>;
868
+ } & {
869
+ kind: z.ZodLiteral<"checkpoint">;
870
+ actor: z.ZodObject<{
871
+ id: z.ZodString;
872
+ name: z.ZodOptional<z.ZodString>;
873
+ } & {
874
+ kind: z.ZodLiteral<"system">;
875
+ }, "strip", z.ZodTypeAny, {
876
+ kind: "system";
877
+ id: string;
878
+ name?: string | undefined;
879
+ }, {
880
+ kind: "system";
881
+ id: string;
882
+ name?: string | undefined;
883
+ }>;
884
+ payload: z.ZodObject<{
885
+ checkpointId: z.ZodString;
886
+ reason: z.ZodString;
887
+ state: z.ZodRecord<z.ZodString, z.ZodUnknown>;
888
+ }, "strip", z.ZodTypeAny, {
889
+ reason: string;
890
+ checkpointId: string;
891
+ state: Record<string, unknown>;
892
+ }, {
893
+ reason: string;
894
+ checkpointId: string;
895
+ state: Record<string, unknown>;
896
+ }>;
897
+ }, "strip", z.ZodTypeAny, {
898
+ status: "error" | "ok";
899
+ kind: "checkpoint";
900
+ schemaVersion: "1.0.0";
901
+ traceId: string;
902
+ spanId: string;
903
+ parentSpanId: string | null;
904
+ occurredAt: string;
905
+ actor: {
906
+ kind: "system";
907
+ id: string;
908
+ name?: string | undefined;
909
+ };
910
+ links: {
911
+ spanId: string;
912
+ rel: "follows" | "caused_by" | "handoff_to";
913
+ }[];
914
+ payload: {
915
+ reason: string;
916
+ checkpointId: string;
917
+ state: Record<string, unknown>;
918
+ };
919
+ title?: string | undefined;
920
+ }, {
921
+ status: "error" | "ok";
922
+ kind: "checkpoint";
923
+ schemaVersion: "1.0.0";
924
+ traceId: string;
925
+ spanId: string;
926
+ parentSpanId: string | null;
927
+ occurredAt: string;
928
+ actor: {
929
+ kind: "system";
930
+ id: string;
931
+ name?: string | undefined;
932
+ };
933
+ payload: {
934
+ reason: string;
935
+ checkpointId: string;
936
+ state: Record<string, unknown>;
937
+ };
938
+ title?: string | undefined;
939
+ links?: {
940
+ spanId: string;
941
+ rel: "follows" | "caused_by" | "handoff_to";
942
+ }[] | undefined;
943
+ }>]>;
944
+ export type TraceEvent = z.infer<typeof traceEventSchema>;
945
+ export declare const traceSchema: z.ZodObject<{
946
+ traceId: z.ZodString;
947
+ createdAt: z.ZodString;
948
+ rootSpanId: z.ZodNullable<z.ZodString>;
949
+ events: z.ZodArray<z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
950
+ schemaVersion: z.ZodLiteral<"1.0.0">;
951
+ traceId: z.ZodString;
952
+ spanId: z.ZodString;
953
+ parentSpanId: z.ZodNullable<z.ZodString>;
954
+ occurredAt: z.ZodString;
955
+ status: z.ZodEnum<["ok", "error"]>;
956
+ title: z.ZodOptional<z.ZodString>;
957
+ links: z.ZodDefault<z.ZodArray<z.ZodObject<{
958
+ rel: z.ZodEnum<["follows", "caused_by", "handoff_to"]>;
959
+ spanId: z.ZodString;
960
+ }, "strip", z.ZodTypeAny, {
961
+ spanId: string;
962
+ rel: "follows" | "caused_by" | "handoff_to";
963
+ }, {
964
+ spanId: string;
965
+ rel: "follows" | "caused_by" | "handoff_to";
966
+ }>, "many">>;
967
+ } & {
968
+ kind: z.ZodLiteral<"prompt">;
969
+ actor: z.ZodObject<{
970
+ id: z.ZodString;
971
+ name: z.ZodOptional<z.ZodString>;
972
+ } & {
973
+ kind: z.ZodLiteral<"agent">;
974
+ }, "strip", z.ZodTypeAny, {
975
+ kind: "agent";
976
+ id: string;
977
+ name?: string | undefined;
978
+ }, {
979
+ kind: "agent";
980
+ id: string;
981
+ name?: string | undefined;
982
+ }>;
983
+ payload: z.ZodObject<{
984
+ text: z.ZodString;
985
+ }, "strip", z.ZodTypeAny, {
986
+ text: string;
987
+ }, {
988
+ text: string;
989
+ }>;
990
+ }, "strip", z.ZodTypeAny, {
991
+ status: "error" | "ok";
992
+ kind: "prompt";
993
+ schemaVersion: "1.0.0";
994
+ traceId: string;
995
+ spanId: string;
996
+ parentSpanId: string | null;
997
+ occurredAt: string;
998
+ actor: {
999
+ kind: "agent";
1000
+ id: string;
1001
+ name?: string | undefined;
1002
+ };
1003
+ links: {
1004
+ spanId: string;
1005
+ rel: "follows" | "caused_by" | "handoff_to";
1006
+ }[];
1007
+ payload: {
1008
+ text: string;
1009
+ };
1010
+ title?: string | undefined;
1011
+ }, {
1012
+ status: "error" | "ok";
1013
+ kind: "prompt";
1014
+ schemaVersion: "1.0.0";
1015
+ traceId: string;
1016
+ spanId: string;
1017
+ parentSpanId: string | null;
1018
+ occurredAt: string;
1019
+ actor: {
1020
+ kind: "agent";
1021
+ id: string;
1022
+ name?: string | undefined;
1023
+ };
1024
+ payload: {
1025
+ text: string;
1026
+ };
1027
+ title?: string | undefined;
1028
+ links?: {
1029
+ spanId: string;
1030
+ rel: "follows" | "caused_by" | "handoff_to";
1031
+ }[] | undefined;
1032
+ }>, z.ZodObject<{
1033
+ schemaVersion: z.ZodLiteral<"1.0.0">;
1034
+ traceId: z.ZodString;
1035
+ spanId: z.ZodString;
1036
+ parentSpanId: z.ZodNullable<z.ZodString>;
1037
+ occurredAt: z.ZodString;
1038
+ status: z.ZodEnum<["ok", "error"]>;
1039
+ title: z.ZodOptional<z.ZodString>;
1040
+ links: z.ZodDefault<z.ZodArray<z.ZodObject<{
1041
+ rel: z.ZodEnum<["follows", "caused_by", "handoff_to"]>;
1042
+ spanId: z.ZodString;
1043
+ }, "strip", z.ZodTypeAny, {
1044
+ spanId: string;
1045
+ rel: "follows" | "caused_by" | "handoff_to";
1046
+ }, {
1047
+ spanId: string;
1048
+ rel: "follows" | "caused_by" | "handoff_to";
1049
+ }>, "many">>;
1050
+ } & {
1051
+ kind: z.ZodLiteral<"response">;
1052
+ actor: z.ZodObject<{
1053
+ id: z.ZodString;
1054
+ name: z.ZodOptional<z.ZodString>;
1055
+ } & {
1056
+ kind: z.ZodLiteral<"agent">;
1057
+ }, "strip", z.ZodTypeAny, {
1058
+ kind: "agent";
1059
+ id: string;
1060
+ name?: string | undefined;
1061
+ }, {
1062
+ kind: "agent";
1063
+ id: string;
1064
+ name?: string | undefined;
1065
+ }>;
1066
+ payload: z.ZodObject<{
1067
+ text: z.ZodString;
1068
+ streamingTelemetry: z.ZodOptional<z.ZodObject<{
1069
+ timeToFirstTokenMs: z.ZodNumber;
1070
+ totalDurationMs: z.ZodNumber;
1071
+ tokensPerSecond: z.ZodNumber;
1072
+ tokenCount: z.ZodNumber;
1073
+ }, "strip", z.ZodTypeAny, {
1074
+ timeToFirstTokenMs: number;
1075
+ totalDurationMs: number;
1076
+ tokensPerSecond: number;
1077
+ tokenCount: number;
1078
+ }, {
1079
+ timeToFirstTokenMs: number;
1080
+ totalDurationMs: number;
1081
+ tokensPerSecond: number;
1082
+ tokenCount: number;
1083
+ }>>;
1084
+ }, "strip", z.ZodTypeAny, {
1085
+ text: string;
1086
+ streamingTelemetry?: {
1087
+ timeToFirstTokenMs: number;
1088
+ totalDurationMs: number;
1089
+ tokensPerSecond: number;
1090
+ tokenCount: number;
1091
+ } | undefined;
1092
+ }, {
1093
+ text: string;
1094
+ streamingTelemetry?: {
1095
+ timeToFirstTokenMs: number;
1096
+ totalDurationMs: number;
1097
+ tokensPerSecond: number;
1098
+ tokenCount: number;
1099
+ } | undefined;
1100
+ }>;
1101
+ }, "strip", z.ZodTypeAny, {
1102
+ status: "error" | "ok";
1103
+ kind: "response";
1104
+ schemaVersion: "1.0.0";
1105
+ traceId: string;
1106
+ spanId: string;
1107
+ parentSpanId: string | null;
1108
+ occurredAt: string;
1109
+ actor: {
1110
+ kind: "agent";
1111
+ id: string;
1112
+ name?: string | undefined;
1113
+ };
1114
+ links: {
1115
+ spanId: string;
1116
+ rel: "follows" | "caused_by" | "handoff_to";
1117
+ }[];
1118
+ payload: {
1119
+ text: string;
1120
+ streamingTelemetry?: {
1121
+ timeToFirstTokenMs: number;
1122
+ totalDurationMs: number;
1123
+ tokensPerSecond: number;
1124
+ tokenCount: number;
1125
+ } | undefined;
1126
+ };
1127
+ title?: string | undefined;
1128
+ }, {
1129
+ status: "error" | "ok";
1130
+ kind: "response";
1131
+ schemaVersion: "1.0.0";
1132
+ traceId: string;
1133
+ spanId: string;
1134
+ parentSpanId: string | null;
1135
+ occurredAt: string;
1136
+ actor: {
1137
+ kind: "agent";
1138
+ id: string;
1139
+ name?: string | undefined;
1140
+ };
1141
+ payload: {
1142
+ text: string;
1143
+ streamingTelemetry?: {
1144
+ timeToFirstTokenMs: number;
1145
+ totalDurationMs: number;
1146
+ tokensPerSecond: number;
1147
+ tokenCount: number;
1148
+ } | undefined;
1149
+ };
1150
+ title?: string | undefined;
1151
+ links?: {
1152
+ spanId: string;
1153
+ rel: "follows" | "caused_by" | "handoff_to";
1154
+ }[] | undefined;
1155
+ }>, z.ZodObject<{
1156
+ schemaVersion: z.ZodLiteral<"1.0.0">;
1157
+ traceId: z.ZodString;
1158
+ spanId: z.ZodString;
1159
+ parentSpanId: z.ZodNullable<z.ZodString>;
1160
+ occurredAt: z.ZodString;
1161
+ status: z.ZodEnum<["ok", "error"]>;
1162
+ title: z.ZodOptional<z.ZodString>;
1163
+ links: z.ZodDefault<z.ZodArray<z.ZodObject<{
1164
+ rel: z.ZodEnum<["follows", "caused_by", "handoff_to"]>;
1165
+ spanId: z.ZodString;
1166
+ }, "strip", z.ZodTypeAny, {
1167
+ spanId: string;
1168
+ rel: "follows" | "caused_by" | "handoff_to";
1169
+ }, {
1170
+ spanId: string;
1171
+ rel: "follows" | "caused_by" | "handoff_to";
1172
+ }>, "many">>;
1173
+ } & {
1174
+ kind: z.ZodLiteral<"tool_call">;
1175
+ actor: z.ZodObject<{
1176
+ id: z.ZodString;
1177
+ name: z.ZodOptional<z.ZodString>;
1178
+ } & {
1179
+ kind: z.ZodLiteral<"tool">;
1180
+ }, "strip", z.ZodTypeAny, {
1181
+ kind: "tool";
1182
+ id: string;
1183
+ name?: string | undefined;
1184
+ }, {
1185
+ kind: "tool";
1186
+ id: string;
1187
+ name?: string | undefined;
1188
+ }>;
1189
+ payload: z.ZodObject<{
1190
+ input: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1191
+ }, "strip", z.ZodTypeAny, {
1192
+ input: Record<string, unknown>;
1193
+ }, {
1194
+ input: Record<string, unknown>;
1195
+ }>;
1196
+ }, "strip", z.ZodTypeAny, {
1197
+ status: "error" | "ok";
1198
+ kind: "tool_call";
1199
+ schemaVersion: "1.0.0";
1200
+ traceId: string;
1201
+ spanId: string;
1202
+ parentSpanId: string | null;
1203
+ occurredAt: string;
1204
+ actor: {
1205
+ kind: "tool";
1206
+ id: string;
1207
+ name?: string | undefined;
1208
+ };
1209
+ links: {
1210
+ spanId: string;
1211
+ rel: "follows" | "caused_by" | "handoff_to";
1212
+ }[];
1213
+ payload: {
1214
+ input: Record<string, unknown>;
1215
+ };
1216
+ title?: string | undefined;
1217
+ }, {
1218
+ status: "error" | "ok";
1219
+ kind: "tool_call";
1220
+ schemaVersion: "1.0.0";
1221
+ traceId: string;
1222
+ spanId: string;
1223
+ parentSpanId: string | null;
1224
+ occurredAt: string;
1225
+ actor: {
1226
+ kind: "tool";
1227
+ id: string;
1228
+ name?: string | undefined;
1229
+ };
1230
+ payload: {
1231
+ input: Record<string, unknown>;
1232
+ };
1233
+ title?: string | undefined;
1234
+ links?: {
1235
+ spanId: string;
1236
+ rel: "follows" | "caused_by" | "handoff_to";
1237
+ }[] | undefined;
1238
+ }>, z.ZodObject<{
1239
+ schemaVersion: z.ZodLiteral<"1.0.0">;
1240
+ traceId: z.ZodString;
1241
+ spanId: z.ZodString;
1242
+ parentSpanId: z.ZodNullable<z.ZodString>;
1243
+ occurredAt: z.ZodString;
1244
+ status: z.ZodEnum<["ok", "error"]>;
1245
+ title: z.ZodOptional<z.ZodString>;
1246
+ links: z.ZodDefault<z.ZodArray<z.ZodObject<{
1247
+ rel: z.ZodEnum<["follows", "caused_by", "handoff_to"]>;
1248
+ spanId: z.ZodString;
1249
+ }, "strip", z.ZodTypeAny, {
1250
+ spanId: string;
1251
+ rel: "follows" | "caused_by" | "handoff_to";
1252
+ }, {
1253
+ spanId: string;
1254
+ rel: "follows" | "caused_by" | "handoff_to";
1255
+ }>, "many">>;
1256
+ } & {
1257
+ kind: z.ZodLiteral<"tool_result">;
1258
+ actor: z.ZodObject<{
1259
+ id: z.ZodString;
1260
+ name: z.ZodOptional<z.ZodString>;
1261
+ } & {
1262
+ kind: z.ZodLiteral<"tool">;
1263
+ }, "strip", z.ZodTypeAny, {
1264
+ kind: "tool";
1265
+ id: string;
1266
+ name?: string | undefined;
1267
+ }, {
1268
+ kind: "tool";
1269
+ id: string;
1270
+ name?: string | undefined;
1271
+ }>;
1272
+ payload: z.ZodObject<{
1273
+ output: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1274
+ }, "strip", z.ZodTypeAny, {
1275
+ output: Record<string, unknown>;
1276
+ }, {
1277
+ output: Record<string, unknown>;
1278
+ }>;
1279
+ }, "strip", z.ZodTypeAny, {
1280
+ status: "error" | "ok";
1281
+ kind: "tool_result";
1282
+ schemaVersion: "1.0.0";
1283
+ traceId: string;
1284
+ spanId: string;
1285
+ parentSpanId: string | null;
1286
+ occurredAt: string;
1287
+ actor: {
1288
+ kind: "tool";
1289
+ id: string;
1290
+ name?: string | undefined;
1291
+ };
1292
+ links: {
1293
+ spanId: string;
1294
+ rel: "follows" | "caused_by" | "handoff_to";
1295
+ }[];
1296
+ payload: {
1297
+ output: Record<string, unknown>;
1298
+ };
1299
+ title?: string | undefined;
1300
+ }, {
1301
+ status: "error" | "ok";
1302
+ kind: "tool_result";
1303
+ schemaVersion: "1.0.0";
1304
+ traceId: string;
1305
+ spanId: string;
1306
+ parentSpanId: string | null;
1307
+ occurredAt: string;
1308
+ actor: {
1309
+ kind: "tool";
1310
+ id: string;
1311
+ name?: string | undefined;
1312
+ };
1313
+ payload: {
1314
+ output: Record<string, unknown>;
1315
+ };
1316
+ title?: string | undefined;
1317
+ links?: {
1318
+ spanId: string;
1319
+ rel: "follows" | "caused_by" | "handoff_to";
1320
+ }[] | undefined;
1321
+ }>, z.ZodObject<{
1322
+ schemaVersion: z.ZodLiteral<"1.0.0">;
1323
+ traceId: z.ZodString;
1324
+ spanId: z.ZodString;
1325
+ parentSpanId: z.ZodNullable<z.ZodString>;
1326
+ occurredAt: z.ZodString;
1327
+ status: z.ZodEnum<["ok", "error"]>;
1328
+ title: z.ZodOptional<z.ZodString>;
1329
+ links: z.ZodDefault<z.ZodArray<z.ZodObject<{
1330
+ rel: z.ZodEnum<["follows", "caused_by", "handoff_to"]>;
1331
+ spanId: z.ZodString;
1332
+ }, "strip", z.ZodTypeAny, {
1333
+ spanId: string;
1334
+ rel: "follows" | "caused_by" | "handoff_to";
1335
+ }, {
1336
+ spanId: string;
1337
+ rel: "follows" | "caused_by" | "handoff_to";
1338
+ }>, "many">>;
1339
+ } & {
1340
+ kind: z.ZodLiteral<"handoff">;
1341
+ actor: z.ZodObject<{
1342
+ id: z.ZodString;
1343
+ name: z.ZodOptional<z.ZodString>;
1344
+ } & {
1345
+ kind: z.ZodLiteral<"system">;
1346
+ }, "strip", z.ZodTypeAny, {
1347
+ kind: "system";
1348
+ id: string;
1349
+ name?: string | undefined;
1350
+ }, {
1351
+ kind: "system";
1352
+ id: string;
1353
+ name?: string | undefined;
1354
+ }>;
1355
+ payload: z.ZodObject<{
1356
+ fromAgentId: z.ZodString;
1357
+ toAgentId: z.ZodString;
1358
+ reason: z.ZodOptional<z.ZodString>;
1359
+ }, "strip", z.ZodTypeAny, {
1360
+ fromAgentId: string;
1361
+ toAgentId: string;
1362
+ reason?: string | undefined;
1363
+ }, {
1364
+ fromAgentId: string;
1365
+ toAgentId: string;
1366
+ reason?: string | undefined;
1367
+ }>;
1368
+ }, "strip", z.ZodTypeAny, {
1369
+ status: "error" | "ok";
1370
+ kind: "handoff";
1371
+ schemaVersion: "1.0.0";
1372
+ traceId: string;
1373
+ spanId: string;
1374
+ parentSpanId: string | null;
1375
+ occurredAt: string;
1376
+ actor: {
1377
+ kind: "system";
1378
+ id: string;
1379
+ name?: string | undefined;
1380
+ };
1381
+ links: {
1382
+ spanId: string;
1383
+ rel: "follows" | "caused_by" | "handoff_to";
1384
+ }[];
1385
+ payload: {
1386
+ fromAgentId: string;
1387
+ toAgentId: string;
1388
+ reason?: string | undefined;
1389
+ };
1390
+ title?: string | undefined;
1391
+ }, {
1392
+ status: "error" | "ok";
1393
+ kind: "handoff";
1394
+ schemaVersion: "1.0.0";
1395
+ traceId: string;
1396
+ spanId: string;
1397
+ parentSpanId: string | null;
1398
+ occurredAt: string;
1399
+ actor: {
1400
+ kind: "system";
1401
+ id: string;
1402
+ name?: string | undefined;
1403
+ };
1404
+ payload: {
1405
+ fromAgentId: string;
1406
+ toAgentId: string;
1407
+ reason?: string | undefined;
1408
+ };
1409
+ title?: string | undefined;
1410
+ links?: {
1411
+ spanId: string;
1412
+ rel: "follows" | "caused_by" | "handoff_to";
1413
+ }[] | undefined;
1414
+ }>, z.ZodObject<{
1415
+ schemaVersion: z.ZodLiteral<"1.0.0">;
1416
+ traceId: z.ZodString;
1417
+ spanId: z.ZodString;
1418
+ parentSpanId: z.ZodNullable<z.ZodString>;
1419
+ occurredAt: z.ZodString;
1420
+ actor: z.ZodObject<{
1421
+ kind: z.ZodEnum<["agent", "tool", "system"]>;
1422
+ id: z.ZodString;
1423
+ name: z.ZodOptional<z.ZodString>;
1424
+ }, "strip", z.ZodTypeAny, {
1425
+ kind: "agent" | "tool" | "system";
1426
+ id: string;
1427
+ name?: string | undefined;
1428
+ }, {
1429
+ kind: "agent" | "tool" | "system";
1430
+ id: string;
1431
+ name?: string | undefined;
1432
+ }>;
1433
+ status: z.ZodEnum<["ok", "error"]>;
1434
+ title: z.ZodOptional<z.ZodString>;
1435
+ links: z.ZodDefault<z.ZodArray<z.ZodObject<{
1436
+ rel: z.ZodEnum<["follows", "caused_by", "handoff_to"]>;
1437
+ spanId: z.ZodString;
1438
+ }, "strip", z.ZodTypeAny, {
1439
+ spanId: string;
1440
+ rel: "follows" | "caused_by" | "handoff_to";
1441
+ }, {
1442
+ spanId: string;
1443
+ rel: "follows" | "caused_by" | "handoff_to";
1444
+ }>, "many">>;
1445
+ } & {
1446
+ kind: z.ZodLiteral<"error">;
1447
+ payload: z.ZodObject<{
1448
+ message: z.ZodString;
1449
+ details: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1450
+ }, "strip", z.ZodTypeAny, {
1451
+ message: string;
1452
+ details: Record<string, unknown>;
1453
+ }, {
1454
+ message: string;
1455
+ details?: Record<string, unknown> | undefined;
1456
+ }>;
1457
+ }, "strip", z.ZodTypeAny, {
1458
+ status: "error" | "ok";
1459
+ kind: "error";
1460
+ schemaVersion: "1.0.0";
1461
+ traceId: string;
1462
+ spanId: string;
1463
+ parentSpanId: string | null;
1464
+ occurredAt: string;
1465
+ actor: {
1466
+ kind: "agent" | "tool" | "system";
1467
+ id: string;
1468
+ name?: string | undefined;
1469
+ };
1470
+ links: {
1471
+ spanId: string;
1472
+ rel: "follows" | "caused_by" | "handoff_to";
1473
+ }[];
1474
+ payload: {
1475
+ message: string;
1476
+ details: Record<string, unknown>;
1477
+ };
1478
+ title?: string | undefined;
1479
+ }, {
1480
+ status: "error" | "ok";
1481
+ kind: "error";
1482
+ schemaVersion: "1.0.0";
1483
+ traceId: string;
1484
+ spanId: string;
1485
+ parentSpanId: string | null;
1486
+ occurredAt: string;
1487
+ actor: {
1488
+ kind: "agent" | "tool" | "system";
1489
+ id: string;
1490
+ name?: string | undefined;
1491
+ };
1492
+ payload: {
1493
+ message: string;
1494
+ details?: Record<string, unknown> | undefined;
1495
+ };
1496
+ title?: string | undefined;
1497
+ links?: {
1498
+ spanId: string;
1499
+ rel: "follows" | "caused_by" | "handoff_to";
1500
+ }[] | undefined;
1501
+ }>, z.ZodObject<{
1502
+ schemaVersion: z.ZodLiteral<"1.0.0">;
1503
+ traceId: z.ZodString;
1504
+ spanId: z.ZodString;
1505
+ parentSpanId: z.ZodNullable<z.ZodString>;
1506
+ occurredAt: z.ZodString;
1507
+ actor: z.ZodObject<{
1508
+ kind: z.ZodEnum<["agent", "tool", "system"]>;
1509
+ id: z.ZodString;
1510
+ name: z.ZodOptional<z.ZodString>;
1511
+ }, "strip", z.ZodTypeAny, {
1512
+ kind: "agent" | "tool" | "system";
1513
+ id: string;
1514
+ name?: string | undefined;
1515
+ }, {
1516
+ kind: "agent" | "tool" | "system";
1517
+ id: string;
1518
+ name?: string | undefined;
1519
+ }>;
1520
+ status: z.ZodEnum<["ok", "error"]>;
1521
+ title: z.ZodOptional<z.ZodString>;
1522
+ links: z.ZodDefault<z.ZodArray<z.ZodObject<{
1523
+ rel: z.ZodEnum<["follows", "caused_by", "handoff_to"]>;
1524
+ spanId: z.ZodString;
1525
+ }, "strip", z.ZodTypeAny, {
1526
+ spanId: string;
1527
+ rel: "follows" | "caused_by" | "handoff_to";
1528
+ }, {
1529
+ spanId: string;
1530
+ rel: "follows" | "caused_by" | "handoff_to";
1531
+ }>, "many">>;
1532
+ } & {
1533
+ kind: z.ZodLiteral<"note">;
1534
+ payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1535
+ }, "strip", z.ZodTypeAny, {
1536
+ status: "error" | "ok";
1537
+ kind: "note";
1538
+ schemaVersion: "1.0.0";
1539
+ traceId: string;
1540
+ spanId: string;
1541
+ parentSpanId: string | null;
1542
+ occurredAt: string;
1543
+ actor: {
1544
+ kind: "agent" | "tool" | "system";
1545
+ id: string;
1546
+ name?: string | undefined;
1547
+ };
1548
+ links: {
1549
+ spanId: string;
1550
+ rel: "follows" | "caused_by" | "handoff_to";
1551
+ }[];
1552
+ payload: Record<string, unknown>;
1553
+ title?: string | undefined;
1554
+ }, {
1555
+ status: "error" | "ok";
1556
+ kind: "note";
1557
+ schemaVersion: "1.0.0";
1558
+ traceId: string;
1559
+ spanId: string;
1560
+ parentSpanId: string | null;
1561
+ occurredAt: string;
1562
+ actor: {
1563
+ kind: "agent" | "tool" | "system";
1564
+ id: string;
1565
+ name?: string | undefined;
1566
+ };
1567
+ payload: Record<string, unknown>;
1568
+ title?: string | undefined;
1569
+ links?: {
1570
+ spanId: string;
1571
+ rel: "follows" | "caused_by" | "handoff_to";
1572
+ }[] | undefined;
1573
+ }>, z.ZodObject<{
1574
+ schemaVersion: z.ZodLiteral<"1.0.0">;
1575
+ traceId: z.ZodString;
1576
+ spanId: z.ZodString;
1577
+ parentSpanId: z.ZodNullable<z.ZodString>;
1578
+ occurredAt: z.ZodString;
1579
+ status: z.ZodEnum<["ok", "error"]>;
1580
+ title: z.ZodOptional<z.ZodString>;
1581
+ links: z.ZodDefault<z.ZodArray<z.ZodObject<{
1582
+ rel: z.ZodEnum<["follows", "caused_by", "handoff_to"]>;
1583
+ spanId: z.ZodString;
1584
+ }, "strip", z.ZodTypeAny, {
1585
+ spanId: string;
1586
+ rel: "follows" | "caused_by" | "handoff_to";
1587
+ }, {
1588
+ spanId: string;
1589
+ rel: "follows" | "caused_by" | "handoff_to";
1590
+ }>, "many">>;
1591
+ } & {
1592
+ kind: z.ZodLiteral<"state_snapshot">;
1593
+ actor: z.ZodObject<{
1594
+ id: z.ZodString;
1595
+ name: z.ZodOptional<z.ZodString>;
1596
+ } & {
1597
+ kind: z.ZodLiteral<"system">;
1598
+ }, "strip", z.ZodTypeAny, {
1599
+ kind: "system";
1600
+ id: string;
1601
+ name?: string | undefined;
1602
+ }, {
1603
+ kind: "system";
1604
+ id: string;
1605
+ name?: string | undefined;
1606
+ }>;
1607
+ payload: z.ZodObject<{
1608
+ nodeName: z.ZodString;
1609
+ stateHash: z.ZodString;
1610
+ stateDiff: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1611
+ removedKeys: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1612
+ fullState: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1613
+ }, "strip", z.ZodTypeAny, {
1614
+ nodeName: string;
1615
+ stateHash: string;
1616
+ stateDiff: Record<string, unknown>;
1617
+ fullState: Record<string, unknown>;
1618
+ removedKeys?: string[] | undefined;
1619
+ }, {
1620
+ nodeName: string;
1621
+ stateHash: string;
1622
+ stateDiff: Record<string, unknown>;
1623
+ fullState: Record<string, unknown>;
1624
+ removedKeys?: string[] | undefined;
1625
+ }>;
1626
+ }, "strip", z.ZodTypeAny, {
1627
+ status: "error" | "ok";
1628
+ kind: "state_snapshot";
1629
+ schemaVersion: "1.0.0";
1630
+ traceId: string;
1631
+ spanId: string;
1632
+ parentSpanId: string | null;
1633
+ occurredAt: string;
1634
+ actor: {
1635
+ kind: "system";
1636
+ id: string;
1637
+ name?: string | undefined;
1638
+ };
1639
+ links: {
1640
+ spanId: string;
1641
+ rel: "follows" | "caused_by" | "handoff_to";
1642
+ }[];
1643
+ payload: {
1644
+ nodeName: string;
1645
+ stateHash: string;
1646
+ stateDiff: Record<string, unknown>;
1647
+ fullState: Record<string, unknown>;
1648
+ removedKeys?: string[] | undefined;
1649
+ };
1650
+ title?: string | undefined;
1651
+ }, {
1652
+ status: "error" | "ok";
1653
+ kind: "state_snapshot";
1654
+ schemaVersion: "1.0.0";
1655
+ traceId: string;
1656
+ spanId: string;
1657
+ parentSpanId: string | null;
1658
+ occurredAt: string;
1659
+ actor: {
1660
+ kind: "system";
1661
+ id: string;
1662
+ name?: string | undefined;
1663
+ };
1664
+ payload: {
1665
+ nodeName: string;
1666
+ stateHash: string;
1667
+ stateDiff: Record<string, unknown>;
1668
+ fullState: Record<string, unknown>;
1669
+ removedKeys?: string[] | undefined;
1670
+ };
1671
+ title?: string | undefined;
1672
+ links?: {
1673
+ spanId: string;
1674
+ rel: "follows" | "caused_by" | "handoff_to";
1675
+ }[] | undefined;
1676
+ }>, z.ZodObject<{
1677
+ schemaVersion: z.ZodLiteral<"1.0.0">;
1678
+ traceId: z.ZodString;
1679
+ spanId: z.ZodString;
1680
+ parentSpanId: z.ZodNullable<z.ZodString>;
1681
+ occurredAt: z.ZodString;
1682
+ status: z.ZodEnum<["ok", "error"]>;
1683
+ title: z.ZodOptional<z.ZodString>;
1684
+ links: z.ZodDefault<z.ZodArray<z.ZodObject<{
1685
+ rel: z.ZodEnum<["follows", "caused_by", "handoff_to"]>;
1686
+ spanId: z.ZodString;
1687
+ }, "strip", z.ZodTypeAny, {
1688
+ spanId: string;
1689
+ rel: "follows" | "caused_by" | "handoff_to";
1690
+ }, {
1691
+ spanId: string;
1692
+ rel: "follows" | "caused_by" | "handoff_to";
1693
+ }>, "many">>;
1694
+ } & {
1695
+ kind: z.ZodLiteral<"retriever">;
1696
+ actor: z.ZodObject<{
1697
+ id: z.ZodString;
1698
+ name: z.ZodOptional<z.ZodString>;
1699
+ } & {
1700
+ kind: z.ZodLiteral<"tool">;
1701
+ }, "strip", z.ZodTypeAny, {
1702
+ kind: "tool";
1703
+ id: string;
1704
+ name?: string | undefined;
1705
+ }, {
1706
+ kind: "tool";
1707
+ id: string;
1708
+ name?: string | undefined;
1709
+ }>;
1710
+ payload: z.ZodObject<{
1711
+ query: z.ZodString;
1712
+ documents: z.ZodArray<z.ZodObject<{
1713
+ pageContent: z.ZodString;
1714
+ metadata: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1715
+ score: z.ZodOptional<z.ZodNumber>;
1716
+ }, "strip", z.ZodTypeAny, {
1717
+ pageContent: string;
1718
+ metadata: Record<string, unknown>;
1719
+ score?: number | undefined;
1720
+ }, {
1721
+ pageContent: string;
1722
+ metadata: Record<string, unknown>;
1723
+ score?: number | undefined;
1724
+ }>, "many">;
1725
+ }, "strip", z.ZodTypeAny, {
1726
+ query: string;
1727
+ documents: {
1728
+ pageContent: string;
1729
+ metadata: Record<string, unknown>;
1730
+ score?: number | undefined;
1731
+ }[];
1732
+ }, {
1733
+ query: string;
1734
+ documents: {
1735
+ pageContent: string;
1736
+ metadata: Record<string, unknown>;
1737
+ score?: number | undefined;
1738
+ }[];
1739
+ }>;
1740
+ }, "strip", z.ZodTypeAny, {
1741
+ status: "error" | "ok";
1742
+ kind: "retriever";
1743
+ schemaVersion: "1.0.0";
1744
+ traceId: string;
1745
+ spanId: string;
1746
+ parentSpanId: string | null;
1747
+ occurredAt: string;
1748
+ actor: {
1749
+ kind: "tool";
1750
+ id: string;
1751
+ name?: string | undefined;
1752
+ };
1753
+ links: {
1754
+ spanId: string;
1755
+ rel: "follows" | "caused_by" | "handoff_to";
1756
+ }[];
1757
+ payload: {
1758
+ query: string;
1759
+ documents: {
1760
+ pageContent: string;
1761
+ metadata: Record<string, unknown>;
1762
+ score?: number | undefined;
1763
+ }[];
1764
+ };
1765
+ title?: string | undefined;
1766
+ }, {
1767
+ status: "error" | "ok";
1768
+ kind: "retriever";
1769
+ schemaVersion: "1.0.0";
1770
+ traceId: string;
1771
+ spanId: string;
1772
+ parentSpanId: string | null;
1773
+ occurredAt: string;
1774
+ actor: {
1775
+ kind: "tool";
1776
+ id: string;
1777
+ name?: string | undefined;
1778
+ };
1779
+ payload: {
1780
+ query: string;
1781
+ documents: {
1782
+ pageContent: string;
1783
+ metadata: Record<string, unknown>;
1784
+ score?: number | undefined;
1785
+ }[];
1786
+ };
1787
+ title?: string | undefined;
1788
+ links?: {
1789
+ spanId: string;
1790
+ rel: "follows" | "caused_by" | "handoff_to";
1791
+ }[] | undefined;
1792
+ }>, z.ZodObject<{
1793
+ schemaVersion: z.ZodLiteral<"1.0.0">;
1794
+ traceId: z.ZodString;
1795
+ spanId: z.ZodString;
1796
+ parentSpanId: z.ZodNullable<z.ZodString>;
1797
+ occurredAt: z.ZodString;
1798
+ status: z.ZodEnum<["ok", "error"]>;
1799
+ title: z.ZodOptional<z.ZodString>;
1800
+ links: z.ZodDefault<z.ZodArray<z.ZodObject<{
1801
+ rel: z.ZodEnum<["follows", "caused_by", "handoff_to"]>;
1802
+ spanId: z.ZodString;
1803
+ }, "strip", z.ZodTypeAny, {
1804
+ spanId: string;
1805
+ rel: "follows" | "caused_by" | "handoff_to";
1806
+ }, {
1807
+ spanId: string;
1808
+ rel: "follows" | "caused_by" | "handoff_to";
1809
+ }>, "many">>;
1810
+ } & {
1811
+ kind: z.ZodLiteral<"checkpoint">;
1812
+ actor: z.ZodObject<{
1813
+ id: z.ZodString;
1814
+ name: z.ZodOptional<z.ZodString>;
1815
+ } & {
1816
+ kind: z.ZodLiteral<"system">;
1817
+ }, "strip", z.ZodTypeAny, {
1818
+ kind: "system";
1819
+ id: string;
1820
+ name?: string | undefined;
1821
+ }, {
1822
+ kind: "system";
1823
+ id: string;
1824
+ name?: string | undefined;
1825
+ }>;
1826
+ payload: z.ZodObject<{
1827
+ checkpointId: z.ZodString;
1828
+ reason: z.ZodString;
1829
+ state: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1830
+ }, "strip", z.ZodTypeAny, {
1831
+ reason: string;
1832
+ checkpointId: string;
1833
+ state: Record<string, unknown>;
1834
+ }, {
1835
+ reason: string;
1836
+ checkpointId: string;
1837
+ state: Record<string, unknown>;
1838
+ }>;
1839
+ }, "strip", z.ZodTypeAny, {
1840
+ status: "error" | "ok";
1841
+ kind: "checkpoint";
1842
+ schemaVersion: "1.0.0";
1843
+ traceId: string;
1844
+ spanId: string;
1845
+ parentSpanId: string | null;
1846
+ occurredAt: string;
1847
+ actor: {
1848
+ kind: "system";
1849
+ id: string;
1850
+ name?: string | undefined;
1851
+ };
1852
+ links: {
1853
+ spanId: string;
1854
+ rel: "follows" | "caused_by" | "handoff_to";
1855
+ }[];
1856
+ payload: {
1857
+ reason: string;
1858
+ checkpointId: string;
1859
+ state: Record<string, unknown>;
1860
+ };
1861
+ title?: string | undefined;
1862
+ }, {
1863
+ status: "error" | "ok";
1864
+ kind: "checkpoint";
1865
+ schemaVersion: "1.0.0";
1866
+ traceId: string;
1867
+ spanId: string;
1868
+ parentSpanId: string | null;
1869
+ occurredAt: string;
1870
+ actor: {
1871
+ kind: "system";
1872
+ id: string;
1873
+ name?: string | undefined;
1874
+ };
1875
+ payload: {
1876
+ reason: string;
1877
+ checkpointId: string;
1878
+ state: Record<string, unknown>;
1879
+ };
1880
+ title?: string | undefined;
1881
+ links?: {
1882
+ spanId: string;
1883
+ rel: "follows" | "caused_by" | "handoff_to";
1884
+ }[] | undefined;
1885
+ }>]>, "many">;
1886
+ }, "strip", z.ZodTypeAny, {
1887
+ traceId: string;
1888
+ createdAt: string;
1889
+ rootSpanId: string | null;
1890
+ events: ({
1891
+ status: "error" | "ok";
1892
+ kind: "prompt";
1893
+ schemaVersion: "1.0.0";
1894
+ traceId: string;
1895
+ spanId: string;
1896
+ parentSpanId: string | null;
1897
+ occurredAt: string;
1898
+ actor: {
1899
+ kind: "agent";
1900
+ id: string;
1901
+ name?: string | undefined;
1902
+ };
1903
+ links: {
1904
+ spanId: string;
1905
+ rel: "follows" | "caused_by" | "handoff_to";
1906
+ }[];
1907
+ payload: {
1908
+ text: string;
1909
+ };
1910
+ title?: string | undefined;
1911
+ } | {
1912
+ status: "error" | "ok";
1913
+ kind: "response";
1914
+ schemaVersion: "1.0.0";
1915
+ traceId: string;
1916
+ spanId: string;
1917
+ parentSpanId: string | null;
1918
+ occurredAt: string;
1919
+ actor: {
1920
+ kind: "agent";
1921
+ id: string;
1922
+ name?: string | undefined;
1923
+ };
1924
+ links: {
1925
+ spanId: string;
1926
+ rel: "follows" | "caused_by" | "handoff_to";
1927
+ }[];
1928
+ payload: {
1929
+ text: string;
1930
+ streamingTelemetry?: {
1931
+ timeToFirstTokenMs: number;
1932
+ totalDurationMs: number;
1933
+ tokensPerSecond: number;
1934
+ tokenCount: number;
1935
+ } | undefined;
1936
+ };
1937
+ title?: string | undefined;
1938
+ } | {
1939
+ status: "error" | "ok";
1940
+ kind: "tool_call";
1941
+ schemaVersion: "1.0.0";
1942
+ traceId: string;
1943
+ spanId: string;
1944
+ parentSpanId: string | null;
1945
+ occurredAt: string;
1946
+ actor: {
1947
+ kind: "tool";
1948
+ id: string;
1949
+ name?: string | undefined;
1950
+ };
1951
+ links: {
1952
+ spanId: string;
1953
+ rel: "follows" | "caused_by" | "handoff_to";
1954
+ }[];
1955
+ payload: {
1956
+ input: Record<string, unknown>;
1957
+ };
1958
+ title?: string | undefined;
1959
+ } | {
1960
+ status: "error" | "ok";
1961
+ kind: "tool_result";
1962
+ schemaVersion: "1.0.0";
1963
+ traceId: string;
1964
+ spanId: string;
1965
+ parentSpanId: string | null;
1966
+ occurredAt: string;
1967
+ actor: {
1968
+ kind: "tool";
1969
+ id: string;
1970
+ name?: string | undefined;
1971
+ };
1972
+ links: {
1973
+ spanId: string;
1974
+ rel: "follows" | "caused_by" | "handoff_to";
1975
+ }[];
1976
+ payload: {
1977
+ output: Record<string, unknown>;
1978
+ };
1979
+ title?: string | undefined;
1980
+ } | {
1981
+ status: "error" | "ok";
1982
+ kind: "handoff";
1983
+ schemaVersion: "1.0.0";
1984
+ traceId: string;
1985
+ spanId: string;
1986
+ parentSpanId: string | null;
1987
+ occurredAt: string;
1988
+ actor: {
1989
+ kind: "system";
1990
+ id: string;
1991
+ name?: string | undefined;
1992
+ };
1993
+ links: {
1994
+ spanId: string;
1995
+ rel: "follows" | "caused_by" | "handoff_to";
1996
+ }[];
1997
+ payload: {
1998
+ fromAgentId: string;
1999
+ toAgentId: string;
2000
+ reason?: string | undefined;
2001
+ };
2002
+ title?: string | undefined;
2003
+ } | {
2004
+ status: "error" | "ok";
2005
+ kind: "error";
2006
+ schemaVersion: "1.0.0";
2007
+ traceId: string;
2008
+ spanId: string;
2009
+ parentSpanId: string | null;
2010
+ occurredAt: string;
2011
+ actor: {
2012
+ kind: "agent" | "tool" | "system";
2013
+ id: string;
2014
+ name?: string | undefined;
2015
+ };
2016
+ links: {
2017
+ spanId: string;
2018
+ rel: "follows" | "caused_by" | "handoff_to";
2019
+ }[];
2020
+ payload: {
2021
+ message: string;
2022
+ details: Record<string, unknown>;
2023
+ };
2024
+ title?: string | undefined;
2025
+ } | {
2026
+ status: "error" | "ok";
2027
+ kind: "note";
2028
+ schemaVersion: "1.0.0";
2029
+ traceId: string;
2030
+ spanId: string;
2031
+ parentSpanId: string | null;
2032
+ occurredAt: string;
2033
+ actor: {
2034
+ kind: "agent" | "tool" | "system";
2035
+ id: string;
2036
+ name?: string | undefined;
2037
+ };
2038
+ links: {
2039
+ spanId: string;
2040
+ rel: "follows" | "caused_by" | "handoff_to";
2041
+ }[];
2042
+ payload: Record<string, unknown>;
2043
+ title?: string | undefined;
2044
+ } | {
2045
+ status: "error" | "ok";
2046
+ kind: "state_snapshot";
2047
+ schemaVersion: "1.0.0";
2048
+ traceId: string;
2049
+ spanId: string;
2050
+ parentSpanId: string | null;
2051
+ occurredAt: string;
2052
+ actor: {
2053
+ kind: "system";
2054
+ id: string;
2055
+ name?: string | undefined;
2056
+ };
2057
+ links: {
2058
+ spanId: string;
2059
+ rel: "follows" | "caused_by" | "handoff_to";
2060
+ }[];
2061
+ payload: {
2062
+ nodeName: string;
2063
+ stateHash: string;
2064
+ stateDiff: Record<string, unknown>;
2065
+ fullState: Record<string, unknown>;
2066
+ removedKeys?: string[] | undefined;
2067
+ };
2068
+ title?: string | undefined;
2069
+ } | {
2070
+ status: "error" | "ok";
2071
+ kind: "retriever";
2072
+ schemaVersion: "1.0.0";
2073
+ traceId: string;
2074
+ spanId: string;
2075
+ parentSpanId: string | null;
2076
+ occurredAt: string;
2077
+ actor: {
2078
+ kind: "tool";
2079
+ id: string;
2080
+ name?: string | undefined;
2081
+ };
2082
+ links: {
2083
+ spanId: string;
2084
+ rel: "follows" | "caused_by" | "handoff_to";
2085
+ }[];
2086
+ payload: {
2087
+ query: string;
2088
+ documents: {
2089
+ pageContent: string;
2090
+ metadata: Record<string, unknown>;
2091
+ score?: number | undefined;
2092
+ }[];
2093
+ };
2094
+ title?: string | undefined;
2095
+ } | {
2096
+ status: "error" | "ok";
2097
+ kind: "checkpoint";
2098
+ schemaVersion: "1.0.0";
2099
+ traceId: string;
2100
+ spanId: string;
2101
+ parentSpanId: string | null;
2102
+ occurredAt: string;
2103
+ actor: {
2104
+ kind: "system";
2105
+ id: string;
2106
+ name?: string | undefined;
2107
+ };
2108
+ links: {
2109
+ spanId: string;
2110
+ rel: "follows" | "caused_by" | "handoff_to";
2111
+ }[];
2112
+ payload: {
2113
+ reason: string;
2114
+ checkpointId: string;
2115
+ state: Record<string, unknown>;
2116
+ };
2117
+ title?: string | undefined;
2118
+ })[];
2119
+ }, {
2120
+ traceId: string;
2121
+ createdAt: string;
2122
+ rootSpanId: string | null;
2123
+ events: ({
2124
+ status: "error" | "ok";
2125
+ kind: "prompt";
2126
+ schemaVersion: "1.0.0";
2127
+ traceId: string;
2128
+ spanId: string;
2129
+ parentSpanId: string | null;
2130
+ occurredAt: string;
2131
+ actor: {
2132
+ kind: "agent";
2133
+ id: string;
2134
+ name?: string | undefined;
2135
+ };
2136
+ payload: {
2137
+ text: string;
2138
+ };
2139
+ title?: string | undefined;
2140
+ links?: {
2141
+ spanId: string;
2142
+ rel: "follows" | "caused_by" | "handoff_to";
2143
+ }[] | undefined;
2144
+ } | {
2145
+ status: "error" | "ok";
2146
+ kind: "response";
2147
+ schemaVersion: "1.0.0";
2148
+ traceId: string;
2149
+ spanId: string;
2150
+ parentSpanId: string | null;
2151
+ occurredAt: string;
2152
+ actor: {
2153
+ kind: "agent";
2154
+ id: string;
2155
+ name?: string | undefined;
2156
+ };
2157
+ payload: {
2158
+ text: string;
2159
+ streamingTelemetry?: {
2160
+ timeToFirstTokenMs: number;
2161
+ totalDurationMs: number;
2162
+ tokensPerSecond: number;
2163
+ tokenCount: number;
2164
+ } | undefined;
2165
+ };
2166
+ title?: string | undefined;
2167
+ links?: {
2168
+ spanId: string;
2169
+ rel: "follows" | "caused_by" | "handoff_to";
2170
+ }[] | undefined;
2171
+ } | {
2172
+ status: "error" | "ok";
2173
+ kind: "tool_call";
2174
+ schemaVersion: "1.0.0";
2175
+ traceId: string;
2176
+ spanId: string;
2177
+ parentSpanId: string | null;
2178
+ occurredAt: string;
2179
+ actor: {
2180
+ kind: "tool";
2181
+ id: string;
2182
+ name?: string | undefined;
2183
+ };
2184
+ payload: {
2185
+ input: Record<string, unknown>;
2186
+ };
2187
+ title?: string | undefined;
2188
+ links?: {
2189
+ spanId: string;
2190
+ rel: "follows" | "caused_by" | "handoff_to";
2191
+ }[] | undefined;
2192
+ } | {
2193
+ status: "error" | "ok";
2194
+ kind: "tool_result";
2195
+ schemaVersion: "1.0.0";
2196
+ traceId: string;
2197
+ spanId: string;
2198
+ parentSpanId: string | null;
2199
+ occurredAt: string;
2200
+ actor: {
2201
+ kind: "tool";
2202
+ id: string;
2203
+ name?: string | undefined;
2204
+ };
2205
+ payload: {
2206
+ output: Record<string, unknown>;
2207
+ };
2208
+ title?: string | undefined;
2209
+ links?: {
2210
+ spanId: string;
2211
+ rel: "follows" | "caused_by" | "handoff_to";
2212
+ }[] | undefined;
2213
+ } | {
2214
+ status: "error" | "ok";
2215
+ kind: "handoff";
2216
+ schemaVersion: "1.0.0";
2217
+ traceId: string;
2218
+ spanId: string;
2219
+ parentSpanId: string | null;
2220
+ occurredAt: string;
2221
+ actor: {
2222
+ kind: "system";
2223
+ id: string;
2224
+ name?: string | undefined;
2225
+ };
2226
+ payload: {
2227
+ fromAgentId: string;
2228
+ toAgentId: string;
2229
+ reason?: string | undefined;
2230
+ };
2231
+ title?: string | undefined;
2232
+ links?: {
2233
+ spanId: string;
2234
+ rel: "follows" | "caused_by" | "handoff_to";
2235
+ }[] | undefined;
2236
+ } | {
2237
+ status: "error" | "ok";
2238
+ kind: "error";
2239
+ schemaVersion: "1.0.0";
2240
+ traceId: string;
2241
+ spanId: string;
2242
+ parentSpanId: string | null;
2243
+ occurredAt: string;
2244
+ actor: {
2245
+ kind: "agent" | "tool" | "system";
2246
+ id: string;
2247
+ name?: string | undefined;
2248
+ };
2249
+ payload: {
2250
+ message: string;
2251
+ details?: Record<string, unknown> | undefined;
2252
+ };
2253
+ title?: string | undefined;
2254
+ links?: {
2255
+ spanId: string;
2256
+ rel: "follows" | "caused_by" | "handoff_to";
2257
+ }[] | undefined;
2258
+ } | {
2259
+ status: "error" | "ok";
2260
+ kind: "note";
2261
+ schemaVersion: "1.0.0";
2262
+ traceId: string;
2263
+ spanId: string;
2264
+ parentSpanId: string | null;
2265
+ occurredAt: string;
2266
+ actor: {
2267
+ kind: "agent" | "tool" | "system";
2268
+ id: string;
2269
+ name?: string | undefined;
2270
+ };
2271
+ payload: Record<string, unknown>;
2272
+ title?: string | undefined;
2273
+ links?: {
2274
+ spanId: string;
2275
+ rel: "follows" | "caused_by" | "handoff_to";
2276
+ }[] | undefined;
2277
+ } | {
2278
+ status: "error" | "ok";
2279
+ kind: "state_snapshot";
2280
+ schemaVersion: "1.0.0";
2281
+ traceId: string;
2282
+ spanId: string;
2283
+ parentSpanId: string | null;
2284
+ occurredAt: string;
2285
+ actor: {
2286
+ kind: "system";
2287
+ id: string;
2288
+ name?: string | undefined;
2289
+ };
2290
+ payload: {
2291
+ nodeName: string;
2292
+ stateHash: string;
2293
+ stateDiff: Record<string, unknown>;
2294
+ fullState: Record<string, unknown>;
2295
+ removedKeys?: string[] | undefined;
2296
+ };
2297
+ title?: string | undefined;
2298
+ links?: {
2299
+ spanId: string;
2300
+ rel: "follows" | "caused_by" | "handoff_to";
2301
+ }[] | undefined;
2302
+ } | {
2303
+ status: "error" | "ok";
2304
+ kind: "retriever";
2305
+ schemaVersion: "1.0.0";
2306
+ traceId: string;
2307
+ spanId: string;
2308
+ parentSpanId: string | null;
2309
+ occurredAt: string;
2310
+ actor: {
2311
+ kind: "tool";
2312
+ id: string;
2313
+ name?: string | undefined;
2314
+ };
2315
+ payload: {
2316
+ query: string;
2317
+ documents: {
2318
+ pageContent: string;
2319
+ metadata: Record<string, unknown>;
2320
+ score?: number | undefined;
2321
+ }[];
2322
+ };
2323
+ title?: string | undefined;
2324
+ links?: {
2325
+ spanId: string;
2326
+ rel: "follows" | "caused_by" | "handoff_to";
2327
+ }[] | undefined;
2328
+ } | {
2329
+ status: "error" | "ok";
2330
+ kind: "checkpoint";
2331
+ schemaVersion: "1.0.0";
2332
+ traceId: string;
2333
+ spanId: string;
2334
+ parentSpanId: string | null;
2335
+ occurredAt: string;
2336
+ actor: {
2337
+ kind: "system";
2338
+ id: string;
2339
+ name?: string | undefined;
2340
+ };
2341
+ payload: {
2342
+ reason: string;
2343
+ checkpointId: string;
2344
+ state: Record<string, unknown>;
2345
+ };
2346
+ title?: string | undefined;
2347
+ links?: {
2348
+ spanId: string;
2349
+ rel: "follows" | "caused_by" | "handoff_to";
2350
+ }[] | undefined;
2351
+ })[];
2352
+ }>;
2353
+ export type Trace = z.infer<typeof traceSchema>;
2354
+ export declare const traceMetaSchema: z.ZodObject<{
2355
+ traceId: z.ZodString;
2356
+ createdAt: z.ZodString;
2357
+ updatedAt: z.ZodString;
2358
+ eventCount: z.ZodNumber;
2359
+ rootSpanId: z.ZodNullable<z.ZodString>;
2360
+ derivedFrom: z.ZodOptional<z.ZodObject<{
2361
+ baseTraceId: z.ZodString;
2362
+ forkedFromSpanId: z.ZodString;
2363
+ }, "strip", z.ZodTypeAny, {
2364
+ baseTraceId: string;
2365
+ forkedFromSpanId: string;
2366
+ }, {
2367
+ baseTraceId: string;
2368
+ forkedFromSpanId: string;
2369
+ }>>;
2370
+ }, "strip", z.ZodTypeAny, {
2371
+ traceId: string;
2372
+ createdAt: string;
2373
+ rootSpanId: string | null;
2374
+ updatedAt: string;
2375
+ eventCount: number;
2376
+ derivedFrom?: {
2377
+ baseTraceId: string;
2378
+ forkedFromSpanId: string;
2379
+ } | undefined;
2380
+ }, {
2381
+ traceId: string;
2382
+ createdAt: string;
2383
+ rootSpanId: string | null;
2384
+ updatedAt: string;
2385
+ eventCount: number;
2386
+ derivedFrom?: {
2387
+ baseTraceId: string;
2388
+ forkedFromSpanId: string;
2389
+ } | undefined;
2390
+ }>;
2391
+ export type TraceMeta = z.infer<typeof traceMetaSchema>;
2392
+ export declare const traceWithMetaSchema: z.ZodObject<{
2393
+ meta: z.ZodObject<{
2394
+ traceId: z.ZodString;
2395
+ createdAt: z.ZodString;
2396
+ updatedAt: z.ZodString;
2397
+ eventCount: z.ZodNumber;
2398
+ rootSpanId: z.ZodNullable<z.ZodString>;
2399
+ derivedFrom: z.ZodOptional<z.ZodObject<{
2400
+ baseTraceId: z.ZodString;
2401
+ forkedFromSpanId: z.ZodString;
2402
+ }, "strip", z.ZodTypeAny, {
2403
+ baseTraceId: string;
2404
+ forkedFromSpanId: string;
2405
+ }, {
2406
+ baseTraceId: string;
2407
+ forkedFromSpanId: string;
2408
+ }>>;
2409
+ }, "strip", z.ZodTypeAny, {
2410
+ traceId: string;
2411
+ createdAt: string;
2412
+ rootSpanId: string | null;
2413
+ updatedAt: string;
2414
+ eventCount: number;
2415
+ derivedFrom?: {
2416
+ baseTraceId: string;
2417
+ forkedFromSpanId: string;
2418
+ } | undefined;
2419
+ }, {
2420
+ traceId: string;
2421
+ createdAt: string;
2422
+ rootSpanId: string | null;
2423
+ updatedAt: string;
2424
+ eventCount: number;
2425
+ derivedFrom?: {
2426
+ baseTraceId: string;
2427
+ forkedFromSpanId: string;
2428
+ } | undefined;
2429
+ }>;
2430
+ events: z.ZodArray<z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
2431
+ schemaVersion: z.ZodLiteral<"1.0.0">;
2432
+ traceId: z.ZodString;
2433
+ spanId: z.ZodString;
2434
+ parentSpanId: z.ZodNullable<z.ZodString>;
2435
+ occurredAt: z.ZodString;
2436
+ status: z.ZodEnum<["ok", "error"]>;
2437
+ title: z.ZodOptional<z.ZodString>;
2438
+ links: z.ZodDefault<z.ZodArray<z.ZodObject<{
2439
+ rel: z.ZodEnum<["follows", "caused_by", "handoff_to"]>;
2440
+ spanId: z.ZodString;
2441
+ }, "strip", z.ZodTypeAny, {
2442
+ spanId: string;
2443
+ rel: "follows" | "caused_by" | "handoff_to";
2444
+ }, {
2445
+ spanId: string;
2446
+ rel: "follows" | "caused_by" | "handoff_to";
2447
+ }>, "many">>;
2448
+ } & {
2449
+ kind: z.ZodLiteral<"prompt">;
2450
+ actor: z.ZodObject<{
2451
+ id: z.ZodString;
2452
+ name: z.ZodOptional<z.ZodString>;
2453
+ } & {
2454
+ kind: z.ZodLiteral<"agent">;
2455
+ }, "strip", z.ZodTypeAny, {
2456
+ kind: "agent";
2457
+ id: string;
2458
+ name?: string | undefined;
2459
+ }, {
2460
+ kind: "agent";
2461
+ id: string;
2462
+ name?: string | undefined;
2463
+ }>;
2464
+ payload: z.ZodObject<{
2465
+ text: z.ZodString;
2466
+ }, "strip", z.ZodTypeAny, {
2467
+ text: string;
2468
+ }, {
2469
+ text: string;
2470
+ }>;
2471
+ }, "strip", z.ZodTypeAny, {
2472
+ status: "error" | "ok";
2473
+ kind: "prompt";
2474
+ schemaVersion: "1.0.0";
2475
+ traceId: string;
2476
+ spanId: string;
2477
+ parentSpanId: string | null;
2478
+ occurredAt: string;
2479
+ actor: {
2480
+ kind: "agent";
2481
+ id: string;
2482
+ name?: string | undefined;
2483
+ };
2484
+ links: {
2485
+ spanId: string;
2486
+ rel: "follows" | "caused_by" | "handoff_to";
2487
+ }[];
2488
+ payload: {
2489
+ text: string;
2490
+ };
2491
+ title?: string | undefined;
2492
+ }, {
2493
+ status: "error" | "ok";
2494
+ kind: "prompt";
2495
+ schemaVersion: "1.0.0";
2496
+ traceId: string;
2497
+ spanId: string;
2498
+ parentSpanId: string | null;
2499
+ occurredAt: string;
2500
+ actor: {
2501
+ kind: "agent";
2502
+ id: string;
2503
+ name?: string | undefined;
2504
+ };
2505
+ payload: {
2506
+ text: string;
2507
+ };
2508
+ title?: string | undefined;
2509
+ links?: {
2510
+ spanId: string;
2511
+ rel: "follows" | "caused_by" | "handoff_to";
2512
+ }[] | undefined;
2513
+ }>, z.ZodObject<{
2514
+ schemaVersion: z.ZodLiteral<"1.0.0">;
2515
+ traceId: z.ZodString;
2516
+ spanId: z.ZodString;
2517
+ parentSpanId: z.ZodNullable<z.ZodString>;
2518
+ occurredAt: z.ZodString;
2519
+ status: z.ZodEnum<["ok", "error"]>;
2520
+ title: z.ZodOptional<z.ZodString>;
2521
+ links: z.ZodDefault<z.ZodArray<z.ZodObject<{
2522
+ rel: z.ZodEnum<["follows", "caused_by", "handoff_to"]>;
2523
+ spanId: z.ZodString;
2524
+ }, "strip", z.ZodTypeAny, {
2525
+ spanId: string;
2526
+ rel: "follows" | "caused_by" | "handoff_to";
2527
+ }, {
2528
+ spanId: string;
2529
+ rel: "follows" | "caused_by" | "handoff_to";
2530
+ }>, "many">>;
2531
+ } & {
2532
+ kind: z.ZodLiteral<"response">;
2533
+ actor: z.ZodObject<{
2534
+ id: z.ZodString;
2535
+ name: z.ZodOptional<z.ZodString>;
2536
+ } & {
2537
+ kind: z.ZodLiteral<"agent">;
2538
+ }, "strip", z.ZodTypeAny, {
2539
+ kind: "agent";
2540
+ id: string;
2541
+ name?: string | undefined;
2542
+ }, {
2543
+ kind: "agent";
2544
+ id: string;
2545
+ name?: string | undefined;
2546
+ }>;
2547
+ payload: z.ZodObject<{
2548
+ text: z.ZodString;
2549
+ streamingTelemetry: z.ZodOptional<z.ZodObject<{
2550
+ timeToFirstTokenMs: z.ZodNumber;
2551
+ totalDurationMs: z.ZodNumber;
2552
+ tokensPerSecond: z.ZodNumber;
2553
+ tokenCount: z.ZodNumber;
2554
+ }, "strip", z.ZodTypeAny, {
2555
+ timeToFirstTokenMs: number;
2556
+ totalDurationMs: number;
2557
+ tokensPerSecond: number;
2558
+ tokenCount: number;
2559
+ }, {
2560
+ timeToFirstTokenMs: number;
2561
+ totalDurationMs: number;
2562
+ tokensPerSecond: number;
2563
+ tokenCount: number;
2564
+ }>>;
2565
+ }, "strip", z.ZodTypeAny, {
2566
+ text: string;
2567
+ streamingTelemetry?: {
2568
+ timeToFirstTokenMs: number;
2569
+ totalDurationMs: number;
2570
+ tokensPerSecond: number;
2571
+ tokenCount: number;
2572
+ } | undefined;
2573
+ }, {
2574
+ text: string;
2575
+ streamingTelemetry?: {
2576
+ timeToFirstTokenMs: number;
2577
+ totalDurationMs: number;
2578
+ tokensPerSecond: number;
2579
+ tokenCount: number;
2580
+ } | undefined;
2581
+ }>;
2582
+ }, "strip", z.ZodTypeAny, {
2583
+ status: "error" | "ok";
2584
+ kind: "response";
2585
+ schemaVersion: "1.0.0";
2586
+ traceId: string;
2587
+ spanId: string;
2588
+ parentSpanId: string | null;
2589
+ occurredAt: string;
2590
+ actor: {
2591
+ kind: "agent";
2592
+ id: string;
2593
+ name?: string | undefined;
2594
+ };
2595
+ links: {
2596
+ spanId: string;
2597
+ rel: "follows" | "caused_by" | "handoff_to";
2598
+ }[];
2599
+ payload: {
2600
+ text: string;
2601
+ streamingTelemetry?: {
2602
+ timeToFirstTokenMs: number;
2603
+ totalDurationMs: number;
2604
+ tokensPerSecond: number;
2605
+ tokenCount: number;
2606
+ } | undefined;
2607
+ };
2608
+ title?: string | undefined;
2609
+ }, {
2610
+ status: "error" | "ok";
2611
+ kind: "response";
2612
+ schemaVersion: "1.0.0";
2613
+ traceId: string;
2614
+ spanId: string;
2615
+ parentSpanId: string | null;
2616
+ occurredAt: string;
2617
+ actor: {
2618
+ kind: "agent";
2619
+ id: string;
2620
+ name?: string | undefined;
2621
+ };
2622
+ payload: {
2623
+ text: string;
2624
+ streamingTelemetry?: {
2625
+ timeToFirstTokenMs: number;
2626
+ totalDurationMs: number;
2627
+ tokensPerSecond: number;
2628
+ tokenCount: number;
2629
+ } | undefined;
2630
+ };
2631
+ title?: string | undefined;
2632
+ links?: {
2633
+ spanId: string;
2634
+ rel: "follows" | "caused_by" | "handoff_to";
2635
+ }[] | undefined;
2636
+ }>, z.ZodObject<{
2637
+ schemaVersion: z.ZodLiteral<"1.0.0">;
2638
+ traceId: z.ZodString;
2639
+ spanId: z.ZodString;
2640
+ parentSpanId: z.ZodNullable<z.ZodString>;
2641
+ occurredAt: z.ZodString;
2642
+ status: z.ZodEnum<["ok", "error"]>;
2643
+ title: z.ZodOptional<z.ZodString>;
2644
+ links: z.ZodDefault<z.ZodArray<z.ZodObject<{
2645
+ rel: z.ZodEnum<["follows", "caused_by", "handoff_to"]>;
2646
+ spanId: z.ZodString;
2647
+ }, "strip", z.ZodTypeAny, {
2648
+ spanId: string;
2649
+ rel: "follows" | "caused_by" | "handoff_to";
2650
+ }, {
2651
+ spanId: string;
2652
+ rel: "follows" | "caused_by" | "handoff_to";
2653
+ }>, "many">>;
2654
+ } & {
2655
+ kind: z.ZodLiteral<"tool_call">;
2656
+ actor: z.ZodObject<{
2657
+ id: z.ZodString;
2658
+ name: z.ZodOptional<z.ZodString>;
2659
+ } & {
2660
+ kind: z.ZodLiteral<"tool">;
2661
+ }, "strip", z.ZodTypeAny, {
2662
+ kind: "tool";
2663
+ id: string;
2664
+ name?: string | undefined;
2665
+ }, {
2666
+ kind: "tool";
2667
+ id: string;
2668
+ name?: string | undefined;
2669
+ }>;
2670
+ payload: z.ZodObject<{
2671
+ input: z.ZodRecord<z.ZodString, z.ZodUnknown>;
2672
+ }, "strip", z.ZodTypeAny, {
2673
+ input: Record<string, unknown>;
2674
+ }, {
2675
+ input: Record<string, unknown>;
2676
+ }>;
2677
+ }, "strip", z.ZodTypeAny, {
2678
+ status: "error" | "ok";
2679
+ kind: "tool_call";
2680
+ schemaVersion: "1.0.0";
2681
+ traceId: string;
2682
+ spanId: string;
2683
+ parentSpanId: string | null;
2684
+ occurredAt: string;
2685
+ actor: {
2686
+ kind: "tool";
2687
+ id: string;
2688
+ name?: string | undefined;
2689
+ };
2690
+ links: {
2691
+ spanId: string;
2692
+ rel: "follows" | "caused_by" | "handoff_to";
2693
+ }[];
2694
+ payload: {
2695
+ input: Record<string, unknown>;
2696
+ };
2697
+ title?: string | undefined;
2698
+ }, {
2699
+ status: "error" | "ok";
2700
+ kind: "tool_call";
2701
+ schemaVersion: "1.0.0";
2702
+ traceId: string;
2703
+ spanId: string;
2704
+ parentSpanId: string | null;
2705
+ occurredAt: string;
2706
+ actor: {
2707
+ kind: "tool";
2708
+ id: string;
2709
+ name?: string | undefined;
2710
+ };
2711
+ payload: {
2712
+ input: Record<string, unknown>;
2713
+ };
2714
+ title?: string | undefined;
2715
+ links?: {
2716
+ spanId: string;
2717
+ rel: "follows" | "caused_by" | "handoff_to";
2718
+ }[] | undefined;
2719
+ }>, z.ZodObject<{
2720
+ schemaVersion: z.ZodLiteral<"1.0.0">;
2721
+ traceId: z.ZodString;
2722
+ spanId: z.ZodString;
2723
+ parentSpanId: z.ZodNullable<z.ZodString>;
2724
+ occurredAt: z.ZodString;
2725
+ status: z.ZodEnum<["ok", "error"]>;
2726
+ title: z.ZodOptional<z.ZodString>;
2727
+ links: z.ZodDefault<z.ZodArray<z.ZodObject<{
2728
+ rel: z.ZodEnum<["follows", "caused_by", "handoff_to"]>;
2729
+ spanId: z.ZodString;
2730
+ }, "strip", z.ZodTypeAny, {
2731
+ spanId: string;
2732
+ rel: "follows" | "caused_by" | "handoff_to";
2733
+ }, {
2734
+ spanId: string;
2735
+ rel: "follows" | "caused_by" | "handoff_to";
2736
+ }>, "many">>;
2737
+ } & {
2738
+ kind: z.ZodLiteral<"tool_result">;
2739
+ actor: z.ZodObject<{
2740
+ id: z.ZodString;
2741
+ name: z.ZodOptional<z.ZodString>;
2742
+ } & {
2743
+ kind: z.ZodLiteral<"tool">;
2744
+ }, "strip", z.ZodTypeAny, {
2745
+ kind: "tool";
2746
+ id: string;
2747
+ name?: string | undefined;
2748
+ }, {
2749
+ kind: "tool";
2750
+ id: string;
2751
+ name?: string | undefined;
2752
+ }>;
2753
+ payload: z.ZodObject<{
2754
+ output: z.ZodRecord<z.ZodString, z.ZodUnknown>;
2755
+ }, "strip", z.ZodTypeAny, {
2756
+ output: Record<string, unknown>;
2757
+ }, {
2758
+ output: Record<string, unknown>;
2759
+ }>;
2760
+ }, "strip", z.ZodTypeAny, {
2761
+ status: "error" | "ok";
2762
+ kind: "tool_result";
2763
+ schemaVersion: "1.0.0";
2764
+ traceId: string;
2765
+ spanId: string;
2766
+ parentSpanId: string | null;
2767
+ occurredAt: string;
2768
+ actor: {
2769
+ kind: "tool";
2770
+ id: string;
2771
+ name?: string | undefined;
2772
+ };
2773
+ links: {
2774
+ spanId: string;
2775
+ rel: "follows" | "caused_by" | "handoff_to";
2776
+ }[];
2777
+ payload: {
2778
+ output: Record<string, unknown>;
2779
+ };
2780
+ title?: string | undefined;
2781
+ }, {
2782
+ status: "error" | "ok";
2783
+ kind: "tool_result";
2784
+ schemaVersion: "1.0.0";
2785
+ traceId: string;
2786
+ spanId: string;
2787
+ parentSpanId: string | null;
2788
+ occurredAt: string;
2789
+ actor: {
2790
+ kind: "tool";
2791
+ id: string;
2792
+ name?: string | undefined;
2793
+ };
2794
+ payload: {
2795
+ output: Record<string, unknown>;
2796
+ };
2797
+ title?: string | undefined;
2798
+ links?: {
2799
+ spanId: string;
2800
+ rel: "follows" | "caused_by" | "handoff_to";
2801
+ }[] | undefined;
2802
+ }>, z.ZodObject<{
2803
+ schemaVersion: z.ZodLiteral<"1.0.0">;
2804
+ traceId: z.ZodString;
2805
+ spanId: z.ZodString;
2806
+ parentSpanId: z.ZodNullable<z.ZodString>;
2807
+ occurredAt: z.ZodString;
2808
+ status: z.ZodEnum<["ok", "error"]>;
2809
+ title: z.ZodOptional<z.ZodString>;
2810
+ links: z.ZodDefault<z.ZodArray<z.ZodObject<{
2811
+ rel: z.ZodEnum<["follows", "caused_by", "handoff_to"]>;
2812
+ spanId: z.ZodString;
2813
+ }, "strip", z.ZodTypeAny, {
2814
+ spanId: string;
2815
+ rel: "follows" | "caused_by" | "handoff_to";
2816
+ }, {
2817
+ spanId: string;
2818
+ rel: "follows" | "caused_by" | "handoff_to";
2819
+ }>, "many">>;
2820
+ } & {
2821
+ kind: z.ZodLiteral<"handoff">;
2822
+ actor: z.ZodObject<{
2823
+ id: z.ZodString;
2824
+ name: z.ZodOptional<z.ZodString>;
2825
+ } & {
2826
+ kind: z.ZodLiteral<"system">;
2827
+ }, "strip", z.ZodTypeAny, {
2828
+ kind: "system";
2829
+ id: string;
2830
+ name?: string | undefined;
2831
+ }, {
2832
+ kind: "system";
2833
+ id: string;
2834
+ name?: string | undefined;
2835
+ }>;
2836
+ payload: z.ZodObject<{
2837
+ fromAgentId: z.ZodString;
2838
+ toAgentId: z.ZodString;
2839
+ reason: z.ZodOptional<z.ZodString>;
2840
+ }, "strip", z.ZodTypeAny, {
2841
+ fromAgentId: string;
2842
+ toAgentId: string;
2843
+ reason?: string | undefined;
2844
+ }, {
2845
+ fromAgentId: string;
2846
+ toAgentId: string;
2847
+ reason?: string | undefined;
2848
+ }>;
2849
+ }, "strip", z.ZodTypeAny, {
2850
+ status: "error" | "ok";
2851
+ kind: "handoff";
2852
+ schemaVersion: "1.0.0";
2853
+ traceId: string;
2854
+ spanId: string;
2855
+ parentSpanId: string | null;
2856
+ occurredAt: string;
2857
+ actor: {
2858
+ kind: "system";
2859
+ id: string;
2860
+ name?: string | undefined;
2861
+ };
2862
+ links: {
2863
+ spanId: string;
2864
+ rel: "follows" | "caused_by" | "handoff_to";
2865
+ }[];
2866
+ payload: {
2867
+ fromAgentId: string;
2868
+ toAgentId: string;
2869
+ reason?: string | undefined;
2870
+ };
2871
+ title?: string | undefined;
2872
+ }, {
2873
+ status: "error" | "ok";
2874
+ kind: "handoff";
2875
+ schemaVersion: "1.0.0";
2876
+ traceId: string;
2877
+ spanId: string;
2878
+ parentSpanId: string | null;
2879
+ occurredAt: string;
2880
+ actor: {
2881
+ kind: "system";
2882
+ id: string;
2883
+ name?: string | undefined;
2884
+ };
2885
+ payload: {
2886
+ fromAgentId: string;
2887
+ toAgentId: string;
2888
+ reason?: string | undefined;
2889
+ };
2890
+ title?: string | undefined;
2891
+ links?: {
2892
+ spanId: string;
2893
+ rel: "follows" | "caused_by" | "handoff_to";
2894
+ }[] | undefined;
2895
+ }>, z.ZodObject<{
2896
+ schemaVersion: z.ZodLiteral<"1.0.0">;
2897
+ traceId: z.ZodString;
2898
+ spanId: z.ZodString;
2899
+ parentSpanId: z.ZodNullable<z.ZodString>;
2900
+ occurredAt: z.ZodString;
2901
+ actor: z.ZodObject<{
2902
+ kind: z.ZodEnum<["agent", "tool", "system"]>;
2903
+ id: z.ZodString;
2904
+ name: z.ZodOptional<z.ZodString>;
2905
+ }, "strip", z.ZodTypeAny, {
2906
+ kind: "agent" | "tool" | "system";
2907
+ id: string;
2908
+ name?: string | undefined;
2909
+ }, {
2910
+ kind: "agent" | "tool" | "system";
2911
+ id: string;
2912
+ name?: string | undefined;
2913
+ }>;
2914
+ status: z.ZodEnum<["ok", "error"]>;
2915
+ title: z.ZodOptional<z.ZodString>;
2916
+ links: z.ZodDefault<z.ZodArray<z.ZodObject<{
2917
+ rel: z.ZodEnum<["follows", "caused_by", "handoff_to"]>;
2918
+ spanId: z.ZodString;
2919
+ }, "strip", z.ZodTypeAny, {
2920
+ spanId: string;
2921
+ rel: "follows" | "caused_by" | "handoff_to";
2922
+ }, {
2923
+ spanId: string;
2924
+ rel: "follows" | "caused_by" | "handoff_to";
2925
+ }>, "many">>;
2926
+ } & {
2927
+ kind: z.ZodLiteral<"error">;
2928
+ payload: z.ZodObject<{
2929
+ message: z.ZodString;
2930
+ details: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2931
+ }, "strip", z.ZodTypeAny, {
2932
+ message: string;
2933
+ details: Record<string, unknown>;
2934
+ }, {
2935
+ message: string;
2936
+ details?: Record<string, unknown> | undefined;
2937
+ }>;
2938
+ }, "strip", z.ZodTypeAny, {
2939
+ status: "error" | "ok";
2940
+ kind: "error";
2941
+ schemaVersion: "1.0.0";
2942
+ traceId: string;
2943
+ spanId: string;
2944
+ parentSpanId: string | null;
2945
+ occurredAt: string;
2946
+ actor: {
2947
+ kind: "agent" | "tool" | "system";
2948
+ id: string;
2949
+ name?: string | undefined;
2950
+ };
2951
+ links: {
2952
+ spanId: string;
2953
+ rel: "follows" | "caused_by" | "handoff_to";
2954
+ }[];
2955
+ payload: {
2956
+ message: string;
2957
+ details: Record<string, unknown>;
2958
+ };
2959
+ title?: string | undefined;
2960
+ }, {
2961
+ status: "error" | "ok";
2962
+ kind: "error";
2963
+ schemaVersion: "1.0.0";
2964
+ traceId: string;
2965
+ spanId: string;
2966
+ parentSpanId: string | null;
2967
+ occurredAt: string;
2968
+ actor: {
2969
+ kind: "agent" | "tool" | "system";
2970
+ id: string;
2971
+ name?: string | undefined;
2972
+ };
2973
+ payload: {
2974
+ message: string;
2975
+ details?: Record<string, unknown> | undefined;
2976
+ };
2977
+ title?: string | undefined;
2978
+ links?: {
2979
+ spanId: string;
2980
+ rel: "follows" | "caused_by" | "handoff_to";
2981
+ }[] | undefined;
2982
+ }>, z.ZodObject<{
2983
+ schemaVersion: z.ZodLiteral<"1.0.0">;
2984
+ traceId: z.ZodString;
2985
+ spanId: z.ZodString;
2986
+ parentSpanId: z.ZodNullable<z.ZodString>;
2987
+ occurredAt: z.ZodString;
2988
+ actor: z.ZodObject<{
2989
+ kind: z.ZodEnum<["agent", "tool", "system"]>;
2990
+ id: z.ZodString;
2991
+ name: z.ZodOptional<z.ZodString>;
2992
+ }, "strip", z.ZodTypeAny, {
2993
+ kind: "agent" | "tool" | "system";
2994
+ id: string;
2995
+ name?: string | undefined;
2996
+ }, {
2997
+ kind: "agent" | "tool" | "system";
2998
+ id: string;
2999
+ name?: string | undefined;
3000
+ }>;
3001
+ status: z.ZodEnum<["ok", "error"]>;
3002
+ title: z.ZodOptional<z.ZodString>;
3003
+ links: z.ZodDefault<z.ZodArray<z.ZodObject<{
3004
+ rel: z.ZodEnum<["follows", "caused_by", "handoff_to"]>;
3005
+ spanId: z.ZodString;
3006
+ }, "strip", z.ZodTypeAny, {
3007
+ spanId: string;
3008
+ rel: "follows" | "caused_by" | "handoff_to";
3009
+ }, {
3010
+ spanId: string;
3011
+ rel: "follows" | "caused_by" | "handoff_to";
3012
+ }>, "many">>;
3013
+ } & {
3014
+ kind: z.ZodLiteral<"note">;
3015
+ payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
3016
+ }, "strip", z.ZodTypeAny, {
3017
+ status: "error" | "ok";
3018
+ kind: "note";
3019
+ schemaVersion: "1.0.0";
3020
+ traceId: string;
3021
+ spanId: string;
3022
+ parentSpanId: string | null;
3023
+ occurredAt: string;
3024
+ actor: {
3025
+ kind: "agent" | "tool" | "system";
3026
+ id: string;
3027
+ name?: string | undefined;
3028
+ };
3029
+ links: {
3030
+ spanId: string;
3031
+ rel: "follows" | "caused_by" | "handoff_to";
3032
+ }[];
3033
+ payload: Record<string, unknown>;
3034
+ title?: string | undefined;
3035
+ }, {
3036
+ status: "error" | "ok";
3037
+ kind: "note";
3038
+ schemaVersion: "1.0.0";
3039
+ traceId: string;
3040
+ spanId: string;
3041
+ parentSpanId: string | null;
3042
+ occurredAt: string;
3043
+ actor: {
3044
+ kind: "agent" | "tool" | "system";
3045
+ id: string;
3046
+ name?: string | undefined;
3047
+ };
3048
+ payload: Record<string, unknown>;
3049
+ title?: string | undefined;
3050
+ links?: {
3051
+ spanId: string;
3052
+ rel: "follows" | "caused_by" | "handoff_to";
3053
+ }[] | undefined;
3054
+ }>, z.ZodObject<{
3055
+ schemaVersion: z.ZodLiteral<"1.0.0">;
3056
+ traceId: z.ZodString;
3057
+ spanId: z.ZodString;
3058
+ parentSpanId: z.ZodNullable<z.ZodString>;
3059
+ occurredAt: z.ZodString;
3060
+ status: z.ZodEnum<["ok", "error"]>;
3061
+ title: z.ZodOptional<z.ZodString>;
3062
+ links: z.ZodDefault<z.ZodArray<z.ZodObject<{
3063
+ rel: z.ZodEnum<["follows", "caused_by", "handoff_to"]>;
3064
+ spanId: z.ZodString;
3065
+ }, "strip", z.ZodTypeAny, {
3066
+ spanId: string;
3067
+ rel: "follows" | "caused_by" | "handoff_to";
3068
+ }, {
3069
+ spanId: string;
3070
+ rel: "follows" | "caused_by" | "handoff_to";
3071
+ }>, "many">>;
3072
+ } & {
3073
+ kind: z.ZodLiteral<"state_snapshot">;
3074
+ actor: z.ZodObject<{
3075
+ id: z.ZodString;
3076
+ name: z.ZodOptional<z.ZodString>;
3077
+ } & {
3078
+ kind: z.ZodLiteral<"system">;
3079
+ }, "strip", z.ZodTypeAny, {
3080
+ kind: "system";
3081
+ id: string;
3082
+ name?: string | undefined;
3083
+ }, {
3084
+ kind: "system";
3085
+ id: string;
3086
+ name?: string | undefined;
3087
+ }>;
3088
+ payload: z.ZodObject<{
3089
+ nodeName: z.ZodString;
3090
+ stateHash: z.ZodString;
3091
+ stateDiff: z.ZodRecord<z.ZodString, z.ZodUnknown>;
3092
+ removedKeys: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
3093
+ fullState: z.ZodRecord<z.ZodString, z.ZodUnknown>;
3094
+ }, "strip", z.ZodTypeAny, {
3095
+ nodeName: string;
3096
+ stateHash: string;
3097
+ stateDiff: Record<string, unknown>;
3098
+ fullState: Record<string, unknown>;
3099
+ removedKeys?: string[] | undefined;
3100
+ }, {
3101
+ nodeName: string;
3102
+ stateHash: string;
3103
+ stateDiff: Record<string, unknown>;
3104
+ fullState: Record<string, unknown>;
3105
+ removedKeys?: string[] | undefined;
3106
+ }>;
3107
+ }, "strip", z.ZodTypeAny, {
3108
+ status: "error" | "ok";
3109
+ kind: "state_snapshot";
3110
+ schemaVersion: "1.0.0";
3111
+ traceId: string;
3112
+ spanId: string;
3113
+ parentSpanId: string | null;
3114
+ occurredAt: string;
3115
+ actor: {
3116
+ kind: "system";
3117
+ id: string;
3118
+ name?: string | undefined;
3119
+ };
3120
+ links: {
3121
+ spanId: string;
3122
+ rel: "follows" | "caused_by" | "handoff_to";
3123
+ }[];
3124
+ payload: {
3125
+ nodeName: string;
3126
+ stateHash: string;
3127
+ stateDiff: Record<string, unknown>;
3128
+ fullState: Record<string, unknown>;
3129
+ removedKeys?: string[] | undefined;
3130
+ };
3131
+ title?: string | undefined;
3132
+ }, {
3133
+ status: "error" | "ok";
3134
+ kind: "state_snapshot";
3135
+ schemaVersion: "1.0.0";
3136
+ traceId: string;
3137
+ spanId: string;
3138
+ parentSpanId: string | null;
3139
+ occurredAt: string;
3140
+ actor: {
3141
+ kind: "system";
3142
+ id: string;
3143
+ name?: string | undefined;
3144
+ };
3145
+ payload: {
3146
+ nodeName: string;
3147
+ stateHash: string;
3148
+ stateDiff: Record<string, unknown>;
3149
+ fullState: Record<string, unknown>;
3150
+ removedKeys?: string[] | undefined;
3151
+ };
3152
+ title?: string | undefined;
3153
+ links?: {
3154
+ spanId: string;
3155
+ rel: "follows" | "caused_by" | "handoff_to";
3156
+ }[] | undefined;
3157
+ }>, z.ZodObject<{
3158
+ schemaVersion: z.ZodLiteral<"1.0.0">;
3159
+ traceId: z.ZodString;
3160
+ spanId: z.ZodString;
3161
+ parentSpanId: z.ZodNullable<z.ZodString>;
3162
+ occurredAt: z.ZodString;
3163
+ status: z.ZodEnum<["ok", "error"]>;
3164
+ title: z.ZodOptional<z.ZodString>;
3165
+ links: z.ZodDefault<z.ZodArray<z.ZodObject<{
3166
+ rel: z.ZodEnum<["follows", "caused_by", "handoff_to"]>;
3167
+ spanId: z.ZodString;
3168
+ }, "strip", z.ZodTypeAny, {
3169
+ spanId: string;
3170
+ rel: "follows" | "caused_by" | "handoff_to";
3171
+ }, {
3172
+ spanId: string;
3173
+ rel: "follows" | "caused_by" | "handoff_to";
3174
+ }>, "many">>;
3175
+ } & {
3176
+ kind: z.ZodLiteral<"retriever">;
3177
+ actor: z.ZodObject<{
3178
+ id: z.ZodString;
3179
+ name: z.ZodOptional<z.ZodString>;
3180
+ } & {
3181
+ kind: z.ZodLiteral<"tool">;
3182
+ }, "strip", z.ZodTypeAny, {
3183
+ kind: "tool";
3184
+ id: string;
3185
+ name?: string | undefined;
3186
+ }, {
3187
+ kind: "tool";
3188
+ id: string;
3189
+ name?: string | undefined;
3190
+ }>;
3191
+ payload: z.ZodObject<{
3192
+ query: z.ZodString;
3193
+ documents: z.ZodArray<z.ZodObject<{
3194
+ pageContent: z.ZodString;
3195
+ metadata: z.ZodRecord<z.ZodString, z.ZodUnknown>;
3196
+ score: z.ZodOptional<z.ZodNumber>;
3197
+ }, "strip", z.ZodTypeAny, {
3198
+ pageContent: string;
3199
+ metadata: Record<string, unknown>;
3200
+ score?: number | undefined;
3201
+ }, {
3202
+ pageContent: string;
3203
+ metadata: Record<string, unknown>;
3204
+ score?: number | undefined;
3205
+ }>, "many">;
3206
+ }, "strip", z.ZodTypeAny, {
3207
+ query: string;
3208
+ documents: {
3209
+ pageContent: string;
3210
+ metadata: Record<string, unknown>;
3211
+ score?: number | undefined;
3212
+ }[];
3213
+ }, {
3214
+ query: string;
3215
+ documents: {
3216
+ pageContent: string;
3217
+ metadata: Record<string, unknown>;
3218
+ score?: number | undefined;
3219
+ }[];
3220
+ }>;
3221
+ }, "strip", z.ZodTypeAny, {
3222
+ status: "error" | "ok";
3223
+ kind: "retriever";
3224
+ schemaVersion: "1.0.0";
3225
+ traceId: string;
3226
+ spanId: string;
3227
+ parentSpanId: string | null;
3228
+ occurredAt: string;
3229
+ actor: {
3230
+ kind: "tool";
3231
+ id: string;
3232
+ name?: string | undefined;
3233
+ };
3234
+ links: {
3235
+ spanId: string;
3236
+ rel: "follows" | "caused_by" | "handoff_to";
3237
+ }[];
3238
+ payload: {
3239
+ query: string;
3240
+ documents: {
3241
+ pageContent: string;
3242
+ metadata: Record<string, unknown>;
3243
+ score?: number | undefined;
3244
+ }[];
3245
+ };
3246
+ title?: string | undefined;
3247
+ }, {
3248
+ status: "error" | "ok";
3249
+ kind: "retriever";
3250
+ schemaVersion: "1.0.0";
3251
+ traceId: string;
3252
+ spanId: string;
3253
+ parentSpanId: string | null;
3254
+ occurredAt: string;
3255
+ actor: {
3256
+ kind: "tool";
3257
+ id: string;
3258
+ name?: string | undefined;
3259
+ };
3260
+ payload: {
3261
+ query: string;
3262
+ documents: {
3263
+ pageContent: string;
3264
+ metadata: Record<string, unknown>;
3265
+ score?: number | undefined;
3266
+ }[];
3267
+ };
3268
+ title?: string | undefined;
3269
+ links?: {
3270
+ spanId: string;
3271
+ rel: "follows" | "caused_by" | "handoff_to";
3272
+ }[] | undefined;
3273
+ }>, z.ZodObject<{
3274
+ schemaVersion: z.ZodLiteral<"1.0.0">;
3275
+ traceId: z.ZodString;
3276
+ spanId: z.ZodString;
3277
+ parentSpanId: z.ZodNullable<z.ZodString>;
3278
+ occurredAt: z.ZodString;
3279
+ status: z.ZodEnum<["ok", "error"]>;
3280
+ title: z.ZodOptional<z.ZodString>;
3281
+ links: z.ZodDefault<z.ZodArray<z.ZodObject<{
3282
+ rel: z.ZodEnum<["follows", "caused_by", "handoff_to"]>;
3283
+ spanId: z.ZodString;
3284
+ }, "strip", z.ZodTypeAny, {
3285
+ spanId: string;
3286
+ rel: "follows" | "caused_by" | "handoff_to";
3287
+ }, {
3288
+ spanId: string;
3289
+ rel: "follows" | "caused_by" | "handoff_to";
3290
+ }>, "many">>;
3291
+ } & {
3292
+ kind: z.ZodLiteral<"checkpoint">;
3293
+ actor: z.ZodObject<{
3294
+ id: z.ZodString;
3295
+ name: z.ZodOptional<z.ZodString>;
3296
+ } & {
3297
+ kind: z.ZodLiteral<"system">;
3298
+ }, "strip", z.ZodTypeAny, {
3299
+ kind: "system";
3300
+ id: string;
3301
+ name?: string | undefined;
3302
+ }, {
3303
+ kind: "system";
3304
+ id: string;
3305
+ name?: string | undefined;
3306
+ }>;
3307
+ payload: z.ZodObject<{
3308
+ checkpointId: z.ZodString;
3309
+ reason: z.ZodString;
3310
+ state: z.ZodRecord<z.ZodString, z.ZodUnknown>;
3311
+ }, "strip", z.ZodTypeAny, {
3312
+ reason: string;
3313
+ checkpointId: string;
3314
+ state: Record<string, unknown>;
3315
+ }, {
3316
+ reason: string;
3317
+ checkpointId: string;
3318
+ state: Record<string, unknown>;
3319
+ }>;
3320
+ }, "strip", z.ZodTypeAny, {
3321
+ status: "error" | "ok";
3322
+ kind: "checkpoint";
3323
+ schemaVersion: "1.0.0";
3324
+ traceId: string;
3325
+ spanId: string;
3326
+ parentSpanId: string | null;
3327
+ occurredAt: string;
3328
+ actor: {
3329
+ kind: "system";
3330
+ id: string;
3331
+ name?: string | undefined;
3332
+ };
3333
+ links: {
3334
+ spanId: string;
3335
+ rel: "follows" | "caused_by" | "handoff_to";
3336
+ }[];
3337
+ payload: {
3338
+ reason: string;
3339
+ checkpointId: string;
3340
+ state: Record<string, unknown>;
3341
+ };
3342
+ title?: string | undefined;
3343
+ }, {
3344
+ status: "error" | "ok";
3345
+ kind: "checkpoint";
3346
+ schemaVersion: "1.0.0";
3347
+ traceId: string;
3348
+ spanId: string;
3349
+ parentSpanId: string | null;
3350
+ occurredAt: string;
3351
+ actor: {
3352
+ kind: "system";
3353
+ id: string;
3354
+ name?: string | undefined;
3355
+ };
3356
+ payload: {
3357
+ reason: string;
3358
+ checkpointId: string;
3359
+ state: Record<string, unknown>;
3360
+ };
3361
+ title?: string | undefined;
3362
+ links?: {
3363
+ spanId: string;
3364
+ rel: "follows" | "caused_by" | "handoff_to";
3365
+ }[] | undefined;
3366
+ }>]>, "many">;
3367
+ }, "strip", z.ZodTypeAny, {
3368
+ events: ({
3369
+ status: "error" | "ok";
3370
+ kind: "prompt";
3371
+ schemaVersion: "1.0.0";
3372
+ traceId: string;
3373
+ spanId: string;
3374
+ parentSpanId: string | null;
3375
+ occurredAt: string;
3376
+ actor: {
3377
+ kind: "agent";
3378
+ id: string;
3379
+ name?: string | undefined;
3380
+ };
3381
+ links: {
3382
+ spanId: string;
3383
+ rel: "follows" | "caused_by" | "handoff_to";
3384
+ }[];
3385
+ payload: {
3386
+ text: string;
3387
+ };
3388
+ title?: string | undefined;
3389
+ } | {
3390
+ status: "error" | "ok";
3391
+ kind: "response";
3392
+ schemaVersion: "1.0.0";
3393
+ traceId: string;
3394
+ spanId: string;
3395
+ parentSpanId: string | null;
3396
+ occurredAt: string;
3397
+ actor: {
3398
+ kind: "agent";
3399
+ id: string;
3400
+ name?: string | undefined;
3401
+ };
3402
+ links: {
3403
+ spanId: string;
3404
+ rel: "follows" | "caused_by" | "handoff_to";
3405
+ }[];
3406
+ payload: {
3407
+ text: string;
3408
+ streamingTelemetry?: {
3409
+ timeToFirstTokenMs: number;
3410
+ totalDurationMs: number;
3411
+ tokensPerSecond: number;
3412
+ tokenCount: number;
3413
+ } | undefined;
3414
+ };
3415
+ title?: string | undefined;
3416
+ } | {
3417
+ status: "error" | "ok";
3418
+ kind: "tool_call";
3419
+ schemaVersion: "1.0.0";
3420
+ traceId: string;
3421
+ spanId: string;
3422
+ parentSpanId: string | null;
3423
+ occurredAt: string;
3424
+ actor: {
3425
+ kind: "tool";
3426
+ id: string;
3427
+ name?: string | undefined;
3428
+ };
3429
+ links: {
3430
+ spanId: string;
3431
+ rel: "follows" | "caused_by" | "handoff_to";
3432
+ }[];
3433
+ payload: {
3434
+ input: Record<string, unknown>;
3435
+ };
3436
+ title?: string | undefined;
3437
+ } | {
3438
+ status: "error" | "ok";
3439
+ kind: "tool_result";
3440
+ schemaVersion: "1.0.0";
3441
+ traceId: string;
3442
+ spanId: string;
3443
+ parentSpanId: string | null;
3444
+ occurredAt: string;
3445
+ actor: {
3446
+ kind: "tool";
3447
+ id: string;
3448
+ name?: string | undefined;
3449
+ };
3450
+ links: {
3451
+ spanId: string;
3452
+ rel: "follows" | "caused_by" | "handoff_to";
3453
+ }[];
3454
+ payload: {
3455
+ output: Record<string, unknown>;
3456
+ };
3457
+ title?: string | undefined;
3458
+ } | {
3459
+ status: "error" | "ok";
3460
+ kind: "handoff";
3461
+ schemaVersion: "1.0.0";
3462
+ traceId: string;
3463
+ spanId: string;
3464
+ parentSpanId: string | null;
3465
+ occurredAt: string;
3466
+ actor: {
3467
+ kind: "system";
3468
+ id: string;
3469
+ name?: string | undefined;
3470
+ };
3471
+ links: {
3472
+ spanId: string;
3473
+ rel: "follows" | "caused_by" | "handoff_to";
3474
+ }[];
3475
+ payload: {
3476
+ fromAgentId: string;
3477
+ toAgentId: string;
3478
+ reason?: string | undefined;
3479
+ };
3480
+ title?: string | undefined;
3481
+ } | {
3482
+ status: "error" | "ok";
3483
+ kind: "error";
3484
+ schemaVersion: "1.0.0";
3485
+ traceId: string;
3486
+ spanId: string;
3487
+ parentSpanId: string | null;
3488
+ occurredAt: string;
3489
+ actor: {
3490
+ kind: "agent" | "tool" | "system";
3491
+ id: string;
3492
+ name?: string | undefined;
3493
+ };
3494
+ links: {
3495
+ spanId: string;
3496
+ rel: "follows" | "caused_by" | "handoff_to";
3497
+ }[];
3498
+ payload: {
3499
+ message: string;
3500
+ details: Record<string, unknown>;
3501
+ };
3502
+ title?: string | undefined;
3503
+ } | {
3504
+ status: "error" | "ok";
3505
+ kind: "note";
3506
+ schemaVersion: "1.0.0";
3507
+ traceId: string;
3508
+ spanId: string;
3509
+ parentSpanId: string | null;
3510
+ occurredAt: string;
3511
+ actor: {
3512
+ kind: "agent" | "tool" | "system";
3513
+ id: string;
3514
+ name?: string | undefined;
3515
+ };
3516
+ links: {
3517
+ spanId: string;
3518
+ rel: "follows" | "caused_by" | "handoff_to";
3519
+ }[];
3520
+ payload: Record<string, unknown>;
3521
+ title?: string | undefined;
3522
+ } | {
3523
+ status: "error" | "ok";
3524
+ kind: "state_snapshot";
3525
+ schemaVersion: "1.0.0";
3526
+ traceId: string;
3527
+ spanId: string;
3528
+ parentSpanId: string | null;
3529
+ occurredAt: string;
3530
+ actor: {
3531
+ kind: "system";
3532
+ id: string;
3533
+ name?: string | undefined;
3534
+ };
3535
+ links: {
3536
+ spanId: string;
3537
+ rel: "follows" | "caused_by" | "handoff_to";
3538
+ }[];
3539
+ payload: {
3540
+ nodeName: string;
3541
+ stateHash: string;
3542
+ stateDiff: Record<string, unknown>;
3543
+ fullState: Record<string, unknown>;
3544
+ removedKeys?: string[] | undefined;
3545
+ };
3546
+ title?: string | undefined;
3547
+ } | {
3548
+ status: "error" | "ok";
3549
+ kind: "retriever";
3550
+ schemaVersion: "1.0.0";
3551
+ traceId: string;
3552
+ spanId: string;
3553
+ parentSpanId: string | null;
3554
+ occurredAt: string;
3555
+ actor: {
3556
+ kind: "tool";
3557
+ id: string;
3558
+ name?: string | undefined;
3559
+ };
3560
+ links: {
3561
+ spanId: string;
3562
+ rel: "follows" | "caused_by" | "handoff_to";
3563
+ }[];
3564
+ payload: {
3565
+ query: string;
3566
+ documents: {
3567
+ pageContent: string;
3568
+ metadata: Record<string, unknown>;
3569
+ score?: number | undefined;
3570
+ }[];
3571
+ };
3572
+ title?: string | undefined;
3573
+ } | {
3574
+ status: "error" | "ok";
3575
+ kind: "checkpoint";
3576
+ schemaVersion: "1.0.0";
3577
+ traceId: string;
3578
+ spanId: string;
3579
+ parentSpanId: string | null;
3580
+ occurredAt: string;
3581
+ actor: {
3582
+ kind: "system";
3583
+ id: string;
3584
+ name?: string | undefined;
3585
+ };
3586
+ links: {
3587
+ spanId: string;
3588
+ rel: "follows" | "caused_by" | "handoff_to";
3589
+ }[];
3590
+ payload: {
3591
+ reason: string;
3592
+ checkpointId: string;
3593
+ state: Record<string, unknown>;
3594
+ };
3595
+ title?: string | undefined;
3596
+ })[];
3597
+ meta: {
3598
+ traceId: string;
3599
+ createdAt: string;
3600
+ rootSpanId: string | null;
3601
+ updatedAt: string;
3602
+ eventCount: number;
3603
+ derivedFrom?: {
3604
+ baseTraceId: string;
3605
+ forkedFromSpanId: string;
3606
+ } | undefined;
3607
+ };
3608
+ }, {
3609
+ events: ({
3610
+ status: "error" | "ok";
3611
+ kind: "prompt";
3612
+ schemaVersion: "1.0.0";
3613
+ traceId: string;
3614
+ spanId: string;
3615
+ parentSpanId: string | null;
3616
+ occurredAt: string;
3617
+ actor: {
3618
+ kind: "agent";
3619
+ id: string;
3620
+ name?: string | undefined;
3621
+ };
3622
+ payload: {
3623
+ text: string;
3624
+ };
3625
+ title?: string | undefined;
3626
+ links?: {
3627
+ spanId: string;
3628
+ rel: "follows" | "caused_by" | "handoff_to";
3629
+ }[] | undefined;
3630
+ } | {
3631
+ status: "error" | "ok";
3632
+ kind: "response";
3633
+ schemaVersion: "1.0.0";
3634
+ traceId: string;
3635
+ spanId: string;
3636
+ parentSpanId: string | null;
3637
+ occurredAt: string;
3638
+ actor: {
3639
+ kind: "agent";
3640
+ id: string;
3641
+ name?: string | undefined;
3642
+ };
3643
+ payload: {
3644
+ text: string;
3645
+ streamingTelemetry?: {
3646
+ timeToFirstTokenMs: number;
3647
+ totalDurationMs: number;
3648
+ tokensPerSecond: number;
3649
+ tokenCount: number;
3650
+ } | undefined;
3651
+ };
3652
+ title?: string | undefined;
3653
+ links?: {
3654
+ spanId: string;
3655
+ rel: "follows" | "caused_by" | "handoff_to";
3656
+ }[] | undefined;
3657
+ } | {
3658
+ status: "error" | "ok";
3659
+ kind: "tool_call";
3660
+ schemaVersion: "1.0.0";
3661
+ traceId: string;
3662
+ spanId: string;
3663
+ parentSpanId: string | null;
3664
+ occurredAt: string;
3665
+ actor: {
3666
+ kind: "tool";
3667
+ id: string;
3668
+ name?: string | undefined;
3669
+ };
3670
+ payload: {
3671
+ input: Record<string, unknown>;
3672
+ };
3673
+ title?: string | undefined;
3674
+ links?: {
3675
+ spanId: string;
3676
+ rel: "follows" | "caused_by" | "handoff_to";
3677
+ }[] | undefined;
3678
+ } | {
3679
+ status: "error" | "ok";
3680
+ kind: "tool_result";
3681
+ schemaVersion: "1.0.0";
3682
+ traceId: string;
3683
+ spanId: string;
3684
+ parentSpanId: string | null;
3685
+ occurredAt: string;
3686
+ actor: {
3687
+ kind: "tool";
3688
+ id: string;
3689
+ name?: string | undefined;
3690
+ };
3691
+ payload: {
3692
+ output: Record<string, unknown>;
3693
+ };
3694
+ title?: string | undefined;
3695
+ links?: {
3696
+ spanId: string;
3697
+ rel: "follows" | "caused_by" | "handoff_to";
3698
+ }[] | undefined;
3699
+ } | {
3700
+ status: "error" | "ok";
3701
+ kind: "handoff";
3702
+ schemaVersion: "1.0.0";
3703
+ traceId: string;
3704
+ spanId: string;
3705
+ parentSpanId: string | null;
3706
+ occurredAt: string;
3707
+ actor: {
3708
+ kind: "system";
3709
+ id: string;
3710
+ name?: string | undefined;
3711
+ };
3712
+ payload: {
3713
+ fromAgentId: string;
3714
+ toAgentId: string;
3715
+ reason?: string | undefined;
3716
+ };
3717
+ title?: string | undefined;
3718
+ links?: {
3719
+ spanId: string;
3720
+ rel: "follows" | "caused_by" | "handoff_to";
3721
+ }[] | undefined;
3722
+ } | {
3723
+ status: "error" | "ok";
3724
+ kind: "error";
3725
+ schemaVersion: "1.0.0";
3726
+ traceId: string;
3727
+ spanId: string;
3728
+ parentSpanId: string | null;
3729
+ occurredAt: string;
3730
+ actor: {
3731
+ kind: "agent" | "tool" | "system";
3732
+ id: string;
3733
+ name?: string | undefined;
3734
+ };
3735
+ payload: {
3736
+ message: string;
3737
+ details?: Record<string, unknown> | undefined;
3738
+ };
3739
+ title?: string | undefined;
3740
+ links?: {
3741
+ spanId: string;
3742
+ rel: "follows" | "caused_by" | "handoff_to";
3743
+ }[] | undefined;
3744
+ } | {
3745
+ status: "error" | "ok";
3746
+ kind: "note";
3747
+ schemaVersion: "1.0.0";
3748
+ traceId: string;
3749
+ spanId: string;
3750
+ parentSpanId: string | null;
3751
+ occurredAt: string;
3752
+ actor: {
3753
+ kind: "agent" | "tool" | "system";
3754
+ id: string;
3755
+ name?: string | undefined;
3756
+ };
3757
+ payload: Record<string, unknown>;
3758
+ title?: string | undefined;
3759
+ links?: {
3760
+ spanId: string;
3761
+ rel: "follows" | "caused_by" | "handoff_to";
3762
+ }[] | undefined;
3763
+ } | {
3764
+ status: "error" | "ok";
3765
+ kind: "state_snapshot";
3766
+ schemaVersion: "1.0.0";
3767
+ traceId: string;
3768
+ spanId: string;
3769
+ parentSpanId: string | null;
3770
+ occurredAt: string;
3771
+ actor: {
3772
+ kind: "system";
3773
+ id: string;
3774
+ name?: string | undefined;
3775
+ };
3776
+ payload: {
3777
+ nodeName: string;
3778
+ stateHash: string;
3779
+ stateDiff: Record<string, unknown>;
3780
+ fullState: Record<string, unknown>;
3781
+ removedKeys?: string[] | undefined;
3782
+ };
3783
+ title?: string | undefined;
3784
+ links?: {
3785
+ spanId: string;
3786
+ rel: "follows" | "caused_by" | "handoff_to";
3787
+ }[] | undefined;
3788
+ } | {
3789
+ status: "error" | "ok";
3790
+ kind: "retriever";
3791
+ schemaVersion: "1.0.0";
3792
+ traceId: string;
3793
+ spanId: string;
3794
+ parentSpanId: string | null;
3795
+ occurredAt: string;
3796
+ actor: {
3797
+ kind: "tool";
3798
+ id: string;
3799
+ name?: string | undefined;
3800
+ };
3801
+ payload: {
3802
+ query: string;
3803
+ documents: {
3804
+ pageContent: string;
3805
+ metadata: Record<string, unknown>;
3806
+ score?: number | undefined;
3807
+ }[];
3808
+ };
3809
+ title?: string | undefined;
3810
+ links?: {
3811
+ spanId: string;
3812
+ rel: "follows" | "caused_by" | "handoff_to";
3813
+ }[] | undefined;
3814
+ } | {
3815
+ status: "error" | "ok";
3816
+ kind: "checkpoint";
3817
+ schemaVersion: "1.0.0";
3818
+ traceId: string;
3819
+ spanId: string;
3820
+ parentSpanId: string | null;
3821
+ occurredAt: string;
3822
+ actor: {
3823
+ kind: "system";
3824
+ id: string;
3825
+ name?: string | undefined;
3826
+ };
3827
+ payload: {
3828
+ reason: string;
3829
+ checkpointId: string;
3830
+ state: Record<string, unknown>;
3831
+ };
3832
+ title?: string | undefined;
3833
+ links?: {
3834
+ spanId: string;
3835
+ rel: "follows" | "caused_by" | "handoff_to";
3836
+ }[] | undefined;
3837
+ })[];
3838
+ meta: {
3839
+ traceId: string;
3840
+ createdAt: string;
3841
+ rootSpanId: string | null;
3842
+ updatedAt: string;
3843
+ eventCount: number;
3844
+ derivedFrom?: {
3845
+ baseTraceId: string;
3846
+ forkedFromSpanId: string;
3847
+ } | undefined;
3848
+ };
3849
+ }>;
3850
+ export type TraceWithMeta = z.infer<typeof traceWithMetaSchema>;
3851
+ export declare const traceListResponseSchema: z.ZodObject<{
3852
+ traces: z.ZodArray<z.ZodObject<{
3853
+ traceId: z.ZodString;
3854
+ createdAt: z.ZodString;
3855
+ updatedAt: z.ZodString;
3856
+ eventCount: z.ZodNumber;
3857
+ rootSpanId: z.ZodNullable<z.ZodString>;
3858
+ derivedFrom: z.ZodOptional<z.ZodObject<{
3859
+ baseTraceId: z.ZodString;
3860
+ forkedFromSpanId: z.ZodString;
3861
+ }, "strip", z.ZodTypeAny, {
3862
+ baseTraceId: string;
3863
+ forkedFromSpanId: string;
3864
+ }, {
3865
+ baseTraceId: string;
3866
+ forkedFromSpanId: string;
3867
+ }>>;
3868
+ }, "strip", z.ZodTypeAny, {
3869
+ traceId: string;
3870
+ createdAt: string;
3871
+ rootSpanId: string | null;
3872
+ updatedAt: string;
3873
+ eventCount: number;
3874
+ derivedFrom?: {
3875
+ baseTraceId: string;
3876
+ forkedFromSpanId: string;
3877
+ } | undefined;
3878
+ }, {
3879
+ traceId: string;
3880
+ createdAt: string;
3881
+ rootSpanId: string | null;
3882
+ updatedAt: string;
3883
+ eventCount: number;
3884
+ derivedFrom?: {
3885
+ baseTraceId: string;
3886
+ forkedFromSpanId: string;
3887
+ } | undefined;
3888
+ }>, "many">;
3889
+ }, "strip", z.ZodTypeAny, {
3890
+ traces: {
3891
+ traceId: string;
3892
+ createdAt: string;
3893
+ rootSpanId: string | null;
3894
+ updatedAt: string;
3895
+ eventCount: number;
3896
+ derivedFrom?: {
3897
+ baseTraceId: string;
3898
+ forkedFromSpanId: string;
3899
+ } | undefined;
3900
+ }[];
3901
+ }, {
3902
+ traces: {
3903
+ traceId: string;
3904
+ createdAt: string;
3905
+ rootSpanId: string | null;
3906
+ updatedAt: string;
3907
+ eventCount: number;
3908
+ derivedFrom?: {
3909
+ baseTraceId: string;
3910
+ forkedFromSpanId: string;
3911
+ } | undefined;
3912
+ }[];
3913
+ }>;
3914
+ export type TraceListResponse = z.infer<typeof traceListResponseSchema>;
3915
+ export declare const traceAnalysisSchema: z.ZodObject<{
3916
+ loops: z.ZodArray<z.ZodObject<{
3917
+ kind: z.ZodOptional<z.ZodEnum<["repeated_sequence", "recursive_tool", "handoff_cycle"]>>;
3918
+ severity: z.ZodOptional<z.ZodEnum<["low", "medium", "high"]>>;
3919
+ reason: z.ZodString;
3920
+ spanIds: z.ZodArray<z.ZodString, "many">;
3921
+ }, "strip", z.ZodTypeAny, {
3922
+ reason: string;
3923
+ spanIds: string[];
3924
+ kind?: "repeated_sequence" | "recursive_tool" | "handoff_cycle" | undefined;
3925
+ severity?: "low" | "medium" | "high" | undefined;
3926
+ }, {
3927
+ reason: string;
3928
+ spanIds: string[];
3929
+ kind?: "repeated_sequence" | "recursive_tool" | "handoff_cycle" | undefined;
3930
+ severity?: "low" | "medium" | "high" | undefined;
3931
+ }>, "many">;
3932
+ failures: z.ZodArray<z.ZodObject<{
3933
+ spanId: z.ZodString;
3934
+ title: z.ZodOptional<z.ZodString>;
3935
+ }, "strip", z.ZodTypeAny, {
3936
+ spanId: string;
3937
+ title?: string | undefined;
3938
+ }, {
3939
+ spanId: string;
3940
+ title?: string | undefined;
3941
+ }>, "many">;
3942
+ stats: z.ZodObject<{
3943
+ eventCount: z.ZodNumber;
3944
+ actorCount: z.ZodNumber;
3945
+ }, "strip", z.ZodTypeAny, {
3946
+ eventCount: number;
3947
+ actorCount: number;
3948
+ }, {
3949
+ eventCount: number;
3950
+ actorCount: number;
3951
+ }>;
3952
+ }, "strip", z.ZodTypeAny, {
3953
+ loops: {
3954
+ reason: string;
3955
+ spanIds: string[];
3956
+ kind?: "repeated_sequence" | "recursive_tool" | "handoff_cycle" | undefined;
3957
+ severity?: "low" | "medium" | "high" | undefined;
3958
+ }[];
3959
+ failures: {
3960
+ spanId: string;
3961
+ title?: string | undefined;
3962
+ }[];
3963
+ stats: {
3964
+ eventCount: number;
3965
+ actorCount: number;
3966
+ };
3967
+ }, {
3968
+ loops: {
3969
+ reason: string;
3970
+ spanIds: string[];
3971
+ kind?: "repeated_sequence" | "recursive_tool" | "handoff_cycle" | undefined;
3972
+ severity?: "low" | "medium" | "high" | undefined;
3973
+ }[];
3974
+ failures: {
3975
+ spanId: string;
3976
+ title?: string | undefined;
3977
+ }[];
3978
+ stats: {
3979
+ eventCount: number;
3980
+ actorCount: number;
3981
+ };
3982
+ }>;
3983
+ export type TraceAnalysis = z.infer<typeof traceAnalysisSchema>;
3984
+ export declare const traceForkRequestSchema: z.ZodObject<{
3985
+ forkFromSpanId: z.ZodString;
3986
+ overrides: z.ZodOptional<z.ZodObject<{
3987
+ promptText: z.ZodOptional<z.ZodString>;
3988
+ }, "strip", z.ZodTypeAny, {
3989
+ promptText?: string | undefined;
3990
+ }, {
3991
+ promptText?: string | undefined;
3992
+ }>>;
3993
+ }, "strip", z.ZodTypeAny, {
3994
+ forkFromSpanId: string;
3995
+ overrides?: {
3996
+ promptText?: string | undefined;
3997
+ } | undefined;
3998
+ }, {
3999
+ forkFromSpanId: string;
4000
+ overrides?: {
4001
+ promptText?: string | undefined;
4002
+ } | undefined;
4003
+ }>;
4004
+ export type TraceForkRequest = z.infer<typeof traceForkRequestSchema>;
4005
+ export declare const traceForkResponseSchema: z.ZodObject<{
4006
+ traceId: z.ZodString;
4007
+ }, "strip", z.ZodTypeAny, {
4008
+ traceId: string;
4009
+ }, {
4010
+ traceId: string;
4011
+ }>;
4012
+ export type TraceForkResponse = z.infer<typeof traceForkResponseSchema>;
4013
+ export declare const traceLineageEdgeSchema: z.ZodObject<{
4014
+ parentTraceId: z.ZodString;
4015
+ childTraceId: z.ZodString;
4016
+ forkedFromSpanId: z.ZodString;
4017
+ createdAt: z.ZodString;
4018
+ overrides: z.ZodOptional<z.ZodObject<{
4019
+ promptText: z.ZodOptional<z.ZodString>;
4020
+ }, "strip", z.ZodTypeAny, {
4021
+ promptText?: string | undefined;
4022
+ }, {
4023
+ promptText?: string | undefined;
4024
+ }>>;
4025
+ }, "strip", z.ZodTypeAny, {
4026
+ createdAt: string;
4027
+ forkedFromSpanId: string;
4028
+ parentTraceId: string;
4029
+ childTraceId: string;
4030
+ overrides?: {
4031
+ promptText?: string | undefined;
4032
+ } | undefined;
4033
+ }, {
4034
+ createdAt: string;
4035
+ forkedFromSpanId: string;
4036
+ parentTraceId: string;
4037
+ childTraceId: string;
4038
+ overrides?: {
4039
+ promptText?: string | undefined;
4040
+ } | undefined;
4041
+ }>;
4042
+ export type TraceLineageEdge = z.infer<typeof traceLineageEdgeSchema>;
4043
+ export declare const traceLineageGraphSchema: z.ZodObject<{
4044
+ rootTraceId: z.ZodString;
4045
+ nodes: z.ZodArray<z.ZodObject<{
4046
+ traceId: z.ZodString;
4047
+ createdAt: z.ZodString;
4048
+ updatedAt: z.ZodString;
4049
+ eventCount: z.ZodNumber;
4050
+ rootSpanId: z.ZodNullable<z.ZodString>;
4051
+ derivedFrom: z.ZodOptional<z.ZodObject<{
4052
+ baseTraceId: z.ZodString;
4053
+ forkedFromSpanId: z.ZodString;
4054
+ }, "strip", z.ZodTypeAny, {
4055
+ baseTraceId: string;
4056
+ forkedFromSpanId: string;
4057
+ }, {
4058
+ baseTraceId: string;
4059
+ forkedFromSpanId: string;
4060
+ }>>;
4061
+ }, "strip", z.ZodTypeAny, {
4062
+ traceId: string;
4063
+ createdAt: string;
4064
+ rootSpanId: string | null;
4065
+ updatedAt: string;
4066
+ eventCount: number;
4067
+ derivedFrom?: {
4068
+ baseTraceId: string;
4069
+ forkedFromSpanId: string;
4070
+ } | undefined;
4071
+ }, {
4072
+ traceId: string;
4073
+ createdAt: string;
4074
+ rootSpanId: string | null;
4075
+ updatedAt: string;
4076
+ eventCount: number;
4077
+ derivedFrom?: {
4078
+ baseTraceId: string;
4079
+ forkedFromSpanId: string;
4080
+ } | undefined;
4081
+ }>, "many">;
4082
+ edges: z.ZodArray<z.ZodObject<{
4083
+ parentTraceId: z.ZodString;
4084
+ childTraceId: z.ZodString;
4085
+ forkedFromSpanId: z.ZodString;
4086
+ createdAt: z.ZodString;
4087
+ overrides: z.ZodOptional<z.ZodObject<{
4088
+ promptText: z.ZodOptional<z.ZodString>;
4089
+ }, "strip", z.ZodTypeAny, {
4090
+ promptText?: string | undefined;
4091
+ }, {
4092
+ promptText?: string | undefined;
4093
+ }>>;
4094
+ }, "strip", z.ZodTypeAny, {
4095
+ createdAt: string;
4096
+ forkedFromSpanId: string;
4097
+ parentTraceId: string;
4098
+ childTraceId: string;
4099
+ overrides?: {
4100
+ promptText?: string | undefined;
4101
+ } | undefined;
4102
+ }, {
4103
+ createdAt: string;
4104
+ forkedFromSpanId: string;
4105
+ parentTraceId: string;
4106
+ childTraceId: string;
4107
+ overrides?: {
4108
+ promptText?: string | undefined;
4109
+ } | undefined;
4110
+ }>, "many">;
4111
+ }, "strip", z.ZodTypeAny, {
4112
+ rootTraceId: string;
4113
+ nodes: {
4114
+ traceId: string;
4115
+ createdAt: string;
4116
+ rootSpanId: string | null;
4117
+ updatedAt: string;
4118
+ eventCount: number;
4119
+ derivedFrom?: {
4120
+ baseTraceId: string;
4121
+ forkedFromSpanId: string;
4122
+ } | undefined;
4123
+ }[];
4124
+ edges: {
4125
+ createdAt: string;
4126
+ forkedFromSpanId: string;
4127
+ parentTraceId: string;
4128
+ childTraceId: string;
4129
+ overrides?: {
4130
+ promptText?: string | undefined;
4131
+ } | undefined;
4132
+ }[];
4133
+ }, {
4134
+ rootTraceId: string;
4135
+ nodes: {
4136
+ traceId: string;
4137
+ createdAt: string;
4138
+ rootSpanId: string | null;
4139
+ updatedAt: string;
4140
+ eventCount: number;
4141
+ derivedFrom?: {
4142
+ baseTraceId: string;
4143
+ forkedFromSpanId: string;
4144
+ } | undefined;
4145
+ }[];
4146
+ edges: {
4147
+ createdAt: string;
4148
+ forkedFromSpanId: string;
4149
+ parentTraceId: string;
4150
+ childTraceId: string;
4151
+ overrides?: {
4152
+ promptText?: string | undefined;
4153
+ } | undefined;
4154
+ }[];
4155
+ }>;
4156
+ export type TraceLineageGraph = z.infer<typeof traceLineageGraphSchema>;
4157
+ export declare const traceDiffResultSchema: z.ZodObject<{
4158
+ a: z.ZodObject<{
4159
+ traceId: z.ZodString;
4160
+ createdAt: z.ZodString;
4161
+ updatedAt: z.ZodString;
4162
+ eventCount: z.ZodNumber;
4163
+ rootSpanId: z.ZodNullable<z.ZodString>;
4164
+ derivedFrom: z.ZodOptional<z.ZodObject<{
4165
+ baseTraceId: z.ZodString;
4166
+ forkedFromSpanId: z.ZodString;
4167
+ }, "strip", z.ZodTypeAny, {
4168
+ baseTraceId: string;
4169
+ forkedFromSpanId: string;
4170
+ }, {
4171
+ baseTraceId: string;
4172
+ forkedFromSpanId: string;
4173
+ }>>;
4174
+ }, "strip", z.ZodTypeAny, {
4175
+ traceId: string;
4176
+ createdAt: string;
4177
+ rootSpanId: string | null;
4178
+ updatedAt: string;
4179
+ eventCount: number;
4180
+ derivedFrom?: {
4181
+ baseTraceId: string;
4182
+ forkedFromSpanId: string;
4183
+ } | undefined;
4184
+ }, {
4185
+ traceId: string;
4186
+ createdAt: string;
4187
+ rootSpanId: string | null;
4188
+ updatedAt: string;
4189
+ eventCount: number;
4190
+ derivedFrom?: {
4191
+ baseTraceId: string;
4192
+ forkedFromSpanId: string;
4193
+ } | undefined;
4194
+ }>;
4195
+ b: z.ZodObject<{
4196
+ traceId: z.ZodString;
4197
+ createdAt: z.ZodString;
4198
+ updatedAt: z.ZodString;
4199
+ eventCount: z.ZodNumber;
4200
+ rootSpanId: z.ZodNullable<z.ZodString>;
4201
+ derivedFrom: z.ZodOptional<z.ZodObject<{
4202
+ baseTraceId: z.ZodString;
4203
+ forkedFromSpanId: z.ZodString;
4204
+ }, "strip", z.ZodTypeAny, {
4205
+ baseTraceId: string;
4206
+ forkedFromSpanId: string;
4207
+ }, {
4208
+ baseTraceId: string;
4209
+ forkedFromSpanId: string;
4210
+ }>>;
4211
+ }, "strip", z.ZodTypeAny, {
4212
+ traceId: string;
4213
+ createdAt: string;
4214
+ rootSpanId: string | null;
4215
+ updatedAt: string;
4216
+ eventCount: number;
4217
+ derivedFrom?: {
4218
+ baseTraceId: string;
4219
+ forkedFromSpanId: string;
4220
+ } | undefined;
4221
+ }, {
4222
+ traceId: string;
4223
+ createdAt: string;
4224
+ rootSpanId: string | null;
4225
+ updatedAt: string;
4226
+ eventCount: number;
4227
+ derivedFrom?: {
4228
+ baseTraceId: string;
4229
+ forkedFromSpanId: string;
4230
+ } | undefined;
4231
+ }>;
4232
+ divergence: z.ZodOptional<z.ZodObject<{
4233
+ forkPointSpanId: z.ZodOptional<z.ZodString>;
4234
+ aIndex: z.ZodOptional<z.ZodNumber>;
4235
+ bIndex: z.ZodOptional<z.ZodNumber>;
4236
+ reason: z.ZodOptional<z.ZodString>;
4237
+ }, "strip", z.ZodTypeAny, {
4238
+ reason?: string | undefined;
4239
+ forkPointSpanId?: string | undefined;
4240
+ aIndex?: number | undefined;
4241
+ bIndex?: number | undefined;
4242
+ }, {
4243
+ reason?: string | undefined;
4244
+ forkPointSpanId?: string | undefined;
4245
+ aIndex?: number | undefined;
4246
+ bIndex?: number | undefined;
4247
+ }>>;
4248
+ changed: z.ZodArray<z.ZodObject<{
4249
+ index: z.ZodNumber;
4250
+ aSpanId: z.ZodOptional<z.ZodString>;
4251
+ bSpanId: z.ZodOptional<z.ZodString>;
4252
+ reason: z.ZodString;
4253
+ }, "strip", z.ZodTypeAny, {
4254
+ reason: string;
4255
+ index: number;
4256
+ aSpanId?: string | undefined;
4257
+ bSpanId?: string | undefined;
4258
+ }, {
4259
+ reason: string;
4260
+ index: number;
4261
+ aSpanId?: string | undefined;
4262
+ bSpanId?: string | undefined;
4263
+ }>, "many">;
4264
+ }, "strip", z.ZodTypeAny, {
4265
+ a: {
4266
+ traceId: string;
4267
+ createdAt: string;
4268
+ rootSpanId: string | null;
4269
+ updatedAt: string;
4270
+ eventCount: number;
4271
+ derivedFrom?: {
4272
+ baseTraceId: string;
4273
+ forkedFromSpanId: string;
4274
+ } | undefined;
4275
+ };
4276
+ b: {
4277
+ traceId: string;
4278
+ createdAt: string;
4279
+ rootSpanId: string | null;
4280
+ updatedAt: string;
4281
+ eventCount: number;
4282
+ derivedFrom?: {
4283
+ baseTraceId: string;
4284
+ forkedFromSpanId: string;
4285
+ } | undefined;
4286
+ };
4287
+ changed: {
4288
+ reason: string;
4289
+ index: number;
4290
+ aSpanId?: string | undefined;
4291
+ bSpanId?: string | undefined;
4292
+ }[];
4293
+ divergence?: {
4294
+ reason?: string | undefined;
4295
+ forkPointSpanId?: string | undefined;
4296
+ aIndex?: number | undefined;
4297
+ bIndex?: number | undefined;
4298
+ } | undefined;
4299
+ }, {
4300
+ a: {
4301
+ traceId: string;
4302
+ createdAt: string;
4303
+ rootSpanId: string | null;
4304
+ updatedAt: string;
4305
+ eventCount: number;
4306
+ derivedFrom?: {
4307
+ baseTraceId: string;
4308
+ forkedFromSpanId: string;
4309
+ } | undefined;
4310
+ };
4311
+ b: {
4312
+ traceId: string;
4313
+ createdAt: string;
4314
+ rootSpanId: string | null;
4315
+ updatedAt: string;
4316
+ eventCount: number;
4317
+ derivedFrom?: {
4318
+ baseTraceId: string;
4319
+ forkedFromSpanId: string;
4320
+ } | undefined;
4321
+ };
4322
+ changed: {
4323
+ reason: string;
4324
+ index: number;
4325
+ aSpanId?: string | undefined;
4326
+ bSpanId?: string | undefined;
4327
+ }[];
4328
+ divergence?: {
4329
+ reason?: string | undefined;
4330
+ forkPointSpanId?: string | undefined;
4331
+ aIndex?: number | undefined;
4332
+ bIndex?: number | undefined;
4333
+ } | undefined;
4334
+ }>;
4335
+ export type TraceDiffResult = z.infer<typeof traceDiffResultSchema>;
4336
+ export declare function compareTraceEvents(a: Pick<TraceEvent, "occurredAt" | "spanId" | "kind">, b: Pick<TraceEvent, "occurredAt" | "spanId" | "kind">): number;
4337
+ export declare function sortTraceEventsDeterministic<T extends Pick<TraceEvent, "occurredAt" | "spanId" | "kind">>(events: readonly T[]): T[];
4338
+ export declare function validateTraceEvent(input: unknown): TraceEvent;
4339
+ export declare function validateTrace(input: unknown): Trace;
4340
+ export declare function validateTraceWithMeta(input: unknown): TraceWithMeta;
4341
+ export declare function validateTraceForkRequest(input: unknown): TraceForkRequest;
4342
+ export declare function validateTraceForkResponse(input: unknown): TraceForkResponse;
4343
+ export declare function validateTraceLineageGraph(input: unknown): TraceLineageGraph;
4344
+ export declare function validateTraceDiffResult(input: unknown): TraceDiffResult;
4345
+ export declare function validateTraceAnalysis(input: unknown): TraceAnalysis;
4346
+ export * from "./utils/hash";
4347
+ //# sourceMappingURL=index.d.ts.map