@mastra/observability 0.0.0-trace-timeline-update-20251121114225 → 0.0.0-type-testing-20260120105120
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/CHANGELOG.md +840 -11
- package/README.md +34 -79
- package/dist/config.d.ts +216 -6
- package/dist/config.d.ts.map +1 -1
- package/dist/default.d.ts.map +1 -1
- package/dist/exporters/base.d.ts +55 -5
- package/dist/exporters/base.d.ts.map +1 -1
- package/dist/exporters/cloud.d.ts +8 -2
- package/dist/exporters/cloud.d.ts.map +1 -1
- package/dist/exporters/default.d.ts +12 -5
- package/dist/exporters/default.d.ts.map +1 -1
- package/dist/exporters/index.d.ts +4 -2
- package/dist/exporters/index.d.ts.map +1 -1
- package/dist/exporters/span-formatters.d.ts +35 -0
- package/dist/exporters/span-formatters.d.ts.map +1 -0
- package/dist/exporters/test.d.ts +13 -0
- package/dist/exporters/test.d.ts.map +1 -0
- package/dist/exporters/tracking.d.ts +470 -0
- package/dist/exporters/tracking.d.ts.map +1 -0
- package/dist/index.cjs +5947 -271
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5937 -272
- package/dist/index.js.map +1 -1
- package/dist/instances/base.d.ts +41 -5
- package/dist/instances/base.d.ts.map +1 -1
- package/dist/model-tracing.d.ts +16 -9
- package/dist/model-tracing.d.ts.map +1 -1
- package/dist/span_processors/sensitive-data-filter.d.ts +7 -0
- package/dist/span_processors/sensitive-data-filter.d.ts.map +1 -1
- package/dist/spans/base.d.ts +49 -18
- package/dist/spans/base.d.ts.map +1 -1
- package/dist/spans/default.d.ts.map +1 -1
- package/dist/spans/index.d.ts +1 -0
- package/dist/spans/index.d.ts.map +1 -1
- package/dist/spans/serialization.d.ts +46 -0
- package/dist/spans/serialization.d.ts.map +1 -0
- package/dist/tracing-options.d.ts +27 -0
- package/dist/tracing-options.d.ts.map +1 -0
- package/dist/usage.d.ts +21 -0
- package/dist/usage.d.ts.map +1 -0
- package/package.json +10 -11
package/README.md
CHANGED
|
@@ -1,99 +1,54 @@
|
|
|
1
1
|
# Mastra Observability
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Tracing and monitoring for AI operations in Mastra.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Installation
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
## Key Features
|
|
10
|
-
|
|
11
|
-
- **Type-Safe Spans**: Strongly typed metadata based on span type prevents runtime errors
|
|
12
|
-
- **Event-Driven Architecture**: Real-time tracing events for immediate observability
|
|
13
|
-
- **OpenTelemetry Compatible**: Uses standard trace and span ID formats for integration
|
|
14
|
-
- **Flexible Sampling**: Multiple sampling strategies with custom sampler support
|
|
15
|
-
- **Pluggable Processors**: Modify or filter span fields before export
|
|
16
|
-
- **Pluggable Exporters**: Multiple export formats and destinations
|
|
17
|
-
- **Automatic Lifecycle Management**: Spans automatically emit events without manual intervention
|
|
18
|
-
|
|
19
|
-
## Quick Start
|
|
20
|
-
|
|
21
|
-
### Manual Tracing
|
|
22
|
-
|
|
23
|
-
```typescript
|
|
24
|
-
import { DefaultObservabilityInstance, SpanType } from '@mastra/observability';
|
|
25
|
-
|
|
26
|
-
// Create observability instance
|
|
27
|
-
const observability = new DefaultObservabilityInstance({
|
|
28
|
-
name: 'my-app',
|
|
29
|
-
serviceName: 'my-app',
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
// Start an agent span
|
|
33
|
-
const agentSpan = observability.startSpan({
|
|
34
|
-
type: SpanType.AGENT_RUN,
|
|
35
|
-
name: 'customer-support-agent',
|
|
36
|
-
attributes: {
|
|
37
|
-
agentId: 'agent-123',
|
|
38
|
-
instructions: 'Help with customer support',
|
|
39
|
-
maxSteps: 10,
|
|
40
|
-
},
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
// Create child spans for nested operations
|
|
44
|
-
const llmSpan = agentSpan.createChildSpan({
|
|
45
|
-
type: SpanType.MODEL_GENERATION,
|
|
46
|
-
name: 'gpt-4-response',
|
|
47
|
-
attributes: {
|
|
48
|
-
model: 'gpt-4',
|
|
49
|
-
provider: 'openai',
|
|
50
|
-
streaming: false,
|
|
51
|
-
},
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
// End spans with results
|
|
55
|
-
llmSpan.end({
|
|
56
|
-
output: 'Generated response',
|
|
57
|
-
attributes: { usage: { totalTokens: 180 } },
|
|
58
|
-
});
|
|
59
|
-
agentSpan.end();
|
|
7
|
+
```bash
|
|
8
|
+
npm install @mastra/observability
|
|
60
9
|
```
|
|
61
10
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
- **`WORKFLOW_RUN`**: Root span for entire workflow execution
|
|
65
|
-
- **`WORKFLOW_STEP`**: Individual step execution within a workflow
|
|
66
|
-
- **`AGENT_RUN`**: Agent processing (supports tools, memory, multi-step)
|
|
67
|
-
- **`MODEL_GENERATION`**: Individual model API calls with token usage
|
|
68
|
-
- **`TOOL_CALL`**: Function/tool execution
|
|
69
|
-
- **`MCP_TOOL_CALL`**: Model Context Protocol tool execution
|
|
70
|
-
- **`PROCESSOR_RUN`**: Input/output processor execution
|
|
71
|
-
- **`GENERIC`**: Custom spans for other operations
|
|
72
|
-
|
|
73
|
-
### Basic Configuration
|
|
74
|
-
|
|
75
|
-
Enable observability in your Mastra instance:
|
|
11
|
+
## Quick Start
|
|
76
12
|
|
|
77
13
|
```typescript
|
|
78
14
|
import { Mastra } from '@mastra/core';
|
|
79
|
-
import { Observability } from '@mastra/observability';
|
|
15
|
+
import { Observability, DefaultExporter, CloudExporter, SensitiveDataFilter } from '@mastra/observability';
|
|
80
16
|
|
|
81
17
|
export const mastra = new Mastra({
|
|
82
|
-
// ... other config
|
|
83
18
|
observability: new Observability({
|
|
84
|
-
|
|
19
|
+
configs: {
|
|
20
|
+
default: {
|
|
21
|
+
serviceName: 'my-app',
|
|
22
|
+
exporters: [
|
|
23
|
+
new DefaultExporter(), // Persists traces for Mastra Studio
|
|
24
|
+
new CloudExporter(), // Sends to Mastra Cloud
|
|
25
|
+
],
|
|
26
|
+
spanOutputProcessors: [new SensitiveDataFilter()],
|
|
27
|
+
},
|
|
28
|
+
},
|
|
85
29
|
}),
|
|
86
30
|
});
|
|
87
31
|
```
|
|
88
32
|
|
|
89
|
-
|
|
33
|
+
## Features
|
|
34
|
+
|
|
35
|
+
- **Auto-instrumentation** - Traces agent runs, LLM calls, tool executions, and workflows
|
|
36
|
+
- **Pluggable Exporters** - Exporters for Studio and Cloud, plus integrations for Arize, Braintrust, Langfuse, LangSmith, and OpenTelemetry
|
|
37
|
+
- **Sampling Strategies** - Always, ratio-based, or custom sampling
|
|
38
|
+
- **Span Processors** - Transform or filter span data before export
|
|
39
|
+
- **OpenTelemetry Compatible** - Standard trace/span ID formats for integration
|
|
90
40
|
|
|
91
|
-
##
|
|
41
|
+
## Span Types
|
|
92
42
|
|
|
93
|
-
|
|
43
|
+
- `WORKFLOW_RUN` - Workflow execution
|
|
44
|
+
- `WORKFLOW_STEP` - Individual workflow step
|
|
45
|
+
- `AGENT_RUN` - Agent processing
|
|
46
|
+
- `MODEL_GENERATION` - LLM API calls
|
|
47
|
+
- `TOOL_CALL` - Tool execution
|
|
48
|
+
- `MCP_TOOL_CALL` - MCP tool execution
|
|
49
|
+
- `PROCESSOR_RUN` - Processor execution
|
|
50
|
+
- `GENERIC` - Custom operations
|
|
94
51
|
|
|
95
|
-
|
|
52
|
+
## Documentation
|
|
96
53
|
|
|
97
|
-
|
|
98
|
-
- **Real-time Export**: Events are exported immediately when they occur
|
|
99
|
-
- **Memory Overhead**: Each span maintains references to tracing instance
|
|
54
|
+
For configuration options, exporters, sampling strategies, and more, see the [full documentation](https://mastra.ai/docs/v1/observability/overview).
|
package/dist/config.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* including tracing configs, sampling strategies, and registry setup.
|
|
6
6
|
*/
|
|
7
7
|
import type { RequestContext } from '@mastra/core/di';
|
|
8
|
-
import type { ObservabilityInstance, ObservabilityExporter, SpanOutputProcessor, ConfigSelector } from '@mastra/core/observability';
|
|
8
|
+
import type { ObservabilityInstance, ObservabilityExporter, ObservabilityBridge, SpanOutputProcessor, ConfigSelector, SerializationOptions } from '@mastra/core/observability';
|
|
9
9
|
import { z } from 'zod';
|
|
10
10
|
/**
|
|
11
11
|
* Sampling strategy types
|
|
@@ -49,6 +49,8 @@ export interface ObservabilityInstanceConfig {
|
|
|
49
49
|
sampling?: SamplingStrategy;
|
|
50
50
|
/** Custom exporters */
|
|
51
51
|
exporters?: ObservabilityExporter[];
|
|
52
|
+
/** Observability bridge (e.g., OpenTelemetry bridge for context extraction) */
|
|
53
|
+
bridge?: ObservabilityBridge;
|
|
52
54
|
/** Custom span output processors */
|
|
53
55
|
spanOutputProcessors?: SpanOutputProcessor[];
|
|
54
56
|
/** Set to `true` if you want to see spans internal to the operation of mastra */
|
|
@@ -59,12 +61,21 @@ export interface ObservabilityInstanceConfig {
|
|
|
59
61
|
* Supports dot notation for nested values.
|
|
60
62
|
*/
|
|
61
63
|
requestContextKeys?: string[];
|
|
64
|
+
/**
|
|
65
|
+
* Options for controlling serialization of span data (input/output/attributes).
|
|
66
|
+
* Use these to customize truncation limits for large payloads.
|
|
67
|
+
*/
|
|
68
|
+
serializationOptions?: SerializationOptions;
|
|
62
69
|
}
|
|
63
70
|
/**
|
|
64
71
|
* Complete Observability registry configuration
|
|
65
72
|
*/
|
|
66
73
|
export interface ObservabilityRegistryConfig {
|
|
67
|
-
/**
|
|
74
|
+
/**
|
|
75
|
+
* Enables default exporters, with sampling: always, and sensitive data filtering
|
|
76
|
+
* @deprecated Use explicit `configs` with DefaultExporter, CloudExporter, and SensitiveDataFilter instead.
|
|
77
|
+
* This option will be removed in a future version.
|
|
78
|
+
*/
|
|
68
79
|
default?: {
|
|
69
80
|
enabled?: boolean;
|
|
70
81
|
};
|
|
@@ -107,12 +118,31 @@ export declare const samplingStrategySchema: z.ZodDiscriminatedUnion<"type", [z.
|
|
|
107
118
|
type: SamplingStrategyType.CUSTOM;
|
|
108
119
|
sampler: (args_0: any, ...args: unknown[]) => boolean;
|
|
109
120
|
}>]>;
|
|
121
|
+
/**
|
|
122
|
+
* Zod schema for SerializationOptions
|
|
123
|
+
*/
|
|
124
|
+
export declare const serializationOptionsSchema: z.ZodOptional<z.ZodObject<{
|
|
125
|
+
maxStringLength: z.ZodOptional<z.ZodNumber>;
|
|
126
|
+
maxDepth: z.ZodOptional<z.ZodNumber>;
|
|
127
|
+
maxArrayLength: z.ZodOptional<z.ZodNumber>;
|
|
128
|
+
maxObjectKeys: z.ZodOptional<z.ZodNumber>;
|
|
129
|
+
}, "strip", z.ZodTypeAny, {
|
|
130
|
+
maxStringLength?: number | undefined;
|
|
131
|
+
maxDepth?: number | undefined;
|
|
132
|
+
maxArrayLength?: number | undefined;
|
|
133
|
+
maxObjectKeys?: number | undefined;
|
|
134
|
+
}, {
|
|
135
|
+
maxStringLength?: number | undefined;
|
|
136
|
+
maxDepth?: number | undefined;
|
|
137
|
+
maxArrayLength?: number | undefined;
|
|
138
|
+
maxObjectKeys?: number | undefined;
|
|
139
|
+
}>>;
|
|
110
140
|
/**
|
|
111
141
|
* Zod schema for ObservabilityInstanceConfig
|
|
112
|
-
* Note: exporters, spanOutputProcessors, and configSelector are validated as any
|
|
142
|
+
* Note: exporters, spanOutputProcessors, bridge, and configSelector are validated as any
|
|
113
143
|
* since they're complex runtime objects
|
|
114
144
|
*/
|
|
115
|
-
export declare const observabilityInstanceConfigSchema: z.ZodObject<{
|
|
145
|
+
export declare const observabilityInstanceConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
116
146
|
name: z.ZodString;
|
|
117
147
|
serviceName: z.ZodString;
|
|
118
148
|
sampling: z.ZodOptional<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
@@ -147,9 +177,26 @@ export declare const observabilityInstanceConfigSchema: z.ZodObject<{
|
|
|
147
177
|
sampler: (args_0: any, ...args: unknown[]) => boolean;
|
|
148
178
|
}>]>>;
|
|
149
179
|
exporters: z.ZodOptional<z.ZodArray<z.ZodAny, "many">>;
|
|
180
|
+
bridge: z.ZodOptional<z.ZodAny>;
|
|
150
181
|
spanOutputProcessors: z.ZodOptional<z.ZodArray<z.ZodAny, "many">>;
|
|
151
182
|
includeInternalSpans: z.ZodOptional<z.ZodBoolean>;
|
|
152
183
|
requestContextKeys: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
184
|
+
serializationOptions: z.ZodOptional<z.ZodObject<{
|
|
185
|
+
maxStringLength: z.ZodOptional<z.ZodNumber>;
|
|
186
|
+
maxDepth: z.ZodOptional<z.ZodNumber>;
|
|
187
|
+
maxArrayLength: z.ZodOptional<z.ZodNumber>;
|
|
188
|
+
maxObjectKeys: z.ZodOptional<z.ZodNumber>;
|
|
189
|
+
}, "strip", z.ZodTypeAny, {
|
|
190
|
+
maxStringLength?: number | undefined;
|
|
191
|
+
maxDepth?: number | undefined;
|
|
192
|
+
maxArrayLength?: number | undefined;
|
|
193
|
+
maxObjectKeys?: number | undefined;
|
|
194
|
+
}, {
|
|
195
|
+
maxStringLength?: number | undefined;
|
|
196
|
+
maxDepth?: number | undefined;
|
|
197
|
+
maxArrayLength?: number | undefined;
|
|
198
|
+
maxObjectKeys?: number | undefined;
|
|
199
|
+
}>>;
|
|
153
200
|
}, "strip", z.ZodTypeAny, {
|
|
154
201
|
name: string;
|
|
155
202
|
serviceName: string;
|
|
@@ -165,9 +212,66 @@ export declare const observabilityInstanceConfigSchema: z.ZodObject<{
|
|
|
165
212
|
sampler: (args_0: any, ...args: unknown[]) => boolean;
|
|
166
213
|
} | undefined;
|
|
167
214
|
exporters?: any[] | undefined;
|
|
215
|
+
bridge?: any;
|
|
216
|
+
spanOutputProcessors?: any[] | undefined;
|
|
217
|
+
includeInternalSpans?: boolean | undefined;
|
|
218
|
+
requestContextKeys?: string[] | undefined;
|
|
219
|
+
serializationOptions?: {
|
|
220
|
+
maxStringLength?: number | undefined;
|
|
221
|
+
maxDepth?: number | undefined;
|
|
222
|
+
maxArrayLength?: number | undefined;
|
|
223
|
+
maxObjectKeys?: number | undefined;
|
|
224
|
+
} | undefined;
|
|
225
|
+
}, {
|
|
226
|
+
name: string;
|
|
227
|
+
serviceName: string;
|
|
228
|
+
sampling?: {
|
|
229
|
+
type: SamplingStrategyType.ALWAYS;
|
|
230
|
+
} | {
|
|
231
|
+
type: SamplingStrategyType.NEVER;
|
|
232
|
+
} | {
|
|
233
|
+
type: SamplingStrategyType.RATIO;
|
|
234
|
+
probability: number;
|
|
235
|
+
} | {
|
|
236
|
+
type: SamplingStrategyType.CUSTOM;
|
|
237
|
+
sampler: (args_0: any, ...args: unknown[]) => boolean;
|
|
238
|
+
} | undefined;
|
|
239
|
+
exporters?: any[] | undefined;
|
|
240
|
+
bridge?: any;
|
|
168
241
|
spanOutputProcessors?: any[] | undefined;
|
|
169
242
|
includeInternalSpans?: boolean | undefined;
|
|
170
243
|
requestContextKeys?: string[] | undefined;
|
|
244
|
+
serializationOptions?: {
|
|
245
|
+
maxStringLength?: number | undefined;
|
|
246
|
+
maxDepth?: number | undefined;
|
|
247
|
+
maxArrayLength?: number | undefined;
|
|
248
|
+
maxObjectKeys?: number | undefined;
|
|
249
|
+
} | undefined;
|
|
250
|
+
}>, {
|
|
251
|
+
name: string;
|
|
252
|
+
serviceName: string;
|
|
253
|
+
sampling?: {
|
|
254
|
+
type: SamplingStrategyType.ALWAYS;
|
|
255
|
+
} | {
|
|
256
|
+
type: SamplingStrategyType.NEVER;
|
|
257
|
+
} | {
|
|
258
|
+
type: SamplingStrategyType.RATIO;
|
|
259
|
+
probability: number;
|
|
260
|
+
} | {
|
|
261
|
+
type: SamplingStrategyType.CUSTOM;
|
|
262
|
+
sampler: (args_0: any, ...args: unknown[]) => boolean;
|
|
263
|
+
} | undefined;
|
|
264
|
+
exporters?: any[] | undefined;
|
|
265
|
+
bridge?: any;
|
|
266
|
+
spanOutputProcessors?: any[] | undefined;
|
|
267
|
+
includeInternalSpans?: boolean | undefined;
|
|
268
|
+
requestContextKeys?: string[] | undefined;
|
|
269
|
+
serializationOptions?: {
|
|
270
|
+
maxStringLength?: number | undefined;
|
|
271
|
+
maxDepth?: number | undefined;
|
|
272
|
+
maxArrayLength?: number | undefined;
|
|
273
|
+
maxObjectKeys?: number | undefined;
|
|
274
|
+
} | undefined;
|
|
171
275
|
}, {
|
|
172
276
|
name: string;
|
|
173
277
|
serviceName: string;
|
|
@@ -183,15 +287,22 @@ export declare const observabilityInstanceConfigSchema: z.ZodObject<{
|
|
|
183
287
|
sampler: (args_0: any, ...args: unknown[]) => boolean;
|
|
184
288
|
} | undefined;
|
|
185
289
|
exporters?: any[] | undefined;
|
|
290
|
+
bridge?: any;
|
|
186
291
|
spanOutputProcessors?: any[] | undefined;
|
|
187
292
|
includeInternalSpans?: boolean | undefined;
|
|
188
293
|
requestContextKeys?: string[] | undefined;
|
|
294
|
+
serializationOptions?: {
|
|
295
|
+
maxStringLength?: number | undefined;
|
|
296
|
+
maxDepth?: number | undefined;
|
|
297
|
+
maxArrayLength?: number | undefined;
|
|
298
|
+
maxObjectKeys?: number | undefined;
|
|
299
|
+
} | undefined;
|
|
189
300
|
}>;
|
|
190
301
|
/**
|
|
191
302
|
* Zod schema for config values in the configs map
|
|
192
303
|
* This is the config object without the name field
|
|
193
304
|
*/
|
|
194
|
-
export declare const observabilityConfigValueSchema: z.ZodObject<{
|
|
305
|
+
export declare const observabilityConfigValueSchema: z.ZodEffects<z.ZodObject<{
|
|
195
306
|
serviceName: z.ZodString;
|
|
196
307
|
sampling: z.ZodOptional<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
197
308
|
type: z.ZodLiteral<SamplingStrategyType.ALWAYS>;
|
|
@@ -225,9 +336,26 @@ export declare const observabilityConfigValueSchema: z.ZodObject<{
|
|
|
225
336
|
sampler: (args_0: any, ...args: unknown[]) => boolean;
|
|
226
337
|
}>]>>;
|
|
227
338
|
exporters: z.ZodOptional<z.ZodArray<z.ZodAny, "many">>;
|
|
339
|
+
bridge: z.ZodOptional<z.ZodAny>;
|
|
228
340
|
spanOutputProcessors: z.ZodOptional<z.ZodArray<z.ZodAny, "many">>;
|
|
229
341
|
includeInternalSpans: z.ZodOptional<z.ZodBoolean>;
|
|
230
342
|
requestContextKeys: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
343
|
+
serializationOptions: z.ZodOptional<z.ZodObject<{
|
|
344
|
+
maxStringLength: z.ZodOptional<z.ZodNumber>;
|
|
345
|
+
maxDepth: z.ZodOptional<z.ZodNumber>;
|
|
346
|
+
maxArrayLength: z.ZodOptional<z.ZodNumber>;
|
|
347
|
+
maxObjectKeys: z.ZodOptional<z.ZodNumber>;
|
|
348
|
+
}, "strip", z.ZodTypeAny, {
|
|
349
|
+
maxStringLength?: number | undefined;
|
|
350
|
+
maxDepth?: number | undefined;
|
|
351
|
+
maxArrayLength?: number | undefined;
|
|
352
|
+
maxObjectKeys?: number | undefined;
|
|
353
|
+
}, {
|
|
354
|
+
maxStringLength?: number | undefined;
|
|
355
|
+
maxDepth?: number | undefined;
|
|
356
|
+
maxArrayLength?: number | undefined;
|
|
357
|
+
maxObjectKeys?: number | undefined;
|
|
358
|
+
}>>;
|
|
231
359
|
}, "strip", z.ZodTypeAny, {
|
|
232
360
|
serviceName: string;
|
|
233
361
|
sampling?: {
|
|
@@ -242,9 +370,64 @@ export declare const observabilityConfigValueSchema: z.ZodObject<{
|
|
|
242
370
|
sampler: (args_0: any, ...args: unknown[]) => boolean;
|
|
243
371
|
} | undefined;
|
|
244
372
|
exporters?: any[] | undefined;
|
|
373
|
+
bridge?: any;
|
|
374
|
+
spanOutputProcessors?: any[] | undefined;
|
|
375
|
+
includeInternalSpans?: boolean | undefined;
|
|
376
|
+
requestContextKeys?: string[] | undefined;
|
|
377
|
+
serializationOptions?: {
|
|
378
|
+
maxStringLength?: number | undefined;
|
|
379
|
+
maxDepth?: number | undefined;
|
|
380
|
+
maxArrayLength?: number | undefined;
|
|
381
|
+
maxObjectKeys?: number | undefined;
|
|
382
|
+
} | undefined;
|
|
383
|
+
}, {
|
|
384
|
+
serviceName: string;
|
|
385
|
+
sampling?: {
|
|
386
|
+
type: SamplingStrategyType.ALWAYS;
|
|
387
|
+
} | {
|
|
388
|
+
type: SamplingStrategyType.NEVER;
|
|
389
|
+
} | {
|
|
390
|
+
type: SamplingStrategyType.RATIO;
|
|
391
|
+
probability: number;
|
|
392
|
+
} | {
|
|
393
|
+
type: SamplingStrategyType.CUSTOM;
|
|
394
|
+
sampler: (args_0: any, ...args: unknown[]) => boolean;
|
|
395
|
+
} | undefined;
|
|
396
|
+
exporters?: any[] | undefined;
|
|
397
|
+
bridge?: any;
|
|
398
|
+
spanOutputProcessors?: any[] | undefined;
|
|
399
|
+
includeInternalSpans?: boolean | undefined;
|
|
400
|
+
requestContextKeys?: string[] | undefined;
|
|
401
|
+
serializationOptions?: {
|
|
402
|
+
maxStringLength?: number | undefined;
|
|
403
|
+
maxDepth?: number | undefined;
|
|
404
|
+
maxArrayLength?: number | undefined;
|
|
405
|
+
maxObjectKeys?: number | undefined;
|
|
406
|
+
} | undefined;
|
|
407
|
+
}>, {
|
|
408
|
+
serviceName: string;
|
|
409
|
+
sampling?: {
|
|
410
|
+
type: SamplingStrategyType.ALWAYS;
|
|
411
|
+
} | {
|
|
412
|
+
type: SamplingStrategyType.NEVER;
|
|
413
|
+
} | {
|
|
414
|
+
type: SamplingStrategyType.RATIO;
|
|
415
|
+
probability: number;
|
|
416
|
+
} | {
|
|
417
|
+
type: SamplingStrategyType.CUSTOM;
|
|
418
|
+
sampler: (args_0: any, ...args: unknown[]) => boolean;
|
|
419
|
+
} | undefined;
|
|
420
|
+
exporters?: any[] | undefined;
|
|
421
|
+
bridge?: any;
|
|
245
422
|
spanOutputProcessors?: any[] | undefined;
|
|
246
423
|
includeInternalSpans?: boolean | undefined;
|
|
247
424
|
requestContextKeys?: string[] | undefined;
|
|
425
|
+
serializationOptions?: {
|
|
426
|
+
maxStringLength?: number | undefined;
|
|
427
|
+
maxDepth?: number | undefined;
|
|
428
|
+
maxArrayLength?: number | undefined;
|
|
429
|
+
maxObjectKeys?: number | undefined;
|
|
430
|
+
} | undefined;
|
|
248
431
|
}, {
|
|
249
432
|
serviceName: string;
|
|
250
433
|
sampling?: {
|
|
@@ -259,9 +442,16 @@ export declare const observabilityConfigValueSchema: z.ZodObject<{
|
|
|
259
442
|
sampler: (args_0: any, ...args: unknown[]) => boolean;
|
|
260
443
|
} | undefined;
|
|
261
444
|
exporters?: any[] | undefined;
|
|
445
|
+
bridge?: any;
|
|
262
446
|
spanOutputProcessors?: any[] | undefined;
|
|
263
447
|
includeInternalSpans?: boolean | undefined;
|
|
264
448
|
requestContextKeys?: string[] | undefined;
|
|
449
|
+
serializationOptions?: {
|
|
450
|
+
maxStringLength?: number | undefined;
|
|
451
|
+
maxDepth?: number | undefined;
|
|
452
|
+
maxArrayLength?: number | undefined;
|
|
453
|
+
maxObjectKeys?: number | undefined;
|
|
454
|
+
} | undefined;
|
|
265
455
|
}>;
|
|
266
456
|
/**
|
|
267
457
|
* Zod schema for ObservabilityRegistryConfig
|
|
@@ -269,7 +459,7 @@ export declare const observabilityConfigValueSchema: z.ZodObject<{
|
|
|
269
459
|
* both plain config objects and pre-instantiated ObservabilityInstance objects.
|
|
270
460
|
* The schema is permissive to handle edge cases gracefully (arrays, null values).
|
|
271
461
|
*/
|
|
272
|
-
export declare const observabilityRegistryConfigSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
462
|
+
export declare const observabilityRegistryConfigSchema: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
273
463
|
default: z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
274
464
|
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
275
465
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -339,5 +529,25 @@ export declare const observabilityRegistryConfigSchema: z.ZodEffects<z.ZodEffect
|
|
|
339
529
|
}>>>;
|
|
340
530
|
configs: z.ZodOptional<z.ZodUnion<[z.ZodRecord<z.ZodString, z.ZodAny>, z.ZodArray<z.ZodAny, "many">, z.ZodNull]>>;
|
|
341
531
|
configSelector: z.ZodOptional<z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>>;
|
|
532
|
+
}, z.ZodTypeAny, "passthrough">>, z.objectOutputType<{
|
|
533
|
+
default: z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
534
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
535
|
+
}, "strip", z.ZodTypeAny, {
|
|
536
|
+
enabled?: boolean | undefined;
|
|
537
|
+
}, {
|
|
538
|
+
enabled?: boolean | undefined;
|
|
539
|
+
}>>>;
|
|
540
|
+
configs: z.ZodOptional<z.ZodUnion<[z.ZodRecord<z.ZodString, z.ZodAny>, z.ZodArray<z.ZodAny, "many">, z.ZodNull]>>;
|
|
541
|
+
configSelector: z.ZodOptional<z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>>;
|
|
542
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
543
|
+
default: z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
544
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
545
|
+
}, "strip", z.ZodTypeAny, {
|
|
546
|
+
enabled?: boolean | undefined;
|
|
547
|
+
}, {
|
|
548
|
+
enabled?: boolean | undefined;
|
|
549
|
+
}>>>;
|
|
550
|
+
configs: z.ZodOptional<z.ZodUnion<[z.ZodRecord<z.ZodString, z.ZodAny>, z.ZodArray<z.ZodAny, "many">, z.ZodNull]>>;
|
|
551
|
+
configSelector: z.ZodOptional<z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>>;
|
|
342
552
|
}, z.ZodTypeAny, "passthrough">>;
|
|
343
553
|
//# sourceMappingURL=config.d.ts.map
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,KAAK,EACV,qBAAqB,EACrB,qBAAqB,EACrB,mBAAmB,EACnB,cAAc,
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"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"}
|
package/dist/default.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"default.d.ts","sourceRoot":"","sources":["../src/default.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAG/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EACV,cAAc,EACd,qBAAqB,EACrB,uBAAuB,EACvB,qBAAqB,EACtB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,KAAK,EAA+B,2BAA2B,EAAE,MAAM,UAAU,CAAC;AAezF,qBAAa,aAAc,SAAQ,UAAW,YAAW,uBAAuB;;gBAGlE,MAAM,EAAE,2BAA2B;
|
|
1
|
+
{"version":3,"file":"default.d.ts","sourceRoot":"","sources":["../src/default.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAG/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EACV,cAAc,EACd,qBAAqB,EACrB,uBAAuB,EACvB,qBAAqB,EACtB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,KAAK,EAA+B,2BAA2B,EAAE,MAAM,UAAU,CAAC;AAezF,qBAAa,aAAc,SAAQ,UAAW,YAAW,uBAAuB;;gBAGlE,MAAM,EAAE,2BAA2B;IA4F/C,gBAAgB,CAAC,OAAO,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI;IAuBnD,SAAS,CAAC,OAAO,EAAE;QAAE,MAAM,EAAE,aAAa,CAAA;KAAE,GAAG,IAAI;IAOnD,mBAAmB,CAAC,OAAO,EAAE,qBAAqB,GAAG,qBAAqB,GAAG,SAAS;IAItF;;OAEG;IAEH,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,qBAAqB,EAAE,SAAS,UAAQ,GAAG,IAAI;IAIxF,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,qBAAqB,GAAG,SAAS;IAI5D,kBAAkB,IAAI,qBAAqB,GAAG,SAAS;IAIvD,aAAa,IAAI,WAAW,CAAC,MAAM,EAAE,qBAAqB,CAAC;IAI3D,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAIzC,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAIlC,iBAAiB,CAAC,QAAQ,EAAE,cAAc,GAAG,IAAI;IAIjD,KAAK,IAAI,IAAI;IAIP,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;CAGhC"}
|
package/dist/exporters/base.d.ts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import { LogLevel } from '@mastra/core/logger';
|
|
10
10
|
import type { IMastraLogger } from '@mastra/core/logger';
|
|
11
|
-
import type { TracingEvent, ObservabilityExporter, InitExporterOptions } from '@mastra/core/observability';
|
|
11
|
+
import type { TracingEvent, ObservabilityExporter, InitExporterOptions, CustomSpanFormatter } from '@mastra/core/observability';
|
|
12
12
|
/**
|
|
13
13
|
* Base configuration that all exporters should support
|
|
14
14
|
*/
|
|
@@ -17,6 +17,31 @@ export interface BaseExporterConfig {
|
|
|
17
17
|
logger?: IMastraLogger;
|
|
18
18
|
/** Log level for the exporter (defaults to INFO) - accepts both enum and string */
|
|
19
19
|
logLevel?: LogLevel | 'debug' | 'info' | 'warn' | 'error';
|
|
20
|
+
/**
|
|
21
|
+
* Custom span formatter function to transform exported spans before they are
|
|
22
|
+
* processed by the exporter. This allows customization of how spans appear
|
|
23
|
+
* in vendor-specific observability platforms.
|
|
24
|
+
*
|
|
25
|
+
* Use cases:
|
|
26
|
+
* - Extract plain text from structured AI SDK messages for better readability
|
|
27
|
+
* - Transform input/output format for specific vendor requirements
|
|
28
|
+
* - Add or remove fields based on the target platform
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```typescript
|
|
32
|
+
* const exporter = new BraintrustExporter({
|
|
33
|
+
* customSpanFormatter: (span) => {
|
|
34
|
+
* // Extract plain text user message for AGENT_RUN spans
|
|
35
|
+
* if (span.type === SpanType.AGENT_RUN && Array.isArray(span.input)) {
|
|
36
|
+
* const userMsg = span.input.find(m => m.role === 'user');
|
|
37
|
+
* return { ...span, input: userMsg?.content ?? span.input };
|
|
38
|
+
* }
|
|
39
|
+
* return span;
|
|
40
|
+
* },
|
|
41
|
+
* });
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
customSpanFormatter?: CustomSpanFormatter;
|
|
20
45
|
}
|
|
21
46
|
/**
|
|
22
47
|
* Abstract base class for observability exporters
|
|
@@ -49,12 +74,15 @@ export interface BaseExporterConfig {
|
|
|
49
74
|
* ```
|
|
50
75
|
*/
|
|
51
76
|
export declare abstract class BaseExporter implements ObservabilityExporter {
|
|
77
|
+
#private;
|
|
52
78
|
/** Exporter name - must be implemented by subclasses */
|
|
53
79
|
abstract name: string;
|
|
54
80
|
/** Mastra logger instance */
|
|
55
81
|
protected logger: IMastraLogger;
|
|
56
|
-
/**
|
|
57
|
-
protected
|
|
82
|
+
/** Base configuration (accessible by subclasses) */
|
|
83
|
+
protected readonly baseConfig: BaseExporterConfig;
|
|
84
|
+
/** Public getter for disabled state */
|
|
85
|
+
get isDisabled(): boolean;
|
|
58
86
|
/**
|
|
59
87
|
* Initialize the base exporter with logger
|
|
60
88
|
*/
|
|
@@ -73,11 +101,23 @@ export declare abstract class BaseExporter implements ObservabilityExporter {
|
|
|
73
101
|
* @param reason - Reason why the exporter is disabled
|
|
74
102
|
*/
|
|
75
103
|
protected setDisabled(reason: string): void;
|
|
104
|
+
/**
|
|
105
|
+
* Apply the customSpanFormatter if configured.
|
|
106
|
+
* This is called automatically by exportTracingEvent before _exportTracingEvent.
|
|
107
|
+
*
|
|
108
|
+
* Supports both synchronous and asynchronous formatters. If the formatter
|
|
109
|
+
* returns a Promise, it will be awaited.
|
|
110
|
+
*
|
|
111
|
+
* @param event - The incoming tracing event
|
|
112
|
+
* @returns The (possibly modified) event to process
|
|
113
|
+
*/
|
|
114
|
+
protected applySpanFormatter(event: TracingEvent): Promise<TracingEvent>;
|
|
76
115
|
/**
|
|
77
116
|
* Export a tracing event
|
|
78
117
|
*
|
|
79
|
-
* This method checks if the exporter is disabled
|
|
80
|
-
*
|
|
118
|
+
* This method checks if the exporter is disabled, applies the customSpanFormatter,
|
|
119
|
+
* then calls _exportTracingEvent.
|
|
120
|
+
* Subclasses should implement _exportTracingEvent instead of overriding this method.
|
|
81
121
|
*/
|
|
82
122
|
exportTracingEvent(event: TracingEvent): Promise<void>;
|
|
83
123
|
/**
|
|
@@ -101,6 +141,16 @@ export declare abstract class BaseExporter implements ObservabilityExporter {
|
|
|
101
141
|
scorerName: string;
|
|
102
142
|
metadata?: Record<string, any>;
|
|
103
143
|
}): Promise<void>;
|
|
144
|
+
/**
|
|
145
|
+
* Force flush any buffered/queued spans without shutting down the exporter.
|
|
146
|
+
*
|
|
147
|
+
* This is useful in serverless environments where you need to ensure spans
|
|
148
|
+
* are exported before the runtime instance is terminated, while keeping
|
|
149
|
+
* the exporter active for future requests.
|
|
150
|
+
*
|
|
151
|
+
* Default implementation is a no-op. Override to add flush logic.
|
|
152
|
+
*/
|
|
153
|
+
flush(): Promise<void>;
|
|
104
154
|
/**
|
|
105
155
|
* Shutdown the exporter and clean up resources
|
|
106
156
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/exporters/base.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAiB,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/exporters/base.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAiB,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EACV,YAAY,EACZ,qBAAqB,EACrB,mBAAmB,EACnB,mBAAmB,EACpB,MAAM,4BAA4B,CAAC;AAEpC;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,sCAAsC;IACtC,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,mFAAmF;IACnF,QAAQ,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;IAC1D;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;CAC3C;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,8BAAsB,YAAa,YAAW,qBAAqB;;IACjE,wDAAwD;IACxD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB,6BAA6B;IAC7B,SAAS,CAAC,MAAM,EAAE,aAAa,CAAC;IAEhC,oDAAoD;IACpD,SAAS,CAAC,QAAQ,CAAC,UAAU,EAAE,kBAAkB,CAAC;IAKlD,uCAAuC;IACvC,IAAI,UAAU,IAAI,OAAO,CAExB;IAED;;OAEG;gBACS,MAAM,GAAE,kBAAuB;IAQ3C;;OAEG;IACH,WAAW,CAAC,MAAM,EAAE,aAAa,GAAG,IAAI;IAMxC;;OAEG;IACH,OAAO,CAAC,eAAe;IAqBvB;;;;OAIG;IACH,SAAS,CAAC,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAK3C;;;;;;;;;OASG;cACa,kBAAkB,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC;IAoB9E;;;;;;OAMG;IACG,kBAAkB,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAQ5D;;;;OAIG;IACH,SAAS,CAAC,QAAQ,CAAC,mBAAmB,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAE1E;;OAEG;IACH,IAAI,CAAC,CAAC,QAAQ,EAAE,mBAAmB,GAAG,IAAI;IAE1C;;OAEG;IACH,eAAe,CAAC,CAAC,KAAK,EAAE;QACtB,OAAO,EAAE,MAAM,CAAC;QAChB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,UAAU,EAAE,MAAM,CAAC;QACnB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;KAChC,GAAG,OAAO,CAAC,IAAI,CAAC;IAEjB;;;;;;;;OAQG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAI5B;;;;OAIG;IACG,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;CAGhC"}
|
|
@@ -10,7 +10,7 @@ export interface CloudExporterConfig extends BaseExporterConfig {
|
|
|
10
10
|
}
|
|
11
11
|
export declare class CloudExporter extends BaseExporter {
|
|
12
12
|
name: string;
|
|
13
|
-
private
|
|
13
|
+
private cloudConfig;
|
|
14
14
|
private buffer;
|
|
15
15
|
private flushTimer;
|
|
16
16
|
constructor(config?: CloudExporterConfig);
|
|
@@ -19,12 +19,18 @@ export declare class CloudExporter extends BaseExporter {
|
|
|
19
19
|
private formatSpan;
|
|
20
20
|
private shouldFlush;
|
|
21
21
|
private scheduleFlush;
|
|
22
|
-
private
|
|
22
|
+
private flushBuffer;
|
|
23
23
|
/**
|
|
24
24
|
* Uploads spans to cloud API using fetchWithRetry for all retry logic
|
|
25
25
|
*/
|
|
26
26
|
private batchUpload;
|
|
27
27
|
private resetBuffer;
|
|
28
|
+
/**
|
|
29
|
+
* Force flush any buffered spans without shutting down the exporter.
|
|
30
|
+
* This is useful in serverless environments where you need to ensure spans
|
|
31
|
+
* are exported before the runtime instance is terminated.
|
|
32
|
+
*/
|
|
33
|
+
flush(): Promise<void>;
|
|
28
34
|
shutdown(): Promise<void>;
|
|
29
35
|
}
|
|
30
36
|
//# sourceMappingURL=cloud.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cloud.d.ts","sourceRoot":"","sources":["../../src/exporters/cloud.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAmB,MAAM,4BAA4B,CAAC;AAEhF,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAEjD,MAAM,WAAW,mBAAoB,SAAQ,kBAAkB;IAC7D,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;IAGpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;
|
|
1
|
+
{"version":3,"file":"cloud.d.ts","sourceRoot":"","sources":["../../src/exporters/cloud.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAmB,MAAM,4BAA4B,CAAC;AAEhF,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAEjD,MAAM,WAAW,mBAAoB,SAAQ,kBAAkB;IAC7D,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;IAGpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAgCD,qBAAa,aAAc,SAAQ,YAAY;IAC7C,IAAI,SAAyC;IAE7C,OAAO,CAAC,WAAW,CAAsB;IACzC,OAAO,CAAC,MAAM,CAAoB;IAClC,OAAO,CAAC,UAAU,CAA+B;gBAErC,MAAM,GAAE,mBAAwB;cA2B5B,mBAAmB,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAmBvE,OAAO,CAAC,WAAW;IAWnB,OAAO,CAAC,UAAU;IAsBlB,OAAO,CAAC,WAAW;IAiBnB,OAAO,CAAC,aAAa;YAoBP,WAAW;IA8CzB;;OAEG;YACW,WAAW;IAezB,OAAO,CAAC,WAAW;IAMnB;;;;OAIG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IActB,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;CAkChC"}
|