@nebulaos/core 0.2.0 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts DELETED
@@ -1,3425 +0,0 @@
1
- import { ZodSchema, z } from 'zod';
2
- export { z } from 'zod';
3
- import { TelemetrySpanKind, TelemetrySpanStatus, ITelemetryExporter } from '@nebulaos/types';
4
-
5
- /**
6
- * Core Provider Interfaces
7
- *
8
- * Define o contrato que qualquer provedor de LLM (OpenAI, Anthropic, etc.)
9
- * deve implementar para ser compatível com o Agent.
10
- */
11
- type Role = "system" | "user" | "assistant" | "function" | "tool";
12
- type ToolCall = {
13
- id: string;
14
- type: "function";
15
- function: {
16
- name: string;
17
- arguments: string;
18
- };
19
- };
20
- type ContentPart = {
21
- type: "text";
22
- text: string;
23
- } | {
24
- type: "image_url";
25
- imageUrl: {
26
- url: string;
27
- detail?: "auto" | "low" | "high";
28
- };
29
- };
30
- type Message = {
31
- role: Role;
32
- content?: string | ContentPart[] | null;
33
- name?: string;
34
- tool_calls?: ToolCall[];
35
- tool_call_id?: string;
36
- };
37
- type TokenUsage = {
38
- promptTokens: number;
39
- completionTokens: number;
40
- totalTokens: number;
41
- reasoningTokens?: number;
42
- };
43
- type ToolDefinitionForLLM = {
44
- type: "function";
45
- function: {
46
- name: string;
47
- description?: string;
48
- parameters?: Record<string, any>;
49
- };
50
- };
51
- type ResponseFormat = {
52
- type: "text";
53
- } | {
54
- type: "json";
55
- schema?: Record<string, any>;
56
- };
57
- type ProviderResponse = {
58
- content: string | null;
59
- toolCalls?: ToolCall[];
60
- usage?: TokenUsage;
61
- finishReason?: "stop" | "length" | "tool_calls" | "content_filter" | "error";
62
- };
63
- type StreamChunk = {
64
- type: "content_delta";
65
- delta: string;
66
- } | {
67
- type: "tool_call_start";
68
- index: number;
69
- id: string;
70
- name: string;
71
- } | {
72
- type: "tool_call_delta";
73
- index: number;
74
- args: string;
75
- } | {
76
- type: "tool_call_end";
77
- index: number;
78
- } | {
79
- type: "finish";
80
- reason: ProviderResponse["finishReason"];
81
- usage?: TokenUsage;
82
- } | {
83
- type: "error";
84
- error: Error;
85
- };
86
- interface GenerateOptions {
87
- responseFormat?: ResponseFormat;
88
- [key: string]: any;
89
- }
90
- interface IModel {
91
- providerName: string;
92
- modelName: string;
93
- /**
94
- * Gera uma resposta completa (não-streaming)
95
- */
96
- generate(messages: Message[], tools?: ToolDefinitionForLLM[], options?: GenerateOptions): Promise<ProviderResponse>;
97
- /**
98
- * Gera uma resposta em streaming
99
- */
100
- generateStream(messages: Message[], tools?: ToolDefinitionForLLM[], options?: GenerateOptions): AsyncGenerator<StreamChunk>;
101
- }
102
-
103
- /**
104
- * Memory Interface
105
- *
106
- * Define como o Agente armazena e recupera o histórico de mensagens.
107
- */
108
-
109
- interface IMemory {
110
- /**
111
- * Adiciona uma mensagem ao histórico
112
- */
113
- addMessage(message: Message): Promise<void>;
114
- /**
115
- * Recupera o histórico completo
116
- */
117
- getMessages(): Promise<Message[]>;
118
- /**
119
- * Limpa o histórico
120
- */
121
- clear(): Promise<void>;
122
- }
123
-
124
- /**
125
- * Implementação básica em memória (padrão)
126
- */
127
-
128
- declare class InMemory implements IMemory {
129
- private options;
130
- private messages;
131
- constructor(options?: {
132
- maxMessages?: number;
133
- });
134
- addMessage(message: Message): Promise<void>;
135
- getMessages(): Promise<Message[]>;
136
- clear(): Promise<void>;
137
- }
138
-
139
- type ToolConfig<Input = any, Output = any> = {
140
- id: string;
141
- description?: string;
142
- inputSchema?: ZodSchema<Input>;
143
- handler?: (ctx: any, input: Input) => Promise<Output>;
144
- };
145
- type ToolExecution = {
146
- id: string;
147
- name: string;
148
- input: any;
149
- output: any;
150
- durationMs: number;
151
- error?: string;
152
- };
153
- declare class Tool<Input = any, Output = any> {
154
- readonly id: string;
155
- readonly description?: string;
156
- readonly inputSchema?: ZodSchema<Input>;
157
- private handler?;
158
- constructor(config: ToolConfig<Input, Output>);
159
- /**
160
- * Converte a tool para o formato esperado pelo LLM
161
- */
162
- toLLMDefinition(): ToolDefinitionForLLM;
163
- /**
164
- * Executa a tool com validação de input
165
- */
166
- execute(context: any, input: any): Promise<Output>;
167
- }
168
-
169
- interface IPIIMasker {
170
- mask(text: string): string;
171
- }
172
- declare class RegexPIIMasker implements IPIIMasker {
173
- private static readonly PATTERNS;
174
- mask(text: string): string;
175
- }
176
-
177
- declare const TraceContextSchema: z.ZodObject<{
178
- traceId: z.ZodString;
179
- spanId: z.ZodString;
180
- parentSpanId: z.ZodOptional<z.ZodString>;
181
- }, "strip", z.ZodTypeAny, {
182
- traceId: string;
183
- spanId: string;
184
- parentSpanId?: string | undefined;
185
- }, {
186
- traceId: string;
187
- spanId: string;
188
- parentSpanId?: string | undefined;
189
- }>;
190
- declare const EventCommonSchema: z.ZodObject<{
191
- type: z.ZodString;
192
- timestamp: z.ZodString;
193
- trace: z.ZodObject<{
194
- traceId: z.ZodString;
195
- spanId: z.ZodString;
196
- parentSpanId: z.ZodOptional<z.ZodString>;
197
- }, "strip", z.ZodTypeAny, {
198
- traceId: string;
199
- spanId: string;
200
- parentSpanId?: string | undefined;
201
- }, {
202
- traceId: string;
203
- spanId: string;
204
- parentSpanId?: string | undefined;
205
- }>;
206
- correlationId: z.ZodOptional<z.ZodString>;
207
- runId: z.ZodOptional<z.ZodString>;
208
- }, "strip", z.ZodTypeAny, {
209
- type: string;
210
- timestamp: string;
211
- trace: {
212
- traceId: string;
213
- spanId: string;
214
- parentSpanId?: string | undefined;
215
- };
216
- correlationId?: string | undefined;
217
- runId?: string | undefined;
218
- }, {
219
- type: string;
220
- timestamp: string;
221
- trace: {
222
- traceId: string;
223
- spanId: string;
224
- parentSpanId?: string | undefined;
225
- };
226
- correlationId?: string | undefined;
227
- runId?: string | undefined;
228
- }>;
229
- declare const UsageSchema: z.ZodObject<{
230
- promptTokens: z.ZodNumber;
231
- completionTokens: z.ZodNumber;
232
- totalTokens: z.ZodNumber;
233
- reasoningTokens: z.ZodOptional<z.ZodNumber>;
234
- }, "strip", z.ZodTypeAny, {
235
- promptTokens: number;
236
- completionTokens: number;
237
- totalTokens: number;
238
- reasoningTokens?: number | undefined;
239
- }, {
240
- promptTokens: number;
241
- completionTokens: number;
242
- totalTokens: number;
243
- reasoningTokens?: number | undefined;
244
- }>;
245
- declare const ErrorSchema: z.ZodObject<{
246
- name: z.ZodOptional<z.ZodString>;
247
- message: z.ZodString;
248
- code: z.ZodOptional<z.ZodString>;
249
- stack: z.ZodOptional<z.ZodString>;
250
- details: z.ZodOptional<z.ZodAny>;
251
- }, "strip", z.ZodTypeAny, {
252
- message: string;
253
- name?: string | undefined;
254
- code?: string | undefined;
255
- stack?: string | undefined;
256
- details?: any;
257
- }, {
258
- message: string;
259
- name?: string | undefined;
260
- code?: string | undefined;
261
- stack?: string | undefined;
262
- details?: any;
263
- }>;
264
- declare const ModelSchema: z.ZodObject<{
265
- provider: z.ZodString;
266
- model: z.ZodString;
267
- temperature: z.ZodOptional<z.ZodNumber>;
268
- maxTokens: z.ZodOptional<z.ZodNumber>;
269
- topP: z.ZodOptional<z.ZodNumber>;
270
- frequencyPenalty: z.ZodOptional<z.ZodNumber>;
271
- presencePenalty: z.ZodOptional<z.ZodNumber>;
272
- }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
273
- provider: z.ZodString;
274
- model: z.ZodString;
275
- temperature: z.ZodOptional<z.ZodNumber>;
276
- maxTokens: z.ZodOptional<z.ZodNumber>;
277
- topP: z.ZodOptional<z.ZodNumber>;
278
- frequencyPenalty: z.ZodOptional<z.ZodNumber>;
279
- presencePenalty: z.ZodOptional<z.ZodNumber>;
280
- }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
281
- provider: z.ZodString;
282
- model: z.ZodString;
283
- temperature: z.ZodOptional<z.ZodNumber>;
284
- maxTokens: z.ZodOptional<z.ZodNumber>;
285
- topP: z.ZodOptional<z.ZodNumber>;
286
- frequencyPenalty: z.ZodOptional<z.ZodNumber>;
287
- presencePenalty: z.ZodOptional<z.ZodNumber>;
288
- }, z.ZodTypeAny, "passthrough">>;
289
- declare const AgentExecutionStartSchema: z.ZodObject<{
290
- timestamp: z.ZodString;
291
- trace: z.ZodObject<{
292
- traceId: z.ZodString;
293
- spanId: z.ZodString;
294
- parentSpanId: z.ZodOptional<z.ZodString>;
295
- }, "strip", z.ZodTypeAny, {
296
- traceId: string;
297
- spanId: string;
298
- parentSpanId?: string | undefined;
299
- }, {
300
- traceId: string;
301
- spanId: string;
302
- parentSpanId?: string | undefined;
303
- }>;
304
- correlationId: z.ZodOptional<z.ZodString>;
305
- runId: z.ZodOptional<z.ZodString>;
306
- } & {
307
- type: z.ZodLiteral<"agent:execution:start">;
308
- data: z.ZodObject<{
309
- agentName: z.ZodString;
310
- input: z.ZodOptional<z.ZodAny>;
311
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
312
- }, "strip", z.ZodTypeAny, {
313
- agentName: string;
314
- input?: any;
315
- metadata?: Record<string, any> | undefined;
316
- }, {
317
- agentName: string;
318
- input?: any;
319
- metadata?: Record<string, any> | undefined;
320
- }>;
321
- }, "strip", z.ZodTypeAny, {
322
- type: "agent:execution:start";
323
- timestamp: string;
324
- trace: {
325
- traceId: string;
326
- spanId: string;
327
- parentSpanId?: string | undefined;
328
- };
329
- data: {
330
- agentName: string;
331
- input?: any;
332
- metadata?: Record<string, any> | undefined;
333
- };
334
- correlationId?: string | undefined;
335
- runId?: string | undefined;
336
- }, {
337
- type: "agent:execution:start";
338
- timestamp: string;
339
- trace: {
340
- traceId: string;
341
- spanId: string;
342
- parentSpanId?: string | undefined;
343
- };
344
- data: {
345
- agentName: string;
346
- input?: any;
347
- metadata?: Record<string, any> | undefined;
348
- };
349
- correlationId?: string | undefined;
350
- runId?: string | undefined;
351
- }>;
352
- declare const AgentExecutionEndSchema: z.ZodObject<{
353
- timestamp: z.ZodString;
354
- trace: z.ZodObject<{
355
- traceId: z.ZodString;
356
- spanId: z.ZodString;
357
- parentSpanId: z.ZodOptional<z.ZodString>;
358
- }, "strip", z.ZodTypeAny, {
359
- traceId: string;
360
- spanId: string;
361
- parentSpanId?: string | undefined;
362
- }, {
363
- traceId: string;
364
- spanId: string;
365
- parentSpanId?: string | undefined;
366
- }>;
367
- correlationId: z.ZodOptional<z.ZodString>;
368
- runId: z.ZodOptional<z.ZodString>;
369
- } & {
370
- type: z.ZodLiteral<"agent:execution:end">;
371
- data: z.ZodObject<{
372
- agentName: z.ZodString;
373
- status: z.ZodEnum<["success", "error", "truncated"]>;
374
- output: z.ZodOptional<z.ZodAny>;
375
- durationMs: z.ZodNumber;
376
- usage: z.ZodOptional<z.ZodObject<{
377
- promptTokens: z.ZodNumber;
378
- completionTokens: z.ZodNumber;
379
- totalTokens: z.ZodNumber;
380
- reasoningTokens: z.ZodOptional<z.ZodNumber>;
381
- }, "strip", z.ZodTypeAny, {
382
- promptTokens: number;
383
- completionTokens: number;
384
- totalTokens: number;
385
- reasoningTokens?: number | undefined;
386
- }, {
387
- promptTokens: number;
388
- completionTokens: number;
389
- totalTokens: number;
390
- reasoningTokens?: number | undefined;
391
- }>>;
392
- }, "strip", z.ZodTypeAny, {
393
- status: "error" | "success" | "truncated";
394
- agentName: string;
395
- durationMs: number;
396
- output?: any;
397
- usage?: {
398
- promptTokens: number;
399
- completionTokens: number;
400
- totalTokens: number;
401
- reasoningTokens?: number | undefined;
402
- } | undefined;
403
- }, {
404
- status: "error" | "success" | "truncated";
405
- agentName: string;
406
- durationMs: number;
407
- output?: any;
408
- usage?: {
409
- promptTokens: number;
410
- completionTokens: number;
411
- totalTokens: number;
412
- reasoningTokens?: number | undefined;
413
- } | undefined;
414
- }>;
415
- }, "strip", z.ZodTypeAny, {
416
- type: "agent:execution:end";
417
- timestamp: string;
418
- trace: {
419
- traceId: string;
420
- spanId: string;
421
- parentSpanId?: string | undefined;
422
- };
423
- data: {
424
- status: "error" | "success" | "truncated";
425
- agentName: string;
426
- durationMs: number;
427
- output?: any;
428
- usage?: {
429
- promptTokens: number;
430
- completionTokens: number;
431
- totalTokens: number;
432
- reasoningTokens?: number | undefined;
433
- } | undefined;
434
- };
435
- correlationId?: string | undefined;
436
- runId?: string | undefined;
437
- }, {
438
- type: "agent:execution:end";
439
- timestamp: string;
440
- trace: {
441
- traceId: string;
442
- spanId: string;
443
- parentSpanId?: string | undefined;
444
- };
445
- data: {
446
- status: "error" | "success" | "truncated";
447
- agentName: string;
448
- durationMs: number;
449
- output?: any;
450
- usage?: {
451
- promptTokens: number;
452
- completionTokens: number;
453
- totalTokens: number;
454
- reasoningTokens?: number | undefined;
455
- } | undefined;
456
- };
457
- correlationId?: string | undefined;
458
- runId?: string | undefined;
459
- }>;
460
- declare const AgentExecutionErrorSchema: z.ZodObject<{
461
- timestamp: z.ZodString;
462
- trace: z.ZodObject<{
463
- traceId: z.ZodString;
464
- spanId: z.ZodString;
465
- parentSpanId: z.ZodOptional<z.ZodString>;
466
- }, "strip", z.ZodTypeAny, {
467
- traceId: string;
468
- spanId: string;
469
- parentSpanId?: string | undefined;
470
- }, {
471
- traceId: string;
472
- spanId: string;
473
- parentSpanId?: string | undefined;
474
- }>;
475
- correlationId: z.ZodOptional<z.ZodString>;
476
- runId: z.ZodOptional<z.ZodString>;
477
- } & {
478
- type: z.ZodLiteral<"agent:execution:error">;
479
- data: z.ZodObject<{
480
- agentName: z.ZodString;
481
- error: z.ZodObject<{
482
- name: z.ZodOptional<z.ZodString>;
483
- message: z.ZodString;
484
- code: z.ZodOptional<z.ZodString>;
485
- stack: z.ZodOptional<z.ZodString>;
486
- details: z.ZodOptional<z.ZodAny>;
487
- }, "strip", z.ZodTypeAny, {
488
- message: string;
489
- name?: string | undefined;
490
- code?: string | undefined;
491
- stack?: string | undefined;
492
- details?: any;
493
- }, {
494
- message: string;
495
- name?: string | undefined;
496
- code?: string | undefined;
497
- stack?: string | undefined;
498
- details?: any;
499
- }>;
500
- durationMs: z.ZodOptional<z.ZodNumber>;
501
- }, "strip", z.ZodTypeAny, {
502
- error: {
503
- message: string;
504
- name?: string | undefined;
505
- code?: string | undefined;
506
- stack?: string | undefined;
507
- details?: any;
508
- };
509
- agentName: string;
510
- durationMs?: number | undefined;
511
- }, {
512
- error: {
513
- message: string;
514
- name?: string | undefined;
515
- code?: string | undefined;
516
- stack?: string | undefined;
517
- details?: any;
518
- };
519
- agentName: string;
520
- durationMs?: number | undefined;
521
- }>;
522
- }, "strip", z.ZodTypeAny, {
523
- type: "agent:execution:error";
524
- timestamp: string;
525
- trace: {
526
- traceId: string;
527
- spanId: string;
528
- parentSpanId?: string | undefined;
529
- };
530
- data: {
531
- error: {
532
- message: string;
533
- name?: string | undefined;
534
- code?: string | undefined;
535
- stack?: string | undefined;
536
- details?: any;
537
- };
538
- agentName: string;
539
- durationMs?: number | undefined;
540
- };
541
- correlationId?: string | undefined;
542
- runId?: string | undefined;
543
- }, {
544
- type: "agent:execution:error";
545
- timestamp: string;
546
- trace: {
547
- traceId: string;
548
- spanId: string;
549
- parentSpanId?: string | undefined;
550
- };
551
- data: {
552
- error: {
553
- message: string;
554
- name?: string | undefined;
555
- code?: string | undefined;
556
- stack?: string | undefined;
557
- details?: any;
558
- };
559
- agentName: string;
560
- durationMs?: number | undefined;
561
- };
562
- correlationId?: string | undefined;
563
- runId?: string | undefined;
564
- }>;
565
- declare const AgentLLMCallSchema: z.ZodObject<{
566
- timestamp: z.ZodString;
567
- trace: z.ZodObject<{
568
- traceId: z.ZodString;
569
- spanId: z.ZodString;
570
- parentSpanId: z.ZodOptional<z.ZodString>;
571
- }, "strip", z.ZodTypeAny, {
572
- traceId: string;
573
- spanId: string;
574
- parentSpanId?: string | undefined;
575
- }, {
576
- traceId: string;
577
- spanId: string;
578
- parentSpanId?: string | undefined;
579
- }>;
580
- correlationId: z.ZodOptional<z.ZodString>;
581
- runId: z.ZodOptional<z.ZodString>;
582
- } & {
583
- type: z.ZodLiteral<"agent:llm:call">;
584
- data: z.ZodObject<{
585
- agentName: z.ZodString;
586
- step: z.ZodNumber;
587
- model: z.ZodObject<{
588
- provider: z.ZodString;
589
- model: z.ZodString;
590
- temperature: z.ZodOptional<z.ZodNumber>;
591
- maxTokens: z.ZodOptional<z.ZodNumber>;
592
- topP: z.ZodOptional<z.ZodNumber>;
593
- frequencyPenalty: z.ZodOptional<z.ZodNumber>;
594
- presencePenalty: z.ZodOptional<z.ZodNumber>;
595
- }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
596
- provider: z.ZodString;
597
- model: z.ZodString;
598
- temperature: z.ZodOptional<z.ZodNumber>;
599
- maxTokens: z.ZodOptional<z.ZodNumber>;
600
- topP: z.ZodOptional<z.ZodNumber>;
601
- frequencyPenalty: z.ZodOptional<z.ZodNumber>;
602
- presencePenalty: z.ZodOptional<z.ZodNumber>;
603
- }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
604
- provider: z.ZodString;
605
- model: z.ZodString;
606
- temperature: z.ZodOptional<z.ZodNumber>;
607
- maxTokens: z.ZodOptional<z.ZodNumber>;
608
- topP: z.ZodOptional<z.ZodNumber>;
609
- frequencyPenalty: z.ZodOptional<z.ZodNumber>;
610
- presencePenalty: z.ZodOptional<z.ZodNumber>;
611
- }, z.ZodTypeAny, "passthrough">>;
612
- messages: z.ZodArray<z.ZodAny, "many">;
613
- tools: z.ZodOptional<z.ZodArray<z.ZodAny, "many">>;
614
- responseFormat: z.ZodOptional<z.ZodAny>;
615
- }, "strip", z.ZodTypeAny, {
616
- model: {
617
- provider: string;
618
- model: string;
619
- temperature?: number | undefined;
620
- maxTokens?: number | undefined;
621
- topP?: number | undefined;
622
- frequencyPenalty?: number | undefined;
623
- presencePenalty?: number | undefined;
624
- } & {
625
- [k: string]: unknown;
626
- };
627
- agentName: string;
628
- step: number;
629
- messages: any[];
630
- responseFormat?: any;
631
- tools?: any[] | undefined;
632
- }, {
633
- model: {
634
- provider: string;
635
- model: string;
636
- temperature?: number | undefined;
637
- maxTokens?: number | undefined;
638
- topP?: number | undefined;
639
- frequencyPenalty?: number | undefined;
640
- presencePenalty?: number | undefined;
641
- } & {
642
- [k: string]: unknown;
643
- };
644
- agentName: string;
645
- step: number;
646
- messages: any[];
647
- responseFormat?: any;
648
- tools?: any[] | undefined;
649
- }>;
650
- }, "strip", z.ZodTypeAny, {
651
- type: "agent:llm:call";
652
- timestamp: string;
653
- trace: {
654
- traceId: string;
655
- spanId: string;
656
- parentSpanId?: string | undefined;
657
- };
658
- data: {
659
- model: {
660
- provider: string;
661
- model: string;
662
- temperature?: number | undefined;
663
- maxTokens?: number | undefined;
664
- topP?: number | undefined;
665
- frequencyPenalty?: number | undefined;
666
- presencePenalty?: number | undefined;
667
- } & {
668
- [k: string]: unknown;
669
- };
670
- agentName: string;
671
- step: number;
672
- messages: any[];
673
- responseFormat?: any;
674
- tools?: any[] | undefined;
675
- };
676
- correlationId?: string | undefined;
677
- runId?: string | undefined;
678
- }, {
679
- type: "agent:llm:call";
680
- timestamp: string;
681
- trace: {
682
- traceId: string;
683
- spanId: string;
684
- parentSpanId?: string | undefined;
685
- };
686
- data: {
687
- model: {
688
- provider: string;
689
- model: string;
690
- temperature?: number | undefined;
691
- maxTokens?: number | undefined;
692
- topP?: number | undefined;
693
- frequencyPenalty?: number | undefined;
694
- presencePenalty?: number | undefined;
695
- } & {
696
- [k: string]: unknown;
697
- };
698
- agentName: string;
699
- step: number;
700
- messages: any[];
701
- responseFormat?: any;
702
- tools?: any[] | undefined;
703
- };
704
- correlationId?: string | undefined;
705
- runId?: string | undefined;
706
- }>;
707
- declare const AgentLLMResponseSchema: z.ZodObject<{
708
- timestamp: z.ZodString;
709
- trace: z.ZodObject<{
710
- traceId: z.ZodString;
711
- spanId: z.ZodString;
712
- parentSpanId: z.ZodOptional<z.ZodString>;
713
- }, "strip", z.ZodTypeAny, {
714
- traceId: string;
715
- spanId: string;
716
- parentSpanId?: string | undefined;
717
- }, {
718
- traceId: string;
719
- spanId: string;
720
- parentSpanId?: string | undefined;
721
- }>;
722
- correlationId: z.ZodOptional<z.ZodString>;
723
- runId: z.ZodOptional<z.ZodString>;
724
- } & {
725
- type: z.ZodLiteral<"agent:llm:response">;
726
- data: z.ZodObject<{
727
- agentName: z.ZodString;
728
- step: z.ZodNumber;
729
- model: z.ZodObject<{
730
- provider: z.ZodString;
731
- model: z.ZodString;
732
- temperature: z.ZodOptional<z.ZodNumber>;
733
- maxTokens: z.ZodOptional<z.ZodNumber>;
734
- topP: z.ZodOptional<z.ZodNumber>;
735
- frequencyPenalty: z.ZodOptional<z.ZodNumber>;
736
- presencePenalty: z.ZodOptional<z.ZodNumber>;
737
- }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
738
- provider: z.ZodString;
739
- model: z.ZodString;
740
- temperature: z.ZodOptional<z.ZodNumber>;
741
- maxTokens: z.ZodOptional<z.ZodNumber>;
742
- topP: z.ZodOptional<z.ZodNumber>;
743
- frequencyPenalty: z.ZodOptional<z.ZodNumber>;
744
- presencePenalty: z.ZodOptional<z.ZodNumber>;
745
- }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
746
- provider: z.ZodString;
747
- model: z.ZodString;
748
- temperature: z.ZodOptional<z.ZodNumber>;
749
- maxTokens: z.ZodOptional<z.ZodNumber>;
750
- topP: z.ZodOptional<z.ZodNumber>;
751
- frequencyPenalty: z.ZodOptional<z.ZodNumber>;
752
- presencePenalty: z.ZodOptional<z.ZodNumber>;
753
- }, z.ZodTypeAny, "passthrough">>;
754
- content: z.ZodAny;
755
- toolCalls: z.ZodOptional<z.ZodArray<z.ZodAny, "many">>;
756
- finishReason: z.ZodOptional<z.ZodString>;
757
- usage: z.ZodOptional<z.ZodObject<{
758
- promptTokens: z.ZodNumber;
759
- completionTokens: z.ZodNumber;
760
- totalTokens: z.ZodNumber;
761
- reasoningTokens: z.ZodOptional<z.ZodNumber>;
762
- }, "strip", z.ZodTypeAny, {
763
- promptTokens: number;
764
- completionTokens: number;
765
- totalTokens: number;
766
- reasoningTokens?: number | undefined;
767
- }, {
768
- promptTokens: number;
769
- completionTokens: number;
770
- totalTokens: number;
771
- reasoningTokens?: number | undefined;
772
- }>>;
773
- durationMs: z.ZodOptional<z.ZodNumber>;
774
- }, "strip", z.ZodTypeAny, {
775
- model: {
776
- provider: string;
777
- model: string;
778
- temperature?: number | undefined;
779
- maxTokens?: number | undefined;
780
- topP?: number | undefined;
781
- frequencyPenalty?: number | undefined;
782
- presencePenalty?: number | undefined;
783
- } & {
784
- [k: string]: unknown;
785
- };
786
- agentName: string;
787
- step: number;
788
- finishReason?: string | undefined;
789
- durationMs?: number | undefined;
790
- usage?: {
791
- promptTokens: number;
792
- completionTokens: number;
793
- totalTokens: number;
794
- reasoningTokens?: number | undefined;
795
- } | undefined;
796
- content?: any;
797
- toolCalls?: any[] | undefined;
798
- }, {
799
- model: {
800
- provider: string;
801
- model: string;
802
- temperature?: number | undefined;
803
- maxTokens?: number | undefined;
804
- topP?: number | undefined;
805
- frequencyPenalty?: number | undefined;
806
- presencePenalty?: number | undefined;
807
- } & {
808
- [k: string]: unknown;
809
- };
810
- agentName: string;
811
- step: number;
812
- finishReason?: string | undefined;
813
- durationMs?: number | undefined;
814
- usage?: {
815
- promptTokens: number;
816
- completionTokens: number;
817
- totalTokens: number;
818
- reasoningTokens?: number | undefined;
819
- } | undefined;
820
- content?: any;
821
- toolCalls?: any[] | undefined;
822
- }>;
823
- }, "strip", z.ZodTypeAny, {
824
- type: "agent:llm:response";
825
- timestamp: string;
826
- trace: {
827
- traceId: string;
828
- spanId: string;
829
- parentSpanId?: string | undefined;
830
- };
831
- data: {
832
- model: {
833
- provider: string;
834
- model: string;
835
- temperature?: number | undefined;
836
- maxTokens?: number | undefined;
837
- topP?: number | undefined;
838
- frequencyPenalty?: number | undefined;
839
- presencePenalty?: number | undefined;
840
- } & {
841
- [k: string]: unknown;
842
- };
843
- agentName: string;
844
- step: number;
845
- finishReason?: string | undefined;
846
- durationMs?: number | undefined;
847
- usage?: {
848
- promptTokens: number;
849
- completionTokens: number;
850
- totalTokens: number;
851
- reasoningTokens?: number | undefined;
852
- } | undefined;
853
- content?: any;
854
- toolCalls?: any[] | undefined;
855
- };
856
- correlationId?: string | undefined;
857
- runId?: string | undefined;
858
- }, {
859
- type: "agent:llm:response";
860
- timestamp: string;
861
- trace: {
862
- traceId: string;
863
- spanId: string;
864
- parentSpanId?: string | undefined;
865
- };
866
- data: {
867
- model: {
868
- provider: string;
869
- model: string;
870
- temperature?: number | undefined;
871
- maxTokens?: number | undefined;
872
- topP?: number | undefined;
873
- frequencyPenalty?: number | undefined;
874
- presencePenalty?: number | undefined;
875
- } & {
876
- [k: string]: unknown;
877
- };
878
- agentName: string;
879
- step: number;
880
- finishReason?: string | undefined;
881
- durationMs?: number | undefined;
882
- usage?: {
883
- promptTokens: number;
884
- completionTokens: number;
885
- totalTokens: number;
886
- reasoningTokens?: number | undefined;
887
- } | undefined;
888
- content?: any;
889
- toolCalls?: any[] | undefined;
890
- };
891
- correlationId?: string | undefined;
892
- runId?: string | undefined;
893
- }>;
894
- declare const AgentToolCallSchema: z.ZodObject<{
895
- timestamp: z.ZodString;
896
- trace: z.ZodObject<{
897
- traceId: z.ZodString;
898
- spanId: z.ZodString;
899
- parentSpanId: z.ZodOptional<z.ZodString>;
900
- }, "strip", z.ZodTypeAny, {
901
- traceId: string;
902
- spanId: string;
903
- parentSpanId?: string | undefined;
904
- }, {
905
- traceId: string;
906
- spanId: string;
907
- parentSpanId?: string | undefined;
908
- }>;
909
- correlationId: z.ZodOptional<z.ZodString>;
910
- runId: z.ZodOptional<z.ZodString>;
911
- } & {
912
- type: z.ZodLiteral<"agent:tool:call">;
913
- data: z.ZodObject<{
914
- agentName: z.ZodString;
915
- toolName: z.ZodString;
916
- toolCallId: z.ZodString;
917
- args: z.ZodAny;
918
- }, "strip", z.ZodTypeAny, {
919
- agentName: string;
920
- toolName: string;
921
- toolCallId: string;
922
- args?: any;
923
- }, {
924
- agentName: string;
925
- toolName: string;
926
- toolCallId: string;
927
- args?: any;
928
- }>;
929
- }, "strip", z.ZodTypeAny, {
930
- type: "agent:tool:call";
931
- timestamp: string;
932
- trace: {
933
- traceId: string;
934
- spanId: string;
935
- parentSpanId?: string | undefined;
936
- };
937
- data: {
938
- agentName: string;
939
- toolName: string;
940
- toolCallId: string;
941
- args?: any;
942
- };
943
- correlationId?: string | undefined;
944
- runId?: string | undefined;
945
- }, {
946
- type: "agent:tool:call";
947
- timestamp: string;
948
- trace: {
949
- traceId: string;
950
- spanId: string;
951
- parentSpanId?: string | undefined;
952
- };
953
- data: {
954
- agentName: string;
955
- toolName: string;
956
- toolCallId: string;
957
- args?: any;
958
- };
959
- correlationId?: string | undefined;
960
- runId?: string | undefined;
961
- }>;
962
- declare const AgentToolResultSchema: z.ZodObject<{
963
- timestamp: z.ZodString;
964
- trace: z.ZodObject<{
965
- traceId: z.ZodString;
966
- spanId: z.ZodString;
967
- parentSpanId: z.ZodOptional<z.ZodString>;
968
- }, "strip", z.ZodTypeAny, {
969
- traceId: string;
970
- spanId: string;
971
- parentSpanId?: string | undefined;
972
- }, {
973
- traceId: string;
974
- spanId: string;
975
- parentSpanId?: string | undefined;
976
- }>;
977
- correlationId: z.ZodOptional<z.ZodString>;
978
- runId: z.ZodOptional<z.ZodString>;
979
- } & {
980
- type: z.ZodLiteral<"agent:tool:result">;
981
- data: z.ZodObject<{
982
- agentName: z.ZodString;
983
- toolName: z.ZodString;
984
- toolCallId: z.ZodString;
985
- output: z.ZodOptional<z.ZodAny>;
986
- error: z.ZodOptional<z.ZodString>;
987
- durationMs: z.ZodOptional<z.ZodNumber>;
988
- }, "strip", z.ZodTypeAny, {
989
- agentName: string;
990
- toolName: string;
991
- toolCallId: string;
992
- error?: string | undefined;
993
- output?: any;
994
- durationMs?: number | undefined;
995
- }, {
996
- agentName: string;
997
- toolName: string;
998
- toolCallId: string;
999
- error?: string | undefined;
1000
- output?: any;
1001
- durationMs?: number | undefined;
1002
- }>;
1003
- }, "strip", z.ZodTypeAny, {
1004
- type: "agent:tool:result";
1005
- timestamp: string;
1006
- trace: {
1007
- traceId: string;
1008
- spanId: string;
1009
- parentSpanId?: string | undefined;
1010
- };
1011
- data: {
1012
- agentName: string;
1013
- toolName: string;
1014
- toolCallId: string;
1015
- error?: string | undefined;
1016
- output?: any;
1017
- durationMs?: number | undefined;
1018
- };
1019
- correlationId?: string | undefined;
1020
- runId?: string | undefined;
1021
- }, {
1022
- type: "agent:tool:result";
1023
- timestamp: string;
1024
- trace: {
1025
- traceId: string;
1026
- spanId: string;
1027
- parentSpanId?: string | undefined;
1028
- };
1029
- data: {
1030
- agentName: string;
1031
- toolName: string;
1032
- toolCallId: string;
1033
- error?: string | undefined;
1034
- output?: any;
1035
- durationMs?: number | undefined;
1036
- };
1037
- correlationId?: string | undefined;
1038
- runId?: string | undefined;
1039
- }>;
1040
- declare const WorkflowExecutionStartSchema: z.ZodObject<{
1041
- timestamp: z.ZodString;
1042
- trace: z.ZodObject<{
1043
- traceId: z.ZodString;
1044
- spanId: z.ZodString;
1045
- parentSpanId: z.ZodOptional<z.ZodString>;
1046
- }, "strip", z.ZodTypeAny, {
1047
- traceId: string;
1048
- spanId: string;
1049
- parentSpanId?: string | undefined;
1050
- }, {
1051
- traceId: string;
1052
- spanId: string;
1053
- parentSpanId?: string | undefined;
1054
- }>;
1055
- correlationId: z.ZodOptional<z.ZodString>;
1056
- runId: z.ZodOptional<z.ZodString>;
1057
- } & {
1058
- type: z.ZodLiteral<"workflow:execution:start">;
1059
- data: z.ZodObject<{
1060
- workflowId: z.ZodString;
1061
- input: z.ZodOptional<z.ZodAny>;
1062
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
1063
- }, "strip", z.ZodTypeAny, {
1064
- workflowId: string;
1065
- input?: any;
1066
- metadata?: Record<string, any> | undefined;
1067
- }, {
1068
- workflowId: string;
1069
- input?: any;
1070
- metadata?: Record<string, any> | undefined;
1071
- }>;
1072
- }, "strip", z.ZodTypeAny, {
1073
- type: "workflow:execution:start";
1074
- timestamp: string;
1075
- trace: {
1076
- traceId: string;
1077
- spanId: string;
1078
- parentSpanId?: string | undefined;
1079
- };
1080
- data: {
1081
- workflowId: string;
1082
- input?: any;
1083
- metadata?: Record<string, any> | undefined;
1084
- };
1085
- correlationId?: string | undefined;
1086
- runId?: string | undefined;
1087
- }, {
1088
- type: "workflow:execution:start";
1089
- timestamp: string;
1090
- trace: {
1091
- traceId: string;
1092
- spanId: string;
1093
- parentSpanId?: string | undefined;
1094
- };
1095
- data: {
1096
- workflowId: string;
1097
- input?: any;
1098
- metadata?: Record<string, any> | undefined;
1099
- };
1100
- correlationId?: string | undefined;
1101
- runId?: string | undefined;
1102
- }>;
1103
- declare const WorkflowExecutionEndSchema: z.ZodObject<{
1104
- timestamp: z.ZodString;
1105
- trace: z.ZodObject<{
1106
- traceId: z.ZodString;
1107
- spanId: z.ZodString;
1108
- parentSpanId: z.ZodOptional<z.ZodString>;
1109
- }, "strip", z.ZodTypeAny, {
1110
- traceId: string;
1111
- spanId: string;
1112
- parentSpanId?: string | undefined;
1113
- }, {
1114
- traceId: string;
1115
- spanId: string;
1116
- parentSpanId?: string | undefined;
1117
- }>;
1118
- correlationId: z.ZodOptional<z.ZodString>;
1119
- runId: z.ZodOptional<z.ZodString>;
1120
- } & {
1121
- type: z.ZodLiteral<"workflow:execution:end">;
1122
- data: z.ZodObject<{
1123
- workflowId: z.ZodString;
1124
- status: z.ZodEnum<["success", "error", "truncated"]>;
1125
- output: z.ZodOptional<z.ZodAny>;
1126
- durationMs: z.ZodNumber;
1127
- }, "strip", z.ZodTypeAny, {
1128
- status: "error" | "success" | "truncated";
1129
- durationMs: number;
1130
- workflowId: string;
1131
- output?: any;
1132
- }, {
1133
- status: "error" | "success" | "truncated";
1134
- durationMs: number;
1135
- workflowId: string;
1136
- output?: any;
1137
- }>;
1138
- }, "strip", z.ZodTypeAny, {
1139
- type: "workflow:execution:end";
1140
- timestamp: string;
1141
- trace: {
1142
- traceId: string;
1143
- spanId: string;
1144
- parentSpanId?: string | undefined;
1145
- };
1146
- data: {
1147
- status: "error" | "success" | "truncated";
1148
- durationMs: number;
1149
- workflowId: string;
1150
- output?: any;
1151
- };
1152
- correlationId?: string | undefined;
1153
- runId?: string | undefined;
1154
- }, {
1155
- type: "workflow:execution:end";
1156
- timestamp: string;
1157
- trace: {
1158
- traceId: string;
1159
- spanId: string;
1160
- parentSpanId?: string | undefined;
1161
- };
1162
- data: {
1163
- status: "error" | "success" | "truncated";
1164
- durationMs: number;
1165
- workflowId: string;
1166
- output?: any;
1167
- };
1168
- correlationId?: string | undefined;
1169
- runId?: string | undefined;
1170
- }>;
1171
- declare const WorkflowExecutionErrorSchema: z.ZodObject<{
1172
- timestamp: z.ZodString;
1173
- trace: z.ZodObject<{
1174
- traceId: z.ZodString;
1175
- spanId: z.ZodString;
1176
- parentSpanId: z.ZodOptional<z.ZodString>;
1177
- }, "strip", z.ZodTypeAny, {
1178
- traceId: string;
1179
- spanId: string;
1180
- parentSpanId?: string | undefined;
1181
- }, {
1182
- traceId: string;
1183
- spanId: string;
1184
- parentSpanId?: string | undefined;
1185
- }>;
1186
- correlationId: z.ZodOptional<z.ZodString>;
1187
- runId: z.ZodOptional<z.ZodString>;
1188
- } & {
1189
- type: z.ZodLiteral<"workflow:execution:error">;
1190
- data: z.ZodObject<{
1191
- workflowId: z.ZodString;
1192
- error: z.ZodObject<{
1193
- name: z.ZodOptional<z.ZodString>;
1194
- message: z.ZodString;
1195
- code: z.ZodOptional<z.ZodString>;
1196
- stack: z.ZodOptional<z.ZodString>;
1197
- details: z.ZodOptional<z.ZodAny>;
1198
- }, "strip", z.ZodTypeAny, {
1199
- message: string;
1200
- name?: string | undefined;
1201
- code?: string | undefined;
1202
- stack?: string | undefined;
1203
- details?: any;
1204
- }, {
1205
- message: string;
1206
- name?: string | undefined;
1207
- code?: string | undefined;
1208
- stack?: string | undefined;
1209
- details?: any;
1210
- }>;
1211
- durationMs: z.ZodOptional<z.ZodNumber>;
1212
- }, "strip", z.ZodTypeAny, {
1213
- error: {
1214
- message: string;
1215
- name?: string | undefined;
1216
- code?: string | undefined;
1217
- stack?: string | undefined;
1218
- details?: any;
1219
- };
1220
- workflowId: string;
1221
- durationMs?: number | undefined;
1222
- }, {
1223
- error: {
1224
- message: string;
1225
- name?: string | undefined;
1226
- code?: string | undefined;
1227
- stack?: string | undefined;
1228
- details?: any;
1229
- };
1230
- workflowId: string;
1231
- durationMs?: number | undefined;
1232
- }>;
1233
- }, "strip", z.ZodTypeAny, {
1234
- type: "workflow:execution:error";
1235
- timestamp: string;
1236
- trace: {
1237
- traceId: string;
1238
- spanId: string;
1239
- parentSpanId?: string | undefined;
1240
- };
1241
- data: {
1242
- error: {
1243
- message: string;
1244
- name?: string | undefined;
1245
- code?: string | undefined;
1246
- stack?: string | undefined;
1247
- details?: any;
1248
- };
1249
- workflowId: string;
1250
- durationMs?: number | undefined;
1251
- };
1252
- correlationId?: string | undefined;
1253
- runId?: string | undefined;
1254
- }, {
1255
- type: "workflow:execution:error";
1256
- timestamp: string;
1257
- trace: {
1258
- traceId: string;
1259
- spanId: string;
1260
- parentSpanId?: string | undefined;
1261
- };
1262
- data: {
1263
- error: {
1264
- message: string;
1265
- name?: string | undefined;
1266
- code?: string | undefined;
1267
- stack?: string | undefined;
1268
- details?: any;
1269
- };
1270
- workflowId: string;
1271
- durationMs?: number | undefined;
1272
- };
1273
- correlationId?: string | undefined;
1274
- runId?: string | undefined;
1275
- }>;
1276
- declare const WorkflowStepSchema: z.ZodObject<{
1277
- timestamp: z.ZodString;
1278
- trace: z.ZodObject<{
1279
- traceId: z.ZodString;
1280
- spanId: z.ZodString;
1281
- parentSpanId: z.ZodOptional<z.ZodString>;
1282
- }, "strip", z.ZodTypeAny, {
1283
- traceId: string;
1284
- spanId: string;
1285
- parentSpanId?: string | undefined;
1286
- }, {
1287
- traceId: string;
1288
- spanId: string;
1289
- parentSpanId?: string | undefined;
1290
- }>;
1291
- correlationId: z.ZodOptional<z.ZodString>;
1292
- runId: z.ZodOptional<z.ZodString>;
1293
- } & {
1294
- type: z.ZodLiteral<"workflow:step">;
1295
- data: z.ZodObject<{
1296
- workflowId: z.ZodString;
1297
- stepName: z.ZodOptional<z.ZodString>;
1298
- nodeId: z.ZodOptional<z.ZodString>;
1299
- status: z.ZodEnum<["running", "success", "error"]>;
1300
- durationMs: z.ZodOptional<z.ZodNumber>;
1301
- output: z.ZodOptional<z.ZodAny>;
1302
- error: z.ZodOptional<z.ZodObject<{
1303
- name: z.ZodOptional<z.ZodString>;
1304
- message: z.ZodString;
1305
- code: z.ZodOptional<z.ZodString>;
1306
- stack: z.ZodOptional<z.ZodString>;
1307
- details: z.ZodOptional<z.ZodAny>;
1308
- }, "strip", z.ZodTypeAny, {
1309
- message: string;
1310
- name?: string | undefined;
1311
- code?: string | undefined;
1312
- stack?: string | undefined;
1313
- details?: any;
1314
- }, {
1315
- message: string;
1316
- name?: string | undefined;
1317
- code?: string | undefined;
1318
- stack?: string | undefined;
1319
- details?: any;
1320
- }>>;
1321
- }, "strip", z.ZodTypeAny, {
1322
- status: "error" | "success" | "running";
1323
- workflowId: string;
1324
- error?: {
1325
- message: string;
1326
- name?: string | undefined;
1327
- code?: string | undefined;
1328
- stack?: string | undefined;
1329
- details?: any;
1330
- } | undefined;
1331
- output?: any;
1332
- durationMs?: number | undefined;
1333
- stepName?: string | undefined;
1334
- nodeId?: string | undefined;
1335
- }, {
1336
- status: "error" | "success" | "running";
1337
- workflowId: string;
1338
- error?: {
1339
- message: string;
1340
- name?: string | undefined;
1341
- code?: string | undefined;
1342
- stack?: string | undefined;
1343
- details?: any;
1344
- } | undefined;
1345
- output?: any;
1346
- durationMs?: number | undefined;
1347
- stepName?: string | undefined;
1348
- nodeId?: string | undefined;
1349
- }>;
1350
- }, "strip", z.ZodTypeAny, {
1351
- type: "workflow:step";
1352
- timestamp: string;
1353
- trace: {
1354
- traceId: string;
1355
- spanId: string;
1356
- parentSpanId?: string | undefined;
1357
- };
1358
- data: {
1359
- status: "error" | "success" | "running";
1360
- workflowId: string;
1361
- error?: {
1362
- message: string;
1363
- name?: string | undefined;
1364
- code?: string | undefined;
1365
- stack?: string | undefined;
1366
- details?: any;
1367
- } | undefined;
1368
- output?: any;
1369
- durationMs?: number | undefined;
1370
- stepName?: string | undefined;
1371
- nodeId?: string | undefined;
1372
- };
1373
- correlationId?: string | undefined;
1374
- runId?: string | undefined;
1375
- }, {
1376
- type: "workflow:step";
1377
- timestamp: string;
1378
- trace: {
1379
- traceId: string;
1380
- spanId: string;
1381
- parentSpanId?: string | undefined;
1382
- };
1383
- data: {
1384
- status: "error" | "success" | "running";
1385
- workflowId: string;
1386
- error?: {
1387
- message: string;
1388
- name?: string | undefined;
1389
- code?: string | undefined;
1390
- stack?: string | undefined;
1391
- details?: any;
1392
- } | undefined;
1393
- output?: any;
1394
- durationMs?: number | undefined;
1395
- stepName?: string | undefined;
1396
- nodeId?: string | undefined;
1397
- };
1398
- correlationId?: string | undefined;
1399
- runId?: string | undefined;
1400
- }>;
1401
- declare const NebulaEventSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
1402
- timestamp: z.ZodString;
1403
- trace: z.ZodObject<{
1404
- traceId: z.ZodString;
1405
- spanId: z.ZodString;
1406
- parentSpanId: z.ZodOptional<z.ZodString>;
1407
- }, "strip", z.ZodTypeAny, {
1408
- traceId: string;
1409
- spanId: string;
1410
- parentSpanId?: string | undefined;
1411
- }, {
1412
- traceId: string;
1413
- spanId: string;
1414
- parentSpanId?: string | undefined;
1415
- }>;
1416
- correlationId: z.ZodOptional<z.ZodString>;
1417
- runId: z.ZodOptional<z.ZodString>;
1418
- } & {
1419
- type: z.ZodLiteral<"agent:execution:start">;
1420
- data: z.ZodObject<{
1421
- agentName: z.ZodString;
1422
- input: z.ZodOptional<z.ZodAny>;
1423
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
1424
- }, "strip", z.ZodTypeAny, {
1425
- agentName: string;
1426
- input?: any;
1427
- metadata?: Record<string, any> | undefined;
1428
- }, {
1429
- agentName: string;
1430
- input?: any;
1431
- metadata?: Record<string, any> | undefined;
1432
- }>;
1433
- }, "strip", z.ZodTypeAny, {
1434
- type: "agent:execution:start";
1435
- timestamp: string;
1436
- trace: {
1437
- traceId: string;
1438
- spanId: string;
1439
- parentSpanId?: string | undefined;
1440
- };
1441
- data: {
1442
- agentName: string;
1443
- input?: any;
1444
- metadata?: Record<string, any> | undefined;
1445
- };
1446
- correlationId?: string | undefined;
1447
- runId?: string | undefined;
1448
- }, {
1449
- type: "agent:execution:start";
1450
- timestamp: string;
1451
- trace: {
1452
- traceId: string;
1453
- spanId: string;
1454
- parentSpanId?: string | undefined;
1455
- };
1456
- data: {
1457
- agentName: string;
1458
- input?: any;
1459
- metadata?: Record<string, any> | undefined;
1460
- };
1461
- correlationId?: string | undefined;
1462
- runId?: string | undefined;
1463
- }>, z.ZodObject<{
1464
- timestamp: z.ZodString;
1465
- trace: z.ZodObject<{
1466
- traceId: z.ZodString;
1467
- spanId: z.ZodString;
1468
- parentSpanId: z.ZodOptional<z.ZodString>;
1469
- }, "strip", z.ZodTypeAny, {
1470
- traceId: string;
1471
- spanId: string;
1472
- parentSpanId?: string | undefined;
1473
- }, {
1474
- traceId: string;
1475
- spanId: string;
1476
- parentSpanId?: string | undefined;
1477
- }>;
1478
- correlationId: z.ZodOptional<z.ZodString>;
1479
- runId: z.ZodOptional<z.ZodString>;
1480
- } & {
1481
- type: z.ZodLiteral<"agent:execution:end">;
1482
- data: z.ZodObject<{
1483
- agentName: z.ZodString;
1484
- status: z.ZodEnum<["success", "error", "truncated"]>;
1485
- output: z.ZodOptional<z.ZodAny>;
1486
- durationMs: z.ZodNumber;
1487
- usage: z.ZodOptional<z.ZodObject<{
1488
- promptTokens: z.ZodNumber;
1489
- completionTokens: z.ZodNumber;
1490
- totalTokens: z.ZodNumber;
1491
- reasoningTokens: z.ZodOptional<z.ZodNumber>;
1492
- }, "strip", z.ZodTypeAny, {
1493
- promptTokens: number;
1494
- completionTokens: number;
1495
- totalTokens: number;
1496
- reasoningTokens?: number | undefined;
1497
- }, {
1498
- promptTokens: number;
1499
- completionTokens: number;
1500
- totalTokens: number;
1501
- reasoningTokens?: number | undefined;
1502
- }>>;
1503
- }, "strip", z.ZodTypeAny, {
1504
- status: "error" | "success" | "truncated";
1505
- agentName: string;
1506
- durationMs: number;
1507
- output?: any;
1508
- usage?: {
1509
- promptTokens: number;
1510
- completionTokens: number;
1511
- totalTokens: number;
1512
- reasoningTokens?: number | undefined;
1513
- } | undefined;
1514
- }, {
1515
- status: "error" | "success" | "truncated";
1516
- agentName: string;
1517
- durationMs: number;
1518
- output?: any;
1519
- usage?: {
1520
- promptTokens: number;
1521
- completionTokens: number;
1522
- totalTokens: number;
1523
- reasoningTokens?: number | undefined;
1524
- } | undefined;
1525
- }>;
1526
- }, "strip", z.ZodTypeAny, {
1527
- type: "agent:execution:end";
1528
- timestamp: string;
1529
- trace: {
1530
- traceId: string;
1531
- spanId: string;
1532
- parentSpanId?: string | undefined;
1533
- };
1534
- data: {
1535
- status: "error" | "success" | "truncated";
1536
- agentName: string;
1537
- durationMs: number;
1538
- output?: any;
1539
- usage?: {
1540
- promptTokens: number;
1541
- completionTokens: number;
1542
- totalTokens: number;
1543
- reasoningTokens?: number | undefined;
1544
- } | undefined;
1545
- };
1546
- correlationId?: string | undefined;
1547
- runId?: string | undefined;
1548
- }, {
1549
- type: "agent:execution:end";
1550
- timestamp: string;
1551
- trace: {
1552
- traceId: string;
1553
- spanId: string;
1554
- parentSpanId?: string | undefined;
1555
- };
1556
- data: {
1557
- status: "error" | "success" | "truncated";
1558
- agentName: string;
1559
- durationMs: number;
1560
- output?: any;
1561
- usage?: {
1562
- promptTokens: number;
1563
- completionTokens: number;
1564
- totalTokens: number;
1565
- reasoningTokens?: number | undefined;
1566
- } | undefined;
1567
- };
1568
- correlationId?: string | undefined;
1569
- runId?: string | undefined;
1570
- }>, z.ZodObject<{
1571
- timestamp: z.ZodString;
1572
- trace: z.ZodObject<{
1573
- traceId: z.ZodString;
1574
- spanId: z.ZodString;
1575
- parentSpanId: z.ZodOptional<z.ZodString>;
1576
- }, "strip", z.ZodTypeAny, {
1577
- traceId: string;
1578
- spanId: string;
1579
- parentSpanId?: string | undefined;
1580
- }, {
1581
- traceId: string;
1582
- spanId: string;
1583
- parentSpanId?: string | undefined;
1584
- }>;
1585
- correlationId: z.ZodOptional<z.ZodString>;
1586
- runId: z.ZodOptional<z.ZodString>;
1587
- } & {
1588
- type: z.ZodLiteral<"agent:execution:error">;
1589
- data: z.ZodObject<{
1590
- agentName: z.ZodString;
1591
- error: z.ZodObject<{
1592
- name: z.ZodOptional<z.ZodString>;
1593
- message: z.ZodString;
1594
- code: z.ZodOptional<z.ZodString>;
1595
- stack: z.ZodOptional<z.ZodString>;
1596
- details: z.ZodOptional<z.ZodAny>;
1597
- }, "strip", z.ZodTypeAny, {
1598
- message: string;
1599
- name?: string | undefined;
1600
- code?: string | undefined;
1601
- stack?: string | undefined;
1602
- details?: any;
1603
- }, {
1604
- message: string;
1605
- name?: string | undefined;
1606
- code?: string | undefined;
1607
- stack?: string | undefined;
1608
- details?: any;
1609
- }>;
1610
- durationMs: z.ZodOptional<z.ZodNumber>;
1611
- }, "strip", z.ZodTypeAny, {
1612
- error: {
1613
- message: string;
1614
- name?: string | undefined;
1615
- code?: string | undefined;
1616
- stack?: string | undefined;
1617
- details?: any;
1618
- };
1619
- agentName: string;
1620
- durationMs?: number | undefined;
1621
- }, {
1622
- error: {
1623
- message: string;
1624
- name?: string | undefined;
1625
- code?: string | undefined;
1626
- stack?: string | undefined;
1627
- details?: any;
1628
- };
1629
- agentName: string;
1630
- durationMs?: number | undefined;
1631
- }>;
1632
- }, "strip", z.ZodTypeAny, {
1633
- type: "agent:execution:error";
1634
- timestamp: string;
1635
- trace: {
1636
- traceId: string;
1637
- spanId: string;
1638
- parentSpanId?: string | undefined;
1639
- };
1640
- data: {
1641
- error: {
1642
- message: string;
1643
- name?: string | undefined;
1644
- code?: string | undefined;
1645
- stack?: string | undefined;
1646
- details?: any;
1647
- };
1648
- agentName: string;
1649
- durationMs?: number | undefined;
1650
- };
1651
- correlationId?: string | undefined;
1652
- runId?: string | undefined;
1653
- }, {
1654
- type: "agent:execution:error";
1655
- timestamp: string;
1656
- trace: {
1657
- traceId: string;
1658
- spanId: string;
1659
- parentSpanId?: string | undefined;
1660
- };
1661
- data: {
1662
- error: {
1663
- message: string;
1664
- name?: string | undefined;
1665
- code?: string | undefined;
1666
- stack?: string | undefined;
1667
- details?: any;
1668
- };
1669
- agentName: string;
1670
- durationMs?: number | undefined;
1671
- };
1672
- correlationId?: string | undefined;
1673
- runId?: string | undefined;
1674
- }>, z.ZodObject<{
1675
- timestamp: z.ZodString;
1676
- trace: z.ZodObject<{
1677
- traceId: z.ZodString;
1678
- spanId: z.ZodString;
1679
- parentSpanId: z.ZodOptional<z.ZodString>;
1680
- }, "strip", z.ZodTypeAny, {
1681
- traceId: string;
1682
- spanId: string;
1683
- parentSpanId?: string | undefined;
1684
- }, {
1685
- traceId: string;
1686
- spanId: string;
1687
- parentSpanId?: string | undefined;
1688
- }>;
1689
- correlationId: z.ZodOptional<z.ZodString>;
1690
- runId: z.ZodOptional<z.ZodString>;
1691
- } & {
1692
- type: z.ZodLiteral<"agent:llm:call">;
1693
- data: z.ZodObject<{
1694
- agentName: z.ZodString;
1695
- step: z.ZodNumber;
1696
- model: z.ZodObject<{
1697
- provider: z.ZodString;
1698
- model: z.ZodString;
1699
- temperature: z.ZodOptional<z.ZodNumber>;
1700
- maxTokens: z.ZodOptional<z.ZodNumber>;
1701
- topP: z.ZodOptional<z.ZodNumber>;
1702
- frequencyPenalty: z.ZodOptional<z.ZodNumber>;
1703
- presencePenalty: z.ZodOptional<z.ZodNumber>;
1704
- }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
1705
- provider: z.ZodString;
1706
- model: z.ZodString;
1707
- temperature: z.ZodOptional<z.ZodNumber>;
1708
- maxTokens: z.ZodOptional<z.ZodNumber>;
1709
- topP: z.ZodOptional<z.ZodNumber>;
1710
- frequencyPenalty: z.ZodOptional<z.ZodNumber>;
1711
- presencePenalty: z.ZodOptional<z.ZodNumber>;
1712
- }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1713
- provider: z.ZodString;
1714
- model: z.ZodString;
1715
- temperature: z.ZodOptional<z.ZodNumber>;
1716
- maxTokens: z.ZodOptional<z.ZodNumber>;
1717
- topP: z.ZodOptional<z.ZodNumber>;
1718
- frequencyPenalty: z.ZodOptional<z.ZodNumber>;
1719
- presencePenalty: z.ZodOptional<z.ZodNumber>;
1720
- }, z.ZodTypeAny, "passthrough">>;
1721
- messages: z.ZodArray<z.ZodAny, "many">;
1722
- tools: z.ZodOptional<z.ZodArray<z.ZodAny, "many">>;
1723
- responseFormat: z.ZodOptional<z.ZodAny>;
1724
- }, "strip", z.ZodTypeAny, {
1725
- model: {
1726
- provider: string;
1727
- model: string;
1728
- temperature?: number | undefined;
1729
- maxTokens?: number | undefined;
1730
- topP?: number | undefined;
1731
- frequencyPenalty?: number | undefined;
1732
- presencePenalty?: number | undefined;
1733
- } & {
1734
- [k: string]: unknown;
1735
- };
1736
- agentName: string;
1737
- step: number;
1738
- messages: any[];
1739
- responseFormat?: any;
1740
- tools?: any[] | undefined;
1741
- }, {
1742
- model: {
1743
- provider: string;
1744
- model: string;
1745
- temperature?: number | undefined;
1746
- maxTokens?: number | undefined;
1747
- topP?: number | undefined;
1748
- frequencyPenalty?: number | undefined;
1749
- presencePenalty?: number | undefined;
1750
- } & {
1751
- [k: string]: unknown;
1752
- };
1753
- agentName: string;
1754
- step: number;
1755
- messages: any[];
1756
- responseFormat?: any;
1757
- tools?: any[] | undefined;
1758
- }>;
1759
- }, "strip", z.ZodTypeAny, {
1760
- type: "agent:llm:call";
1761
- timestamp: string;
1762
- trace: {
1763
- traceId: string;
1764
- spanId: string;
1765
- parentSpanId?: string | undefined;
1766
- };
1767
- data: {
1768
- model: {
1769
- provider: string;
1770
- model: string;
1771
- temperature?: number | undefined;
1772
- maxTokens?: number | undefined;
1773
- topP?: number | undefined;
1774
- frequencyPenalty?: number | undefined;
1775
- presencePenalty?: number | undefined;
1776
- } & {
1777
- [k: string]: unknown;
1778
- };
1779
- agentName: string;
1780
- step: number;
1781
- messages: any[];
1782
- responseFormat?: any;
1783
- tools?: any[] | undefined;
1784
- };
1785
- correlationId?: string | undefined;
1786
- runId?: string | undefined;
1787
- }, {
1788
- type: "agent:llm:call";
1789
- timestamp: string;
1790
- trace: {
1791
- traceId: string;
1792
- spanId: string;
1793
- parentSpanId?: string | undefined;
1794
- };
1795
- data: {
1796
- model: {
1797
- provider: string;
1798
- model: string;
1799
- temperature?: number | undefined;
1800
- maxTokens?: number | undefined;
1801
- topP?: number | undefined;
1802
- frequencyPenalty?: number | undefined;
1803
- presencePenalty?: number | undefined;
1804
- } & {
1805
- [k: string]: unknown;
1806
- };
1807
- agentName: string;
1808
- step: number;
1809
- messages: any[];
1810
- responseFormat?: any;
1811
- tools?: any[] | undefined;
1812
- };
1813
- correlationId?: string | undefined;
1814
- runId?: string | undefined;
1815
- }>, z.ZodObject<{
1816
- timestamp: z.ZodString;
1817
- trace: z.ZodObject<{
1818
- traceId: z.ZodString;
1819
- spanId: z.ZodString;
1820
- parentSpanId: z.ZodOptional<z.ZodString>;
1821
- }, "strip", z.ZodTypeAny, {
1822
- traceId: string;
1823
- spanId: string;
1824
- parentSpanId?: string | undefined;
1825
- }, {
1826
- traceId: string;
1827
- spanId: string;
1828
- parentSpanId?: string | undefined;
1829
- }>;
1830
- correlationId: z.ZodOptional<z.ZodString>;
1831
- runId: z.ZodOptional<z.ZodString>;
1832
- } & {
1833
- type: z.ZodLiteral<"agent:llm:response">;
1834
- data: z.ZodObject<{
1835
- agentName: z.ZodString;
1836
- step: z.ZodNumber;
1837
- model: z.ZodObject<{
1838
- provider: z.ZodString;
1839
- model: z.ZodString;
1840
- temperature: z.ZodOptional<z.ZodNumber>;
1841
- maxTokens: z.ZodOptional<z.ZodNumber>;
1842
- topP: z.ZodOptional<z.ZodNumber>;
1843
- frequencyPenalty: z.ZodOptional<z.ZodNumber>;
1844
- presencePenalty: z.ZodOptional<z.ZodNumber>;
1845
- }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
1846
- provider: z.ZodString;
1847
- model: z.ZodString;
1848
- temperature: z.ZodOptional<z.ZodNumber>;
1849
- maxTokens: z.ZodOptional<z.ZodNumber>;
1850
- topP: z.ZodOptional<z.ZodNumber>;
1851
- frequencyPenalty: z.ZodOptional<z.ZodNumber>;
1852
- presencePenalty: z.ZodOptional<z.ZodNumber>;
1853
- }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1854
- provider: z.ZodString;
1855
- model: z.ZodString;
1856
- temperature: z.ZodOptional<z.ZodNumber>;
1857
- maxTokens: z.ZodOptional<z.ZodNumber>;
1858
- topP: z.ZodOptional<z.ZodNumber>;
1859
- frequencyPenalty: z.ZodOptional<z.ZodNumber>;
1860
- presencePenalty: z.ZodOptional<z.ZodNumber>;
1861
- }, z.ZodTypeAny, "passthrough">>;
1862
- content: z.ZodAny;
1863
- toolCalls: z.ZodOptional<z.ZodArray<z.ZodAny, "many">>;
1864
- finishReason: z.ZodOptional<z.ZodString>;
1865
- usage: z.ZodOptional<z.ZodObject<{
1866
- promptTokens: z.ZodNumber;
1867
- completionTokens: z.ZodNumber;
1868
- totalTokens: z.ZodNumber;
1869
- reasoningTokens: z.ZodOptional<z.ZodNumber>;
1870
- }, "strip", z.ZodTypeAny, {
1871
- promptTokens: number;
1872
- completionTokens: number;
1873
- totalTokens: number;
1874
- reasoningTokens?: number | undefined;
1875
- }, {
1876
- promptTokens: number;
1877
- completionTokens: number;
1878
- totalTokens: number;
1879
- reasoningTokens?: number | undefined;
1880
- }>>;
1881
- durationMs: z.ZodOptional<z.ZodNumber>;
1882
- }, "strip", z.ZodTypeAny, {
1883
- model: {
1884
- provider: string;
1885
- model: string;
1886
- temperature?: number | undefined;
1887
- maxTokens?: number | undefined;
1888
- topP?: number | undefined;
1889
- frequencyPenalty?: number | undefined;
1890
- presencePenalty?: number | undefined;
1891
- } & {
1892
- [k: string]: unknown;
1893
- };
1894
- agentName: string;
1895
- step: number;
1896
- finishReason?: string | undefined;
1897
- durationMs?: number | undefined;
1898
- usage?: {
1899
- promptTokens: number;
1900
- completionTokens: number;
1901
- totalTokens: number;
1902
- reasoningTokens?: number | undefined;
1903
- } | undefined;
1904
- content?: any;
1905
- toolCalls?: any[] | undefined;
1906
- }, {
1907
- model: {
1908
- provider: string;
1909
- model: string;
1910
- temperature?: number | undefined;
1911
- maxTokens?: number | undefined;
1912
- topP?: number | undefined;
1913
- frequencyPenalty?: number | undefined;
1914
- presencePenalty?: number | undefined;
1915
- } & {
1916
- [k: string]: unknown;
1917
- };
1918
- agentName: string;
1919
- step: number;
1920
- finishReason?: string | undefined;
1921
- durationMs?: number | undefined;
1922
- usage?: {
1923
- promptTokens: number;
1924
- completionTokens: number;
1925
- totalTokens: number;
1926
- reasoningTokens?: number | undefined;
1927
- } | undefined;
1928
- content?: any;
1929
- toolCalls?: any[] | undefined;
1930
- }>;
1931
- }, "strip", z.ZodTypeAny, {
1932
- type: "agent:llm:response";
1933
- timestamp: string;
1934
- trace: {
1935
- traceId: string;
1936
- spanId: string;
1937
- parentSpanId?: string | undefined;
1938
- };
1939
- data: {
1940
- model: {
1941
- provider: string;
1942
- model: string;
1943
- temperature?: number | undefined;
1944
- maxTokens?: number | undefined;
1945
- topP?: number | undefined;
1946
- frequencyPenalty?: number | undefined;
1947
- presencePenalty?: number | undefined;
1948
- } & {
1949
- [k: string]: unknown;
1950
- };
1951
- agentName: string;
1952
- step: number;
1953
- finishReason?: string | undefined;
1954
- durationMs?: number | undefined;
1955
- usage?: {
1956
- promptTokens: number;
1957
- completionTokens: number;
1958
- totalTokens: number;
1959
- reasoningTokens?: number | undefined;
1960
- } | undefined;
1961
- content?: any;
1962
- toolCalls?: any[] | undefined;
1963
- };
1964
- correlationId?: string | undefined;
1965
- runId?: string | undefined;
1966
- }, {
1967
- type: "agent:llm:response";
1968
- timestamp: string;
1969
- trace: {
1970
- traceId: string;
1971
- spanId: string;
1972
- parentSpanId?: string | undefined;
1973
- };
1974
- data: {
1975
- model: {
1976
- provider: string;
1977
- model: string;
1978
- temperature?: number | undefined;
1979
- maxTokens?: number | undefined;
1980
- topP?: number | undefined;
1981
- frequencyPenalty?: number | undefined;
1982
- presencePenalty?: number | undefined;
1983
- } & {
1984
- [k: string]: unknown;
1985
- };
1986
- agentName: string;
1987
- step: number;
1988
- finishReason?: string | undefined;
1989
- durationMs?: number | undefined;
1990
- usage?: {
1991
- promptTokens: number;
1992
- completionTokens: number;
1993
- totalTokens: number;
1994
- reasoningTokens?: number | undefined;
1995
- } | undefined;
1996
- content?: any;
1997
- toolCalls?: any[] | undefined;
1998
- };
1999
- correlationId?: string | undefined;
2000
- runId?: string | undefined;
2001
- }>, z.ZodObject<{
2002
- timestamp: z.ZodString;
2003
- trace: z.ZodObject<{
2004
- traceId: z.ZodString;
2005
- spanId: z.ZodString;
2006
- parentSpanId: z.ZodOptional<z.ZodString>;
2007
- }, "strip", z.ZodTypeAny, {
2008
- traceId: string;
2009
- spanId: string;
2010
- parentSpanId?: string | undefined;
2011
- }, {
2012
- traceId: string;
2013
- spanId: string;
2014
- parentSpanId?: string | undefined;
2015
- }>;
2016
- correlationId: z.ZodOptional<z.ZodString>;
2017
- runId: z.ZodOptional<z.ZodString>;
2018
- } & {
2019
- type: z.ZodLiteral<"agent:tool:call">;
2020
- data: z.ZodObject<{
2021
- agentName: z.ZodString;
2022
- toolName: z.ZodString;
2023
- toolCallId: z.ZodString;
2024
- args: z.ZodAny;
2025
- }, "strip", z.ZodTypeAny, {
2026
- agentName: string;
2027
- toolName: string;
2028
- toolCallId: string;
2029
- args?: any;
2030
- }, {
2031
- agentName: string;
2032
- toolName: string;
2033
- toolCallId: string;
2034
- args?: any;
2035
- }>;
2036
- }, "strip", z.ZodTypeAny, {
2037
- type: "agent:tool:call";
2038
- timestamp: string;
2039
- trace: {
2040
- traceId: string;
2041
- spanId: string;
2042
- parentSpanId?: string | undefined;
2043
- };
2044
- data: {
2045
- agentName: string;
2046
- toolName: string;
2047
- toolCallId: string;
2048
- args?: any;
2049
- };
2050
- correlationId?: string | undefined;
2051
- runId?: string | undefined;
2052
- }, {
2053
- type: "agent:tool:call";
2054
- timestamp: string;
2055
- trace: {
2056
- traceId: string;
2057
- spanId: string;
2058
- parentSpanId?: string | undefined;
2059
- };
2060
- data: {
2061
- agentName: string;
2062
- toolName: string;
2063
- toolCallId: string;
2064
- args?: any;
2065
- };
2066
- correlationId?: string | undefined;
2067
- runId?: string | undefined;
2068
- }>, z.ZodObject<{
2069
- timestamp: z.ZodString;
2070
- trace: z.ZodObject<{
2071
- traceId: z.ZodString;
2072
- spanId: z.ZodString;
2073
- parentSpanId: z.ZodOptional<z.ZodString>;
2074
- }, "strip", z.ZodTypeAny, {
2075
- traceId: string;
2076
- spanId: string;
2077
- parentSpanId?: string | undefined;
2078
- }, {
2079
- traceId: string;
2080
- spanId: string;
2081
- parentSpanId?: string | undefined;
2082
- }>;
2083
- correlationId: z.ZodOptional<z.ZodString>;
2084
- runId: z.ZodOptional<z.ZodString>;
2085
- } & {
2086
- type: z.ZodLiteral<"agent:tool:result">;
2087
- data: z.ZodObject<{
2088
- agentName: z.ZodString;
2089
- toolName: z.ZodString;
2090
- toolCallId: z.ZodString;
2091
- output: z.ZodOptional<z.ZodAny>;
2092
- error: z.ZodOptional<z.ZodString>;
2093
- durationMs: z.ZodOptional<z.ZodNumber>;
2094
- }, "strip", z.ZodTypeAny, {
2095
- agentName: string;
2096
- toolName: string;
2097
- toolCallId: string;
2098
- error?: string | undefined;
2099
- output?: any;
2100
- durationMs?: number | undefined;
2101
- }, {
2102
- agentName: string;
2103
- toolName: string;
2104
- toolCallId: string;
2105
- error?: string | undefined;
2106
- output?: any;
2107
- durationMs?: number | undefined;
2108
- }>;
2109
- }, "strip", z.ZodTypeAny, {
2110
- type: "agent:tool:result";
2111
- timestamp: string;
2112
- trace: {
2113
- traceId: string;
2114
- spanId: string;
2115
- parentSpanId?: string | undefined;
2116
- };
2117
- data: {
2118
- agentName: string;
2119
- toolName: string;
2120
- toolCallId: string;
2121
- error?: string | undefined;
2122
- output?: any;
2123
- durationMs?: number | undefined;
2124
- };
2125
- correlationId?: string | undefined;
2126
- runId?: string | undefined;
2127
- }, {
2128
- type: "agent:tool:result";
2129
- timestamp: string;
2130
- trace: {
2131
- traceId: string;
2132
- spanId: string;
2133
- parentSpanId?: string | undefined;
2134
- };
2135
- data: {
2136
- agentName: string;
2137
- toolName: string;
2138
- toolCallId: string;
2139
- error?: string | undefined;
2140
- output?: any;
2141
- durationMs?: number | undefined;
2142
- };
2143
- correlationId?: string | undefined;
2144
- runId?: string | undefined;
2145
- }>, z.ZodObject<{
2146
- timestamp: z.ZodString;
2147
- trace: z.ZodObject<{
2148
- traceId: z.ZodString;
2149
- spanId: z.ZodString;
2150
- parentSpanId: z.ZodOptional<z.ZodString>;
2151
- }, "strip", z.ZodTypeAny, {
2152
- traceId: string;
2153
- spanId: string;
2154
- parentSpanId?: string | undefined;
2155
- }, {
2156
- traceId: string;
2157
- spanId: string;
2158
- parentSpanId?: string | undefined;
2159
- }>;
2160
- correlationId: z.ZodOptional<z.ZodString>;
2161
- runId: z.ZodOptional<z.ZodString>;
2162
- } & {
2163
- type: z.ZodLiteral<"workflow:execution:start">;
2164
- data: z.ZodObject<{
2165
- workflowId: z.ZodString;
2166
- input: z.ZodOptional<z.ZodAny>;
2167
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
2168
- }, "strip", z.ZodTypeAny, {
2169
- workflowId: string;
2170
- input?: any;
2171
- metadata?: Record<string, any> | undefined;
2172
- }, {
2173
- workflowId: string;
2174
- input?: any;
2175
- metadata?: Record<string, any> | undefined;
2176
- }>;
2177
- }, "strip", z.ZodTypeAny, {
2178
- type: "workflow:execution:start";
2179
- timestamp: string;
2180
- trace: {
2181
- traceId: string;
2182
- spanId: string;
2183
- parentSpanId?: string | undefined;
2184
- };
2185
- data: {
2186
- workflowId: string;
2187
- input?: any;
2188
- metadata?: Record<string, any> | undefined;
2189
- };
2190
- correlationId?: string | undefined;
2191
- runId?: string | undefined;
2192
- }, {
2193
- type: "workflow:execution:start";
2194
- timestamp: string;
2195
- trace: {
2196
- traceId: string;
2197
- spanId: string;
2198
- parentSpanId?: string | undefined;
2199
- };
2200
- data: {
2201
- workflowId: string;
2202
- input?: any;
2203
- metadata?: Record<string, any> | undefined;
2204
- };
2205
- correlationId?: string | undefined;
2206
- runId?: string | undefined;
2207
- }>, z.ZodObject<{
2208
- timestamp: z.ZodString;
2209
- trace: z.ZodObject<{
2210
- traceId: z.ZodString;
2211
- spanId: z.ZodString;
2212
- parentSpanId: z.ZodOptional<z.ZodString>;
2213
- }, "strip", z.ZodTypeAny, {
2214
- traceId: string;
2215
- spanId: string;
2216
- parentSpanId?: string | undefined;
2217
- }, {
2218
- traceId: string;
2219
- spanId: string;
2220
- parentSpanId?: string | undefined;
2221
- }>;
2222
- correlationId: z.ZodOptional<z.ZodString>;
2223
- runId: z.ZodOptional<z.ZodString>;
2224
- } & {
2225
- type: z.ZodLiteral<"workflow:execution:end">;
2226
- data: z.ZodObject<{
2227
- workflowId: z.ZodString;
2228
- status: z.ZodEnum<["success", "error", "truncated"]>;
2229
- output: z.ZodOptional<z.ZodAny>;
2230
- durationMs: z.ZodNumber;
2231
- }, "strip", z.ZodTypeAny, {
2232
- status: "error" | "success" | "truncated";
2233
- durationMs: number;
2234
- workflowId: string;
2235
- output?: any;
2236
- }, {
2237
- status: "error" | "success" | "truncated";
2238
- durationMs: number;
2239
- workflowId: string;
2240
- output?: any;
2241
- }>;
2242
- }, "strip", z.ZodTypeAny, {
2243
- type: "workflow:execution:end";
2244
- timestamp: string;
2245
- trace: {
2246
- traceId: string;
2247
- spanId: string;
2248
- parentSpanId?: string | undefined;
2249
- };
2250
- data: {
2251
- status: "error" | "success" | "truncated";
2252
- durationMs: number;
2253
- workflowId: string;
2254
- output?: any;
2255
- };
2256
- correlationId?: string | undefined;
2257
- runId?: string | undefined;
2258
- }, {
2259
- type: "workflow:execution:end";
2260
- timestamp: string;
2261
- trace: {
2262
- traceId: string;
2263
- spanId: string;
2264
- parentSpanId?: string | undefined;
2265
- };
2266
- data: {
2267
- status: "error" | "success" | "truncated";
2268
- durationMs: number;
2269
- workflowId: string;
2270
- output?: any;
2271
- };
2272
- correlationId?: string | undefined;
2273
- runId?: string | undefined;
2274
- }>, z.ZodObject<{
2275
- timestamp: z.ZodString;
2276
- trace: z.ZodObject<{
2277
- traceId: z.ZodString;
2278
- spanId: z.ZodString;
2279
- parentSpanId: z.ZodOptional<z.ZodString>;
2280
- }, "strip", z.ZodTypeAny, {
2281
- traceId: string;
2282
- spanId: string;
2283
- parentSpanId?: string | undefined;
2284
- }, {
2285
- traceId: string;
2286
- spanId: string;
2287
- parentSpanId?: string | undefined;
2288
- }>;
2289
- correlationId: z.ZodOptional<z.ZodString>;
2290
- runId: z.ZodOptional<z.ZodString>;
2291
- } & {
2292
- type: z.ZodLiteral<"workflow:execution:error">;
2293
- data: z.ZodObject<{
2294
- workflowId: z.ZodString;
2295
- error: z.ZodObject<{
2296
- name: z.ZodOptional<z.ZodString>;
2297
- message: z.ZodString;
2298
- code: z.ZodOptional<z.ZodString>;
2299
- stack: z.ZodOptional<z.ZodString>;
2300
- details: z.ZodOptional<z.ZodAny>;
2301
- }, "strip", z.ZodTypeAny, {
2302
- message: string;
2303
- name?: string | undefined;
2304
- code?: string | undefined;
2305
- stack?: string | undefined;
2306
- details?: any;
2307
- }, {
2308
- message: string;
2309
- name?: string | undefined;
2310
- code?: string | undefined;
2311
- stack?: string | undefined;
2312
- details?: any;
2313
- }>;
2314
- durationMs: z.ZodOptional<z.ZodNumber>;
2315
- }, "strip", z.ZodTypeAny, {
2316
- error: {
2317
- message: string;
2318
- name?: string | undefined;
2319
- code?: string | undefined;
2320
- stack?: string | undefined;
2321
- details?: any;
2322
- };
2323
- workflowId: string;
2324
- durationMs?: number | undefined;
2325
- }, {
2326
- error: {
2327
- message: string;
2328
- name?: string | undefined;
2329
- code?: string | undefined;
2330
- stack?: string | undefined;
2331
- details?: any;
2332
- };
2333
- workflowId: string;
2334
- durationMs?: number | undefined;
2335
- }>;
2336
- }, "strip", z.ZodTypeAny, {
2337
- type: "workflow:execution:error";
2338
- timestamp: string;
2339
- trace: {
2340
- traceId: string;
2341
- spanId: string;
2342
- parentSpanId?: string | undefined;
2343
- };
2344
- data: {
2345
- error: {
2346
- message: string;
2347
- name?: string | undefined;
2348
- code?: string | undefined;
2349
- stack?: string | undefined;
2350
- details?: any;
2351
- };
2352
- workflowId: string;
2353
- durationMs?: number | undefined;
2354
- };
2355
- correlationId?: string | undefined;
2356
- runId?: string | undefined;
2357
- }, {
2358
- type: "workflow:execution:error";
2359
- timestamp: string;
2360
- trace: {
2361
- traceId: string;
2362
- spanId: string;
2363
- parentSpanId?: string | undefined;
2364
- };
2365
- data: {
2366
- error: {
2367
- message: string;
2368
- name?: string | undefined;
2369
- code?: string | undefined;
2370
- stack?: string | undefined;
2371
- details?: any;
2372
- };
2373
- workflowId: string;
2374
- durationMs?: number | undefined;
2375
- };
2376
- correlationId?: string | undefined;
2377
- runId?: string | undefined;
2378
- }>, z.ZodObject<{
2379
- timestamp: z.ZodString;
2380
- trace: z.ZodObject<{
2381
- traceId: z.ZodString;
2382
- spanId: z.ZodString;
2383
- parentSpanId: z.ZodOptional<z.ZodString>;
2384
- }, "strip", z.ZodTypeAny, {
2385
- traceId: string;
2386
- spanId: string;
2387
- parentSpanId?: string | undefined;
2388
- }, {
2389
- traceId: string;
2390
- spanId: string;
2391
- parentSpanId?: string | undefined;
2392
- }>;
2393
- correlationId: z.ZodOptional<z.ZodString>;
2394
- runId: z.ZodOptional<z.ZodString>;
2395
- } & {
2396
- type: z.ZodLiteral<"workflow:step">;
2397
- data: z.ZodObject<{
2398
- workflowId: z.ZodString;
2399
- stepName: z.ZodOptional<z.ZodString>;
2400
- nodeId: z.ZodOptional<z.ZodString>;
2401
- status: z.ZodEnum<["running", "success", "error"]>;
2402
- durationMs: z.ZodOptional<z.ZodNumber>;
2403
- output: z.ZodOptional<z.ZodAny>;
2404
- error: z.ZodOptional<z.ZodObject<{
2405
- name: z.ZodOptional<z.ZodString>;
2406
- message: z.ZodString;
2407
- code: z.ZodOptional<z.ZodString>;
2408
- stack: z.ZodOptional<z.ZodString>;
2409
- details: z.ZodOptional<z.ZodAny>;
2410
- }, "strip", z.ZodTypeAny, {
2411
- message: string;
2412
- name?: string | undefined;
2413
- code?: string | undefined;
2414
- stack?: string | undefined;
2415
- details?: any;
2416
- }, {
2417
- message: string;
2418
- name?: string | undefined;
2419
- code?: string | undefined;
2420
- stack?: string | undefined;
2421
- details?: any;
2422
- }>>;
2423
- }, "strip", z.ZodTypeAny, {
2424
- status: "error" | "success" | "running";
2425
- workflowId: string;
2426
- error?: {
2427
- message: string;
2428
- name?: string | undefined;
2429
- code?: string | undefined;
2430
- stack?: string | undefined;
2431
- details?: any;
2432
- } | undefined;
2433
- output?: any;
2434
- durationMs?: number | undefined;
2435
- stepName?: string | undefined;
2436
- nodeId?: string | undefined;
2437
- }, {
2438
- status: "error" | "success" | "running";
2439
- workflowId: string;
2440
- error?: {
2441
- message: string;
2442
- name?: string | undefined;
2443
- code?: string | undefined;
2444
- stack?: string | undefined;
2445
- details?: any;
2446
- } | undefined;
2447
- output?: any;
2448
- durationMs?: number | undefined;
2449
- stepName?: string | undefined;
2450
- nodeId?: string | undefined;
2451
- }>;
2452
- }, "strip", z.ZodTypeAny, {
2453
- type: "workflow:step";
2454
- timestamp: string;
2455
- trace: {
2456
- traceId: string;
2457
- spanId: string;
2458
- parentSpanId?: string | undefined;
2459
- };
2460
- data: {
2461
- status: "error" | "success" | "running";
2462
- workflowId: string;
2463
- error?: {
2464
- message: string;
2465
- name?: string | undefined;
2466
- code?: string | undefined;
2467
- stack?: string | undefined;
2468
- details?: any;
2469
- } | undefined;
2470
- output?: any;
2471
- durationMs?: number | undefined;
2472
- stepName?: string | undefined;
2473
- nodeId?: string | undefined;
2474
- };
2475
- correlationId?: string | undefined;
2476
- runId?: string | undefined;
2477
- }, {
2478
- type: "workflow:step";
2479
- timestamp: string;
2480
- trace: {
2481
- traceId: string;
2482
- spanId: string;
2483
- parentSpanId?: string | undefined;
2484
- };
2485
- data: {
2486
- status: "error" | "success" | "running";
2487
- workflowId: string;
2488
- error?: {
2489
- message: string;
2490
- name?: string | undefined;
2491
- code?: string | undefined;
2492
- stack?: string | undefined;
2493
- details?: any;
2494
- } | undefined;
2495
- output?: any;
2496
- durationMs?: number | undefined;
2497
- stepName?: string | undefined;
2498
- nodeId?: string | undefined;
2499
- };
2500
- correlationId?: string | undefined;
2501
- runId?: string | undefined;
2502
- }>]>;
2503
- type TraceContext = z.infer<typeof TraceContextSchema>;
2504
- type Usage = z.infer<typeof UsageSchema>;
2505
- type NebulaEvent = z.infer<typeof NebulaEventSchema>;
2506
- type AgentExecutionStart = z.infer<typeof AgentExecutionStartSchema>;
2507
- type AgentExecutionEnd = z.infer<typeof AgentExecutionEndSchema>;
2508
- type AgentExecutionError = z.infer<typeof AgentExecutionErrorSchema>;
2509
- type AgentLLMCall = z.infer<typeof AgentLLMCallSchema>;
2510
- type AgentLLMResponse = z.infer<typeof AgentLLMResponseSchema>;
2511
- type AgentToolCall = z.infer<typeof AgentToolCallSchema>;
2512
- type AgentToolResult = z.infer<typeof AgentToolResultSchema>;
2513
- type WorkflowExecutionStart = z.infer<typeof WorkflowExecutionStartSchema>;
2514
- type WorkflowExecutionEnd = z.infer<typeof WorkflowExecutionEndSchema>;
2515
- type WorkflowExecutionError = z.infer<typeof WorkflowExecutionErrorSchema>;
2516
- type WorkflowStep = z.infer<typeof WorkflowStepSchema>;
2517
-
2518
- /**
2519
- * Logging formatters module
2520
- *
2521
- * Contains pure functions for formatting log messages.
2522
- * Each formatter is composable and testable.
2523
- */
2524
-
2525
- /**
2526
- * Formats a complete log line in the format:
2527
- * [Nebula LEVEL | Agent/Workflow name] timestamp [TraceID] message
2528
- *
2529
- * The entire line is colored according to the log level.
2530
- */
2531
- declare function formatLogLine(level: LogLevel, entityName: string | null, message: string, entityType?: "agent" | "workflow" | null, trace?: TraceContext): string;
2532
- /**
2533
- * Formats metadata as nested tree structure
2534
- *
2535
- * @param meta - Object with key-value pairs
2536
- * @param isLastGroup - If true, uses └─ for last item, otherwise ├─
2537
- * @returns Array of formatted lines
2538
- */
2539
- declare function formatMetadata(meta: Record<string, any>, isLastGroup?: boolean): string[];
2540
- /**
2541
- * Formats an error with stack trace
2542
- */
2543
- declare function formatError(error: Error | any): string[];
2544
-
2545
- /**
2546
- * ANSI escape codes for terminal styling
2547
- * Separated for maintainability and reusability
2548
- */
2549
- declare const COLORS: {
2550
- readonly black: "\u001B[30m";
2551
- readonly red: "\u001B[31m";
2552
- readonly green: "\u001B[32m";
2553
- readonly yellow: "\u001B[33m";
2554
- readonly blue: "\u001B[34m";
2555
- readonly magenta: "\u001B[35m";
2556
- readonly cyan: "\u001B[36m";
2557
- readonly white: "\u001B[37m";
2558
- readonly gray: "\u001B[90m";
2559
- readonly brightRed: "\u001B[91m";
2560
- readonly brightGreen: "\u001B[92m";
2561
- readonly brightYellow: "\u001B[93m";
2562
- readonly brightBlue: "\u001B[94m";
2563
- readonly brightMagenta: "\u001B[95m";
2564
- readonly brightCyan: "\u001B[96m";
2565
- readonly pink: "\u001B[38;5;213m";
2566
- readonly reset: "\u001B[0m";
2567
- readonly bold: "\u001B[1m";
2568
- readonly dim: "\u001B[2m";
2569
- readonly italic: "\u001B[3m";
2570
- readonly underline: "\u001B[4m";
2571
- };
2572
- /**
2573
- * Predefined color schemes for different log levels
2574
- * Using bright variants for better visibility
2575
- */
2576
- declare const LOG_LEVEL_COLORS: {
2577
- readonly debug: "\u001B[38;5;213m";
2578
- readonly info: "\u001B[92m";
2579
- readonly warn: "\u001B[93m";
2580
- readonly error: "\u001B[91m";
2581
- };
2582
- /**
2583
- * Tree characters for nested log lines
2584
- */
2585
- declare const TREE_CHARS: {
2586
- readonly branch: "├─";
2587
- readonly last: "└─";
2588
- readonly vertical: "│ ";
2589
- readonly space: " ";
2590
- };
2591
-
2592
- /**
2593
- * AgentLogger binds to Agent events and formats them for logging
2594
- *
2595
- * This class is responsible for:
2596
- * - Listening to agent lifecycle events
2597
- * - Formatting event data into structured logs
2598
- * - Delegating actual logging to an ILogger implementation
2599
- */
2600
- declare class AgentLogger {
2601
- private agent;
2602
- private logger;
2603
- constructor(agent: Agent, logger: ILogger);
2604
- private bindEvents;
2605
- }
2606
-
2607
- /**
2608
- * Workflow Adapters - Interfaces for State and Queue management
2609
- */
2610
- interface WorkflowState {
2611
- workflowId: string;
2612
- executionId: string;
2613
- status: 'pending' | 'running' | 'completed' | 'failed' | 'cancelled';
2614
- currentStep: number;
2615
- stepStates: Record<string, any>;
2616
- input: any;
2617
- output?: any;
2618
- startedAt: Date;
2619
- updatedAt: Date;
2620
- completedAt?: Date;
2621
- error?: string;
2622
- retryCount?: number;
2623
- }
2624
- interface IWorkflowStateStore {
2625
- save(executionId: string, state: WorkflowState): Promise<void>;
2626
- load(executionId: string): Promise<WorkflowState | null>;
2627
- delete(executionId: string): Promise<void>;
2628
- listActive(workflowId?: string): Promise<string[]>;
2629
- }
2630
- interface WorkflowJob {
2631
- executionId: string;
2632
- workflowId: string;
2633
- stepId: string;
2634
- stepName: string;
2635
- input: any;
2636
- attempt: number;
2637
- createdAt: Date;
2638
- }
2639
- interface IWorkflowQueue {
2640
- enqueue(job: WorkflowJob): Promise<void>;
2641
- process(handler: (job: WorkflowJob) => Promise<void>): void;
2642
- close(): Promise<void>;
2643
- getStatus?(executionId: string): Promise<{
2644
- status: WorkflowState['status'];
2645
- currentStep?: string;
2646
- progress?: number;
2647
- }>;
2648
- }
2649
- interface RetryPolicy {
2650
- maxAttempts: number;
2651
- backoff: 'exponential' | 'linear' | 'fixed';
2652
- initialDelay: number;
2653
- maxDelay?: number;
2654
- retryableErrors?: string[];
2655
- }
2656
- declare function calculateRetryDelay(policy: RetryPolicy, attempt: number): number;
2657
- declare function isRetryableError(error: Error, policy: RetryPolicy): boolean;
2658
-
2659
- type WorkflowEventMap = {
2660
- "workflow:execution:start": WorkflowExecutionStart;
2661
- "workflow:execution:end": WorkflowExecutionEnd;
2662
- "workflow:execution:error": WorkflowExecutionError;
2663
- "workflow:step": WorkflowStep;
2664
- };
2665
- type WorkflowEventName = keyof WorkflowEventMap;
2666
-
2667
- type StepContext<T = any> = {
2668
- input: T;
2669
- state: Record<string, any>;
2670
- };
2671
- type StepHandler<Input, Output> = (ctx: StepContext<Input>) => Promise<Output>;
2672
- type StepDefinition<Input = any, Output = any> = {
2673
- id: string;
2674
- name: string;
2675
- handler: StepHandler<Input, Output>;
2676
- type: 'start' | 'standard' | 'branch' | 'parallel' | 'finish';
2677
- branches?: Record<string, Workflow<any, any>>;
2678
- parallelWorkflows?: Workflow<any, any>[];
2679
- };
2680
- interface WorkflowConfig<Input = any, Output = any> {
2681
- id: string;
2682
- name?: string;
2683
- description?: string;
2684
- inputSchema?: ZodSchema<Input>;
2685
- outputSchema?: ZodSchema<Output>;
2686
- maxSteps?: number;
2687
- timeout?: number;
2688
- stateStore?: IWorkflowStateStore;
2689
- queueAdapter?: IWorkflowQueue;
2690
- retryPolicy?: RetryPolicy;
2691
- logLevel?: "debug" | "info" | "warn" | "error" | "none";
2692
- }
2693
- type WorkflowStreamChunk = {
2694
- type: 'step_start';
2695
- step: string;
2696
- } | {
2697
- type: 'step_end';
2698
- step: string;
2699
- output: any;
2700
- };
2701
- declare class Workflow<Input = any, Output = any> {
2702
- readonly id: string;
2703
- readonly name?: string;
2704
- readonly description?: string;
2705
- private config;
2706
- private steps;
2707
- private hasStartStep;
2708
- private hasFinishStep;
2709
- private emitter;
2710
- /**
2711
- * Construtor compatível com assinatura antiga (string) e nova (config)
2712
- */
2713
- constructor(idOrConfig: string | WorkflowConfig<Input, Output>);
2714
- /**
2715
- * start() - obrigatório se inputSchema existir
2716
- */
2717
- start<T = Input>(handler: StepHandler<Input, T>): Workflow<Input, Output>;
2718
- /**
2719
- * step() - step linear
2720
- */
2721
- step<StepInput, StepOutput>(name: string, handler: StepHandler<StepInput, StepOutput>): Workflow<Input, Output>;
2722
- then<StepInput, StepOutput>(name: string, handler: StepHandler<StepInput, StepOutput>): Workflow<Input, Output>;
2723
- /**
2724
- * branch() - retorna chave do branch
2725
- */
2726
- branch<StepInput>(name: string, handler: StepHandler<StepInput, string>, branches: Record<string, (wf: Workflow<StepInput, any>) => void>): Workflow<Input, Output>;
2727
- /**
2728
- * parallel() - executa workflows em paralelo
2729
- */
2730
- parallel<StepInput>(name: string, workflows: ((wf: Workflow<StepInput, any>) => void)[]): Workflow<Input, Output>;
2731
- /**
2732
- * finish() - obrigatório se outputSchema existir
2733
- */
2734
- finish(handler: StepHandler<any, Output>): Workflow<Input, Output>;
2735
- on<E extends WorkflowEventName>(event: E, listener: (data: WorkflowEventMap[E]) => void): this;
2736
- once<E extends WorkflowEventName>(event: E, listener: (data: WorkflowEventMap[E]) => void): this;
2737
- off<E extends WorkflowEventName>(event: E, listener: (data: WorkflowEventMap[E]) => void): this;
2738
- private emit;
2739
- /**
2740
- * Execução síncrona
2741
- */
2742
- run(input: Input, options?: {
2743
- executionId?: string;
2744
- }): Promise<Output>;
2745
- private executeStepWithRetry;
2746
- private saveState;
2747
- /**
2748
- * Enfileira execução assíncrona (requer queueAdapter)
2749
- */
2750
- enqueue(input: Input): Promise<{
2751
- executionId: string;
2752
- }>;
2753
- /**
2754
- * Consulta status (requer queueAdapter ou stateStore)
2755
- */
2756
- getStatus(executionId: string): Promise<{
2757
- status: WorkflowState['status'];
2758
- currentStep?: string;
2759
- progress?: number;
2760
- }>;
2761
- }
2762
-
2763
- /**
2764
- * WorkflowLogger binds to Workflow events and formats them for logging
2765
- *
2766
- * This class is responsible for:
2767
- * - Listening to workflow lifecycle events
2768
- * - Formatting event data into structured logs
2769
- * - Delegating actual logging to an ILogger implementation
2770
- */
2771
- declare class WorkflowLogger {
2772
- private workflow;
2773
- private logger;
2774
- constructor(workflow: Workflow, logger: ILogger);
2775
- private bindEvents;
2776
- }
2777
-
2778
- type LogLevel = "debug" | "info" | "warn" | "error" | "none";
2779
-
2780
- /**
2781
- * Logger interface
2782
- * All loggers must implement these methods
2783
- */
2784
- interface ILogger {
2785
- debug(message: string, meta?: any, entityName?: string, entityType?: "agent" | "workflow", trace?: TraceContext): void;
2786
- info(message: string, meta?: any, entityName?: string, entityType?: "agent" | "workflow", trace?: TraceContext): void;
2787
- warn(message: string, meta?: any, entityName?: string, entityType?: "agent" | "workflow", trace?: TraceContext): void;
2788
- error(message: string, error?: any, entityName?: string, entityType?: "agent" | "workflow", trace?: TraceContext): void;
2789
- }
2790
- /**
2791
- * Console-based logger implementation
2792
- * Formats logs with colors, tree structure, and proper timestamps
2793
- */
2794
- declare class ConsoleLogger implements ILogger {
2795
- private minLevel;
2796
- constructor(minLevel?: LogLevel);
2797
- private shouldLog;
2798
- debug(message: string, meta?: any, entityName?: string, entityType?: "agent" | "workflow", trace?: TraceContext): void;
2799
- info(message: string, meta?: any, entityName?: string, entityType?: "agent" | "workflow", trace?: TraceContext): void;
2800
- warn(message: string, meta?: any, entityName?: string, entityType?: "agent" | "workflow", trace?: TraceContext): void;
2801
- error(message: string, error?: any, entityName?: string, entityType?: "agent" | "workflow", trace?: TraceContext): void;
2802
- }
2803
-
2804
- interface IInstruction {
2805
- resolve(): Promise<string>;
2806
- }
2807
- type AgentInstruction = string | IInstruction;
2808
- interface AgentRequestContext {
2809
- messages: Message[];
2810
- tools: Tool[];
2811
- }
2812
- type RequestInterceptor = (context: AgentRequestContext) => Promise<AgentRequestContext>;
2813
- type ResponseInterceptor = (response: ProviderResponse) => Promise<ProviderResponse>;
2814
- type AgentConfig = {
2815
- name: string;
2816
- model: IModel;
2817
- memory: IMemory;
2818
- instructions: AgentInstruction;
2819
- tools?: Tool[];
2820
- maxSteps?: number;
2821
- piiMasker?: IPIIMasker;
2822
- interceptors?: {
2823
- request?: RequestInterceptor[];
2824
- response?: ResponseInterceptor[];
2825
- };
2826
- logger?: ILogger;
2827
- logLevel?: LogLevel;
2828
- };
2829
- type AgentExecuteOptions = {
2830
- responseFormat?: {
2831
- type: "json";
2832
- schema?: Record<string, any>;
2833
- };
2834
- maxSteps?: number;
2835
- disableTools?: boolean;
2836
- };
2837
- type AgentResult = {
2838
- content: any;
2839
- toolExecutions: ToolExecution[];
2840
- toolCalls?: ToolCall[];
2841
- llmCalls: number;
2842
- totalDurationMs: number;
2843
- truncated: boolean;
2844
- };
2845
- type AgentStreamChunk = StreamChunk | {
2846
- type: "tool_result";
2847
- toolCallId: string;
2848
- result: any;
2849
- } | {
2850
- type: "error";
2851
- error: any;
2852
- };
2853
- declare class Agent extends BaseAgent {
2854
- config: AgentConfig;
2855
- private resolvedInstructions?;
2856
- private requestInterceptors;
2857
- private responseInterceptors;
2858
- private loggerAdapter;
2859
- constructor(config: AgentConfig);
2860
- private resolveInstructions;
2861
- private isInstruction;
2862
- clearInstructionsCache(): void;
2863
- addMessage(message: Message): Promise<void>;
2864
- private getMessages;
2865
- execute(options?: AgentExecuteOptions): Promise<AgentResult>;
2866
- execute(input?: string, options?: AgentExecuteOptions): Promise<AgentResult>;
2867
- executeStream(options?: AgentExecuteOptions): AsyncGenerator<AgentStreamChunk>;
2868
- private executeToolCall;
2869
- private safeParseJson;
2870
- private finishResult;
2871
- }
2872
-
2873
- type AgentEventMap = {
2874
- "agent:execution:start": AgentExecutionStart;
2875
- "agent:execution:end": AgentExecutionEnd;
2876
- "agent:execution:error": AgentExecutionError;
2877
- "agent:llm:call": AgentLLMCall;
2878
- "agent:llm:response": AgentLLMResponse;
2879
- "agent:tool:call": AgentToolCall;
2880
- "agent:tool:result": AgentToolResult;
2881
- };
2882
- type AgentEventName = keyof AgentEventMap;
2883
-
2884
- declare abstract class BaseAgent {
2885
- readonly name: string;
2886
- private emitter;
2887
- protected piiMasker?: IPIIMasker;
2888
- protected memory?: IMemory;
2889
- constructor(name: string, piiMasker?: IPIIMasker, memory?: IMemory);
2890
- /**
2891
- * Executes the agent. All agent-like implementations (including multi-agent teams)
2892
- * must accept an optional input string and optional execution options.
2893
- */
2894
- abstract execute(input?: string, options?: AgentExecuteOptions): Promise<AgentResult>;
2895
- /**
2896
- * Adds a message to this agent's memory (if configured).
2897
- * Multi-agent teams MUST provide a memory implementation if they expect to be used
2898
- * through standardized execution surfaces (e.g., HTTP gateways).
2899
- */
2900
- addMessage(message: Message): Promise<void>;
2901
- /**
2902
- * Emits a typed event with automatic context injection (trace, timestamp).
2903
- *
2904
- * @param event The event name (e.g., 'agent:execution:start')
2905
- * @param payload The event payload containing 'data' and optional context like 'correlationId'
2906
- */
2907
- protected emit<K extends AgentEventName>(event: K, payload: {
2908
- data: AgentEventMap[K]["data"];
2909
- correlationId?: string;
2910
- runId?: string;
2911
- }): boolean;
2912
- on<K extends AgentEventName>(event: K, listener: (data: AgentEventMap[K]) => void): this;
2913
- once<K extends AgentEventName>(event: K, listener: (data: AgentEventMap[K]) => void): this;
2914
- off<K extends AgentEventName>(event: K, listener: (data: AgentEventMap[K]) => void): this;
2915
- /**
2916
- * Recursively masks PII in the event payload
2917
- */
2918
- private maskEventData;
2919
- }
2920
-
2921
- type EvaluationResult = {
2922
- score: number;
2923
- passed: boolean;
2924
- reason?: string;
2925
- metadata?: Record<string, any>;
2926
- };
2927
- interface IScorer {
2928
- name: string;
2929
- evaluate(input: string, output: string, expected?: string): Promise<EvaluationResult>;
2930
- }
2931
- /**
2932
- * Exemplo simples de Scorer: Valida se o output contém certas palavras-chave
2933
- */
2934
- declare class KeywordScorer implements IScorer {
2935
- private keywords;
2936
- name: string;
2937
- constructor(keywords: string[]);
2938
- evaluate(input: string, output: string): Promise<EvaluationResult>;
2939
- }
2940
-
2941
- type SchemaDefinition = Record<string, string | z.ZodTypeAny>;
2942
- declare function schemaToZod(shape: SchemaDefinition): z.ZodObject<any, "strip", z.ZodTypeAny, {
2943
- [x: string]: any;
2944
- }, {
2945
- [x: string]: any;
2946
- }>;
2947
-
2948
- interface TracingContext {
2949
- traceId: string;
2950
- spanId: string;
2951
- parentId?: string;
2952
- }
2953
- interface SpanStartInput<K extends TelemetrySpanKind = TelemetrySpanKind> {
2954
- kind: K;
2955
- name: string;
2956
- data?: Record<string, unknown>;
2957
- correlationId?: string;
2958
- runId?: string;
2959
- }
2960
- interface SpanEndInput<K extends TelemetrySpanKind = TelemetrySpanKind> {
2961
- status: TelemetrySpanStatus;
2962
- data?: Record<string, unknown>;
2963
- }
2964
- declare class ActiveSpan<K extends TelemetrySpanKind = TelemetrySpanKind> {
2965
- readonly traceId: string;
2966
- readonly spanId: string;
2967
- readonly parentSpanId: string | undefined;
2968
- readonly kind: K;
2969
- readonly name: string;
2970
- private readonly correlationId;
2971
- private readonly runId;
2972
- private readonly exporter;
2973
- private ended;
2974
- constructor(traceId: string, spanId: string, parentSpanId: string | undefined, kind: K, name: string, correlationId: string | undefined, runId: string | undefined, exporter: ITelemetryExporter);
2975
- end(input: SpanEndInput<K>): Promise<void>;
2976
- get isEnded(): boolean;
2977
- }
2978
- declare class Tracing {
2979
- private static exporter;
2980
- static setExporter(exporter: ITelemetryExporter): void;
2981
- /**
2982
- * Gets the current trace context.
2983
- * Returns undefined if called outside of a traced execution.
2984
- */
2985
- static getContext(): TracingContext | undefined;
2986
- /**
2987
- * Gets the current trace context or creates a dummy one if none exists.
2988
- * Useful for logging where you always want *some* ID.
2989
- */
2990
- static getContextOrDummy(): TracingContext;
2991
- /**
2992
- * Runs a function inside a new telemetry span and exports span lifecycle events.
2993
- */
2994
- static withSpan<T, K extends TelemetrySpanKind>(input: SpanStartInput<K>, fn: (span: ActiveSpan<K>) => Promise<T>): Promise<T>;
2995
- }
2996
-
2997
- /**
2998
- * Additional prompt used to steer coordination/selection/transfer,
2999
- * not to rewrite the underlying agent instructions.
3000
- */
3001
- type AdditionalPrompt = string;
3002
- /**
3003
- * Memory configuration for delegation (AgentAsTool).
3004
- */
3005
- type DelegationMemoryConfig = {
3006
- type: "shared";
3007
- } | {
3008
- type: "isolated";
3009
- } | {
3010
- type: "custom";
3011
- memory: IMemory;
3012
- };
3013
- /**
3014
- * Edge definition for handoff graphs.
3015
- */
3016
- type HandoffEdge = {
3017
- from: Agent;
3018
- to: Agent;
3019
- toolId: string;
3020
- description?: string;
3021
- };
3022
- /**
3023
- * RouterTeam configuration.
3024
- */
3025
- type RouterTeamConfig = {
3026
- name: string;
3027
- model: IModel;
3028
- children: Agent[];
3029
- fallback?: Agent;
3030
- memory?: IMemory;
3031
- additionalPrompt?: AdditionalPrompt;
3032
- maxRetries?: number;
3033
- timeoutMs?: number;
3034
- };
3035
- /**
3036
- * HandoffTeam configuration.
3037
- */
3038
- type HandoffTeamConfig = {
3039
- name: string;
3040
- agents: Agent[];
3041
- edges: HandoffEdge[];
3042
- initialAgent: Agent;
3043
- memory?: IMemory;
3044
- additionalPrompt?: AdditionalPrompt;
3045
- maxTransfers?: number;
3046
- timeoutMs?: number;
3047
- tokenBudget?: number;
3048
- allowedTransitions?: Record<string, string[]>;
3049
- onTransfer?: (from: Agent, to: Agent) => void | Promise<void>;
3050
- };
3051
- /**
3052
- * AgentAsTool configuration.
3053
- */
3054
- type AgentAsToolConfig = {
3055
- agent: Agent;
3056
- id?: string;
3057
- description?: string;
3058
- additionalPrompt?: AdditionalPrompt;
3059
- memory?: DelegationMemoryConfig;
3060
- inputSchema?: z.ZodSchema;
3061
- };
3062
- /**
3063
- * Aggregation strategies for committee-like behavior.
3064
- */
3065
- type AggregationStrategy = "vote" | "summarize" | "confidence" | "first";
3066
- /**
3067
- * HierarchicalTeam configuration.
3068
- */
3069
- type HierarchicalTeamConfig = {
3070
- name: string;
3071
- manager: Agent;
3072
- workers: Agent[];
3073
- memory?: IMemory;
3074
- additionalPrompt?: AdditionalPrompt;
3075
- allowHandoff?: boolean;
3076
- workerCollaboration?: boolean;
3077
- };
3078
- /**
3079
- * PipelineTeam configuration.
3080
- */
3081
- type PipelineTeamConfig = {
3082
- name: string;
3083
- stages: Agent[];
3084
- memory?: IMemory;
3085
- additionalPrompt?: AdditionalPrompt;
3086
- };
3087
- /**
3088
- * CommitteeTeam configuration.
3089
- */
3090
- type CommitteeTeamConfig = {
3091
- name: string;
3092
- coordinator: Agent;
3093
- members: Agent[];
3094
- strategy: AggregationStrategy;
3095
- memory?: IMemory;
3096
- additionalPrompt?: AdditionalPrompt;
3097
- parallel?: boolean;
3098
- };
3099
- declare const delegationMemorySchema: z.ZodUnion<[z.ZodObject<{
3100
- type: z.ZodLiteral<"shared">;
3101
- }, "strip", z.ZodTypeAny, {
3102
- type: "shared";
3103
- }, {
3104
- type: "shared";
3105
- }>, z.ZodObject<{
3106
- type: z.ZodLiteral<"isolated">;
3107
- }, "strip", z.ZodTypeAny, {
3108
- type: "isolated";
3109
- }, {
3110
- type: "isolated";
3111
- }>, z.ZodObject<{
3112
- type: z.ZodLiteral<"custom">;
3113
- memory: z.ZodAny;
3114
- }, "strip", z.ZodTypeAny, {
3115
- type: "custom";
3116
- memory?: any;
3117
- }, {
3118
- type: "custom";
3119
- memory?: any;
3120
- }>]>;
3121
- declare const handoffEdgeSchema: z.ZodObject<{
3122
- from: z.ZodAny;
3123
- to: z.ZodAny;
3124
- toolId: z.ZodString;
3125
- description: z.ZodOptional<z.ZodString>;
3126
- }, "strip", z.ZodTypeAny, {
3127
- toolId: string;
3128
- description?: string | undefined;
3129
- from?: any;
3130
- to?: any;
3131
- }, {
3132
- toolId: string;
3133
- description?: string | undefined;
3134
- from?: any;
3135
- to?: any;
3136
- }>;
3137
- declare const routerTeamConfigSchema: z.ZodObject<{
3138
- model: z.ZodAny;
3139
- children: z.ZodArray<z.ZodAny, "many">;
3140
- fallback: z.ZodOptional<z.ZodAny>;
3141
- memory: z.ZodOptional<z.ZodAny>;
3142
- additionalPrompt: z.ZodOptional<z.ZodString>;
3143
- maxRetries: z.ZodOptional<z.ZodNumber>;
3144
- timeoutMs: z.ZodOptional<z.ZodNumber>;
3145
- }, "strip", z.ZodTypeAny, {
3146
- children: any[];
3147
- model?: any;
3148
- memory?: any;
3149
- fallback?: any;
3150
- additionalPrompt?: string | undefined;
3151
- maxRetries?: number | undefined;
3152
- timeoutMs?: number | undefined;
3153
- }, {
3154
- children: any[];
3155
- model?: any;
3156
- memory?: any;
3157
- fallback?: any;
3158
- additionalPrompt?: string | undefined;
3159
- maxRetries?: number | undefined;
3160
- timeoutMs?: number | undefined;
3161
- }>;
3162
- declare const handoffTeamConfigSchema: z.ZodObject<{
3163
- agents: z.ZodArray<z.ZodAny, "many">;
3164
- edges: z.ZodArray<z.ZodObject<{
3165
- from: z.ZodAny;
3166
- to: z.ZodAny;
3167
- toolId: z.ZodString;
3168
- description: z.ZodOptional<z.ZodString>;
3169
- }, "strip", z.ZodTypeAny, {
3170
- toolId: string;
3171
- description?: string | undefined;
3172
- from?: any;
3173
- to?: any;
3174
- }, {
3175
- toolId: string;
3176
- description?: string | undefined;
3177
- from?: any;
3178
- to?: any;
3179
- }>, "many">;
3180
- initialAgent: z.ZodAny;
3181
- memory: z.ZodOptional<z.ZodAny>;
3182
- additionalPrompt: z.ZodOptional<z.ZodString>;
3183
- maxTransfers: z.ZodOptional<z.ZodNumber>;
3184
- timeoutMs: z.ZodOptional<z.ZodNumber>;
3185
- tokenBudget: z.ZodOptional<z.ZodNumber>;
3186
- allowedTransitions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString, "many">>>;
3187
- onTransfer: z.ZodOptional<z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>>;
3188
- }, "strip", z.ZodTypeAny, {
3189
- agents: any[];
3190
- edges: {
3191
- toolId: string;
3192
- description?: string | undefined;
3193
- from?: any;
3194
- to?: any;
3195
- }[];
3196
- memory?: any;
3197
- additionalPrompt?: string | undefined;
3198
- timeoutMs?: number | undefined;
3199
- initialAgent?: any;
3200
- maxTransfers?: number | undefined;
3201
- tokenBudget?: number | undefined;
3202
- allowedTransitions?: Record<string, string[]> | undefined;
3203
- onTransfer?: ((...args: unknown[]) => unknown) | undefined;
3204
- }, {
3205
- agents: any[];
3206
- edges: {
3207
- toolId: string;
3208
- description?: string | undefined;
3209
- from?: any;
3210
- to?: any;
3211
- }[];
3212
- memory?: any;
3213
- additionalPrompt?: string | undefined;
3214
- timeoutMs?: number | undefined;
3215
- initialAgent?: any;
3216
- maxTransfers?: number | undefined;
3217
- tokenBudget?: number | undefined;
3218
- allowedTransitions?: Record<string, string[]> | undefined;
3219
- onTransfer?: ((...args: unknown[]) => unknown) | undefined;
3220
- }>;
3221
- declare const agentAsToolConfigSchema: z.ZodObject<{
3222
- agent: z.ZodAny;
3223
- id: z.ZodOptional<z.ZodString>;
3224
- description: z.ZodOptional<z.ZodString>;
3225
- additionalPrompt: z.ZodOptional<z.ZodString>;
3226
- memory: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
3227
- type: z.ZodLiteral<"shared">;
3228
- }, "strip", z.ZodTypeAny, {
3229
- type: "shared";
3230
- }, {
3231
- type: "shared";
3232
- }>, z.ZodObject<{
3233
- type: z.ZodLiteral<"isolated">;
3234
- }, "strip", z.ZodTypeAny, {
3235
- type: "isolated";
3236
- }, {
3237
- type: "isolated";
3238
- }>, z.ZodObject<{
3239
- type: z.ZodLiteral<"custom">;
3240
- memory: z.ZodAny;
3241
- }, "strip", z.ZodTypeAny, {
3242
- type: "custom";
3243
- memory?: any;
3244
- }, {
3245
- type: "custom";
3246
- memory?: any;
3247
- }>]>>;
3248
- inputSchema: z.ZodOptional<z.ZodType<z.ZodType<any, z.ZodTypeDef, any>, z.ZodTypeDef, z.ZodType<any, z.ZodTypeDef, any>>>;
3249
- }, "strip", z.ZodTypeAny, {
3250
- agent?: any;
3251
- id?: string | undefined;
3252
- description?: string | undefined;
3253
- inputSchema?: z.ZodType<any, z.ZodTypeDef, any> | undefined;
3254
- memory?: {
3255
- type: "shared";
3256
- } | {
3257
- type: "isolated";
3258
- } | {
3259
- type: "custom";
3260
- memory?: any;
3261
- } | undefined;
3262
- additionalPrompt?: string | undefined;
3263
- }, {
3264
- agent?: any;
3265
- id?: string | undefined;
3266
- description?: string | undefined;
3267
- inputSchema?: z.ZodType<any, z.ZodTypeDef, any> | undefined;
3268
- memory?: {
3269
- type: "shared";
3270
- } | {
3271
- type: "isolated";
3272
- } | {
3273
- type: "custom";
3274
- memory?: any;
3275
- } | undefined;
3276
- additionalPrompt?: string | undefined;
3277
- }>;
3278
- declare const hierarchicalTeamConfigSchema: z.ZodObject<{
3279
- manager: z.ZodAny;
3280
- workers: z.ZodArray<z.ZodAny, "many">;
3281
- memory: z.ZodOptional<z.ZodAny>;
3282
- additionalPrompt: z.ZodOptional<z.ZodString>;
3283
- allowHandoff: z.ZodOptional<z.ZodBoolean>;
3284
- workerCollaboration: z.ZodOptional<z.ZodBoolean>;
3285
- }, "strip", z.ZodTypeAny, {
3286
- workers: any[];
3287
- memory?: any;
3288
- additionalPrompt?: string | undefined;
3289
- manager?: any;
3290
- allowHandoff?: boolean | undefined;
3291
- workerCollaboration?: boolean | undefined;
3292
- }, {
3293
- workers: any[];
3294
- memory?: any;
3295
- additionalPrompt?: string | undefined;
3296
- manager?: any;
3297
- allowHandoff?: boolean | undefined;
3298
- workerCollaboration?: boolean | undefined;
3299
- }>;
3300
- declare const pipelineTeamConfigSchema: z.ZodObject<{
3301
- stages: z.ZodArray<z.ZodAny, "many">;
3302
- memory: z.ZodOptional<z.ZodAny>;
3303
- additionalPrompt: z.ZodOptional<z.ZodString>;
3304
- }, "strip", z.ZodTypeAny, {
3305
- stages: any[];
3306
- memory?: any;
3307
- additionalPrompt?: string | undefined;
3308
- }, {
3309
- stages: any[];
3310
- memory?: any;
3311
- additionalPrompt?: string | undefined;
3312
- }>;
3313
- declare const committeeTeamConfigSchema: z.ZodObject<{
3314
- coordinator: z.ZodAny;
3315
- members: z.ZodArray<z.ZodAny, "many">;
3316
- strategy: z.ZodEnum<["vote", "summarize", "confidence", "first"]>;
3317
- memory: z.ZodOptional<z.ZodAny>;
3318
- additionalPrompt: z.ZodOptional<z.ZodString>;
3319
- parallel: z.ZodOptional<z.ZodBoolean>;
3320
- }, "strip", z.ZodTypeAny, {
3321
- members: any[];
3322
- strategy: "vote" | "summarize" | "confidence" | "first";
3323
- parallel?: boolean | undefined;
3324
- memory?: any;
3325
- additionalPrompt?: string | undefined;
3326
- coordinator?: any;
3327
- }, {
3328
- members: any[];
3329
- strategy: "vote" | "summarize" | "confidence" | "first";
3330
- parallel?: boolean | undefined;
3331
- memory?: any;
3332
- additionalPrompt?: string | undefined;
3333
- coordinator?: any;
3334
- }>;
3335
- declare const aggregationStrategySchema: z.ZodEnum<["vote", "summarize", "confidence", "first"]>;
3336
-
3337
- declare class AgentAsTool extends Tool {
3338
- private callingMemory?;
3339
- private readonly target;
3340
- private readonly memoryConfig?;
3341
- private readonly extraPrompt?;
3342
- constructor(config: AgentAsToolConfig);
3343
- /**
3344
- * Allows orchestrators to set the calling agent/team memory when using
3345
- * `memory: { type: "shared" }`.
3346
- */
3347
- setCallingMemory(memory?: IMemory): void;
3348
- private runDelegated;
3349
- }
3350
-
3351
- declare class RouterTeam extends BaseAgent {
3352
- private readonly config;
3353
- constructor(config: RouterTeamConfig);
3354
- /**
3355
- * Execute routing: choose an agent via model classification, then delegate execution.
3356
- */
3357
- execute(input?: string, _options?: AgentExecuteOptions): Promise<AgentResult>;
3358
- private selectAgent;
3359
- private extractAgentName;
3360
- }
3361
-
3362
- declare class HandoffTeam extends BaseAgent {
3363
- private readonly config;
3364
- private readonly edgeMap;
3365
- private readonly agentByName;
3366
- constructor(config: HandoffTeamConfig);
3367
- execute(input?: string, _options?: AgentExecuteOptions): Promise<AgentResult>;
3368
- private buildEdgeMap;
3369
- private attachHandoffTools;
3370
- private findHandoffSignal;
3371
- }
3372
-
3373
- declare class HierarchicalTeam extends BaseAgent {
3374
- private readonly config;
3375
- private readonly manager;
3376
- private readonly workers;
3377
- private readonly teamMemory?;
3378
- private readonly allowHandoff;
3379
- private readonly workerCollaboration;
3380
- constructor(config: HierarchicalTeamConfig);
3381
- execute(input?: string, _options?: AgentExecuteOptions): Promise<AgentResult>;
3382
- private executeDelegationOnly;
3383
- private executeWithHandoff;
3384
- private buildWorkerTools;
3385
- }
3386
-
3387
- declare class PipelineTeam extends BaseAgent {
3388
- private readonly config;
3389
- private readonly stages;
3390
- private readonly teamMemory?;
3391
- constructor(config: PipelineTeamConfig);
3392
- execute(input?: string, _options?: AgentExecuteOptions): Promise<AgentResult>;
3393
- private buildEdges;
3394
- }
3395
-
3396
- declare class CommitteeTeam extends BaseAgent {
3397
- private readonly config;
3398
- private readonly coordinator;
3399
- private readonly members;
3400
- private readonly strategy;
3401
- private readonly teamMemory?;
3402
- constructor(config: CommitteeTeamConfig);
3403
- execute(input?: string, _options?: AgentExecuteOptions): Promise<AgentResult>;
3404
- private collectOpinions;
3405
- private aggregate;
3406
- private buildResult;
3407
- }
3408
-
3409
- declare class GuardrailError extends Error {
3410
- constructor(message: string);
3411
- }
3412
- declare function enforceMaxTransfers(current: number, max?: number): void;
3413
- declare function enforceAllowedTransition(from: string, to: string, allowed?: Record<string, string[]>): void;
3414
- declare function enforceTimeout<T>(promise: Promise<T>, timeoutMs?: number, label?: string): Promise<T>;
3415
-
3416
- declare function overrideAgentMemory(agent: Agent, memory?: IMemory): () => void;
3417
- declare function resolveDelegationMemory(agent: Agent, config?: DelegationMemoryConfig, callingMemory?: IMemory): Promise<{
3418
- memory: IMemory;
3419
- restore: () => void;
3420
- }>;
3421
-
3422
- declare function buildRouterSystemPrompt(agents: Agent[], additionalPrompt?: AdditionalPrompt): string;
3423
- declare function buildHandoffSystemPrompt(additionalPrompt?: AdditionalPrompt): string;
3424
-
3425
- export { ActiveSpan, type AdditionalPrompt, Agent, AgentAsTool, type AgentAsToolConfig, type AgentAsToolConfig as AgentAsToolConfigType, type AgentConfig, type AgentEventMap, type AgentEventName, type AgentExecuteOptions, type AgentExecutionEnd, AgentExecutionEndSchema, type AgentExecutionError, AgentExecutionErrorSchema, type AgentExecutionStart, AgentExecutionStartSchema, type AgentInstruction, type AgentLLMCall, AgentLLMCallSchema, type AgentLLMResponse, AgentLLMResponseSchema, AgentLogger, type AgentRequestContext, type AgentResult, type AgentStreamChunk, type AgentToolCall, AgentToolCallSchema, type AgentToolResult, AgentToolResultSchema, type AggregationStrategy, BaseAgent, COLORS, CommitteeTeam, type CommitteeTeamConfig, type CommitteeTeamConfig as CommitteeTeamConfigType, ConsoleLogger, type ContentPart, type DelegationMemoryConfig, ErrorSchema, type EvaluationResult, EventCommonSchema, type GenerateOptions, GuardrailError, type HandoffEdge, HandoffTeam, type HandoffTeamConfig, type HandoffTeamConfig as HandoffTeamConfigType, HierarchicalTeam, type HierarchicalTeamConfig, type HierarchicalTeamConfig as HierarchicalTeamConfigType, type IInstruction, type ILogger, type IMemory, type IModel, type IPIIMasker, type IScorer, type IWorkflowQueue, type IWorkflowStateStore, InMemory, KeywordScorer, LOG_LEVEL_COLORS, type LogLevel, type Message, ModelSchema, type NebulaEvent, NebulaEventSchema, PipelineTeam, type PipelineTeamConfig, type PipelineTeamConfig as PipelineTeamConfigType, type ProviderResponse, RegexPIIMasker, type RequestInterceptor, type ResponseFormat, type ResponseInterceptor, type RetryPolicy, type Role, RouterTeam, type RouterTeamConfig, type RouterTeamConfig as RouterTeamConfigType, type SchemaDefinition, type SpanEndInput, type SpanStartInput, type StepContext, type StepDefinition, type StepHandler, type StreamChunk, TREE_CHARS, type TokenUsage, Tool, type ToolCall, type ToolConfig, type ToolDefinitionForLLM, type ToolExecution, type TraceContext, TraceContextSchema, Tracing, type TracingContext, type Usage, UsageSchema, Workflow, type WorkflowConfig, type WorkflowEventMap, type WorkflowEventName, type WorkflowExecutionEnd, WorkflowExecutionEndSchema, type WorkflowExecutionError, WorkflowExecutionErrorSchema, type WorkflowExecutionStart, WorkflowExecutionStartSchema, type WorkflowJob, WorkflowLogger, type WorkflowState, type WorkflowStep, WorkflowStepSchema, type WorkflowStreamChunk, agentAsToolConfigSchema, aggregationStrategySchema, buildHandoffSystemPrompt, buildRouterSystemPrompt, calculateRetryDelay, committeeTeamConfigSchema, delegationMemorySchema, enforceAllowedTransition, enforceMaxTransfers, enforceTimeout, formatError, formatLogLine, formatMetadata, handoffEdgeSchema, handoffTeamConfigSchema, hierarchicalTeamConfigSchema, isRetryableError, overrideAgentMemory, pipelineTeamConfigSchema, resolveDelegationMemory, routerTeamConfigSchema, schemaToZod };