@brizz/sdk 0.1.36 → 0.1.39

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.
Files changed (102) hide show
  1. package/README.md +28 -125
  2. package/dist/{chunk-6OGRVH77.js → chunk-JBNWC4YN.js} +1 -1
  3. package/dist/{chunk-PXIW2K27.cjs → chunk-NMDPWJMU.cjs} +1 -1
  4. package/dist/index.cjs +2264 -15
  5. package/dist/index.js +2299 -50
  6. package/dist/{mcp-HAUJ3G4Q.cjs → mcp-3N3DAQGD.cjs} +2 -2
  7. package/dist/{mcp-ZCRMQV5L.js → mcp-EWOGAW4J.js} +1 -1
  8. package/dist/types/cjs/eve.d.ts +2 -0
  9. package/dist/types/cjs/google-genai.d.ts +1 -0
  10. package/dist/types/cjs/index.d.ts +15 -0
  11. package/dist/types/cjs/internal/config.d.ts +19 -0
  12. package/dist/types/cjs/internal/constants.d.ts +3 -0
  13. package/dist/types/cjs/internal/dsn.d.ts +13 -0
  14. package/dist/types/cjs/internal/instrumentation/auto-init.d.ts +8 -0
  15. package/dist/types/cjs/internal/instrumentation/google-genai.d.ts +13 -0
  16. package/dist/types/cjs/internal/instrumentation/index.d.ts +2 -0
  17. package/dist/types/cjs/internal/instrumentation/mcp/index.d.ts +2 -0
  18. package/dist/types/cjs/internal/instrumentation/mcp/instrumentation.d.ts +15 -0
  19. package/dist/types/cjs/internal/instrumentation/mcp/patches/attributes.d.ts +9 -0
  20. package/dist/types/cjs/internal/instrumentation/mcp/patches/protocol.d.ts +2 -0
  21. package/dist/types/cjs/internal/instrumentation/mcp/schemas.d.ts +2 -0
  22. package/dist/types/cjs/internal/instrumentation/mcp/semantic-conventions.d.ts +37 -0
  23. package/dist/types/cjs/internal/instrumentation/mcp/session.d.ts +6 -0
  24. package/dist/types/cjs/internal/instrumentation/mcp/types.d.ts +47 -0
  25. package/dist/types/cjs/internal/instrumentation/mcp/version.d.ts +2 -0
  26. package/dist/types/cjs/internal/instrumentation/registry.d.ts +29 -0
  27. package/dist/types/cjs/internal/instrumentation/vercel-ai/interrupt.d.ts +11 -0
  28. package/dist/types/cjs/internal/log/index.d.ts +1 -0
  29. package/dist/types/cjs/internal/log/logging.d.ts +21 -0
  30. package/dist/types/cjs/internal/log/processors/log-processor.d.ts +16 -0
  31. package/dist/types/cjs/internal/logger.d.ts +23 -0
  32. package/dist/types/cjs/internal/masking/index.d.ts +3 -0
  33. package/dist/types/cjs/internal/masking/patterns.d.ts +2 -0
  34. package/dist/types/cjs/internal/masking/types.d.ts +32 -0
  35. package/dist/types/cjs/internal/masking/utils.d.ts +5 -0
  36. package/dist/types/cjs/internal/metric/index.d.ts +1 -0
  37. package/dist/types/cjs/internal/metric/metrics.d.ts +17 -0
  38. package/dist/types/cjs/internal/sdk.d.ts +42 -0
  39. package/dist/types/cjs/internal/semantic-conventions.d.ts +54 -0
  40. package/dist/types/cjs/internal/trace/exporters/eve-trace-exporter.d.ts +18 -0
  41. package/dist/types/cjs/internal/trace/exporters/span-exporter.d.ts +12 -0
  42. package/dist/types/cjs/internal/trace/index.d.ts +4 -0
  43. package/dist/types/cjs/internal/trace/processors/eve-session-processor.d.ts +2 -0
  44. package/dist/types/cjs/internal/trace/processors/span-processor.d.ts +18 -0
  45. package/dist/types/cjs/internal/trace/session.d.ts +135 -0
  46. package/dist/types/cjs/internal/trace/tracing.d.ts +17 -0
  47. package/dist/types/cjs/internal/version.d.ts +1 -0
  48. package/dist/types/cjs/package.json +3 -0
  49. package/dist/types/esm/eve.d.ts +2 -0
  50. package/dist/types/esm/google-genai.d.ts +1 -0
  51. package/dist/types/esm/index.d.ts +15 -0
  52. package/dist/types/esm/internal/config.d.ts +19 -0
  53. package/dist/types/esm/internal/constants.d.ts +3 -0
  54. package/dist/types/esm/internal/dsn.d.ts +13 -0
  55. package/dist/types/esm/internal/instrumentation/auto-init.d.ts +8 -0
  56. package/dist/types/esm/internal/instrumentation/google-genai.d.ts +13 -0
  57. package/dist/types/esm/internal/instrumentation/index.d.ts +2 -0
  58. package/dist/types/esm/internal/instrumentation/mcp/index.d.ts +2 -0
  59. package/dist/types/esm/internal/instrumentation/mcp/instrumentation.d.ts +15 -0
  60. package/dist/types/esm/internal/instrumentation/mcp/patches/attributes.d.ts +9 -0
  61. package/dist/types/esm/internal/instrumentation/mcp/patches/protocol.d.ts +2 -0
  62. package/dist/types/esm/internal/instrumentation/mcp/schemas.d.ts +2 -0
  63. package/dist/types/esm/internal/instrumentation/mcp/semantic-conventions.d.ts +37 -0
  64. package/dist/types/esm/internal/instrumentation/mcp/session.d.ts +6 -0
  65. package/dist/types/esm/internal/instrumentation/mcp/types.d.ts +47 -0
  66. package/dist/types/esm/internal/instrumentation/mcp/version.d.ts +2 -0
  67. package/dist/types/esm/internal/instrumentation/registry.d.ts +29 -0
  68. package/dist/types/esm/internal/instrumentation/vercel-ai/interrupt.d.ts +11 -0
  69. package/dist/types/esm/internal/log/index.d.ts +1 -0
  70. package/dist/types/esm/internal/log/logging.d.ts +21 -0
  71. package/dist/types/esm/internal/log/processors/log-processor.d.ts +16 -0
  72. package/dist/types/esm/internal/logger.d.ts +23 -0
  73. package/dist/types/esm/internal/masking/index.d.ts +3 -0
  74. package/dist/types/esm/internal/masking/patterns.d.ts +2 -0
  75. package/dist/types/esm/internal/masking/types.d.ts +32 -0
  76. package/dist/types/esm/internal/masking/utils.d.ts +5 -0
  77. package/dist/types/esm/internal/metric/index.d.ts +1 -0
  78. package/dist/types/esm/internal/metric/metrics.d.ts +17 -0
  79. package/dist/types/esm/internal/sdk.d.ts +42 -0
  80. package/dist/types/esm/internal/semantic-conventions.d.ts +54 -0
  81. package/dist/types/esm/internal/trace/exporters/eve-trace-exporter.d.ts +18 -0
  82. package/dist/types/esm/internal/trace/exporters/span-exporter.d.ts +12 -0
  83. package/dist/types/esm/internal/trace/index.d.ts +4 -0
  84. package/dist/types/esm/internal/trace/processors/eve-session-processor.d.ts +2 -0
  85. package/dist/types/esm/internal/trace/processors/span-processor.d.ts +18 -0
  86. package/dist/types/esm/internal/trace/session.d.ts +135 -0
  87. package/dist/types/esm/internal/trace/tracing.d.ts +17 -0
  88. package/dist/types/esm/internal/version.d.ts +1 -0
  89. package/package.json +58 -58
  90. package/dist/chunk-CQDWK43A.cjs +0 -2368
  91. package/dist/chunk-YNCBWOHM.js +0 -2368
  92. package/dist/eve.d.cts +0 -19
  93. package/dist/eve.d.ts +0 -19
  94. package/dist/google-genai.d.cts +0 -7
  95. package/dist/google-genai.d.ts +0 -7
  96. package/dist/index.d.cts +0 -291
  97. package/dist/index.d.ts +0 -291
  98. package/dist/loader.mjs +0 -85
  99. package/dist/preload.cjs +0 -119
  100. package/dist/preload.d.cts +0 -2
  101. package/dist/preload.d.ts +0 -2
  102. package/dist/preload.js +0 -119
package/dist/eve.d.cts DELETED
@@ -1,19 +0,0 @@
1
- import { SpanProcessor, SpanExporter } from '@opentelemetry/sdk-trace-base';
2
-
3
- declare function createEveSessionProcessor(): SpanProcessor;
4
-
5
- interface ICreateEveTraceExporterOptions {
6
- dsn?: string;
7
- }
8
- interface ICreateEveOtelConfigOptions extends ICreateEveTraceExporterOptions {
9
- serviceName?: string;
10
- }
11
- interface IEveOtelConfig {
12
- serviceName?: string;
13
- traceExporter: SpanExporter;
14
- spanProcessors: Array<SpanProcessor | 'auto'>;
15
- }
16
- declare function createEveTraceExporter(options?: ICreateEveTraceExporterOptions): SpanExporter;
17
- declare function createEveOtelConfig(options?: ICreateEveOtelConfigOptions): IEveOtelConfig;
18
-
19
- export { createEveOtelConfig, createEveSessionProcessor, createEveTraceExporter };
package/dist/eve.d.ts DELETED
@@ -1,19 +0,0 @@
1
- import { SpanProcessor, SpanExporter } from '@opentelemetry/sdk-trace-base';
2
-
3
- declare function createEveSessionProcessor(): SpanProcessor;
4
-
5
- interface ICreateEveTraceExporterOptions {
6
- dsn?: string;
7
- }
8
- interface ICreateEveOtelConfigOptions extends ICreateEveTraceExporterOptions {
9
- serviceName?: string;
10
- }
11
- interface IEveOtelConfig {
12
- serviceName?: string;
13
- traceExporter: SpanExporter;
14
- spanProcessors: Array<SpanProcessor | 'auto'>;
15
- }
16
- declare function createEveTraceExporter(options?: ICreateEveTraceExporterOptions): SpanExporter;
17
- declare function createEveOtelConfig(options?: ICreateEveOtelConfigOptions): IEveOtelConfig;
18
-
19
- export { createEveOtelConfig, createEveSessionProcessor, createEveTraceExporter };
@@ -1,7 +0,0 @@
1
- import { GenAIInstrumentation } from '@traceloop/instrumentation-google-generativeai';
2
-
3
- type GoogleGenAIModule = Parameters<GenAIInstrumentation['manuallyInstrument']>[0];
4
- type GoogleGenAIClass = GoogleGenAIModule['GoogleGenAI'];
5
- declare function instrumentGoogleGenAI(module: GoogleGenAIModule): GoogleGenAIClass;
6
-
7
- export { instrumentGoogleGenAI };
@@ -1,7 +0,0 @@
1
- import { GenAIInstrumentation } from '@traceloop/instrumentation-google-generativeai';
2
-
3
- type GoogleGenAIModule = Parameters<GenAIInstrumentation['manuallyInstrument']>[0];
4
- type GoogleGenAIClass = GoogleGenAIModule['GoogleGenAI'];
5
- declare function instrumentGoogleGenAI(module: GoogleGenAIModule): GoogleGenAIClass;
6
-
7
- export { instrumentGoogleGenAI };
package/dist/index.d.cts DELETED
@@ -1,291 +0,0 @@
1
- import { AttributeValue, Span } from '@opentelemetry/api';
2
- export { AttributeValue } from '@opentelemetry/api';
3
- import { LogRecordExporter } from '@opentelemetry/sdk-logs';
4
- import { MetricReader } from '@opentelemetry/sdk-metrics';
5
- import { SpanExporter, ReadableSpan } from '@opentelemetry/sdk-trace-base';
6
- export { ReadableSpan } from '@opentelemetry/sdk-trace-base';
7
- import { LogBody, SeverityNumber } from '@opentelemetry/api-logs';
8
- export { SeverityNumber } from '@opentelemetry/api-logs';
9
- import { SpanProcessor } from '@opentelemetry/sdk-trace-node';
10
- import { OTLPMetricExporter } from '@opentelemetry/exporter-metrics-otlp-http';
11
-
12
- interface IMCPManualModules {
13
- clientSSEModule?: unknown;
14
- serverSSEModule?: unknown;
15
- clientStdioModule?: unknown;
16
- serverStdioModule?: unknown;
17
- clientStreamableHTTPModule?: unknown;
18
- serverStreamableHTTPModule?: unknown;
19
- protocolModule?: unknown;
20
- }
21
-
22
- interface IInstrumentModules {
23
- openAI?: unknown;
24
- anthropic?: unknown;
25
- cohere?: unknown;
26
- google_vertexai?: unknown;
27
- google_aiplatform?: unknown;
28
- google_genai?: unknown;
29
- bedrock?: unknown;
30
- pinecone?: unknown;
31
- langchain?: {
32
- callbackManagerModule?: unknown;
33
- };
34
- llamaindex?: unknown;
35
- chromadb?: unknown;
36
- qdrant?: unknown;
37
- together?: unknown;
38
- vercelAI?: unknown;
39
- mcp?: IMCPManualModules;
40
- }
41
-
42
- declare enum LogLevel {
43
- NONE = 0,
44
- ERROR = 1,
45
- WARN = 2,
46
- INFO = 3,
47
- DEBUG = 4
48
- }
49
- interface ILogger {
50
- debug: (msg: string, ...meta: unknown[]) => void;
51
- info: (msg: string, ...meta: unknown[]) => void;
52
- warn: (msg: string, ...meta: unknown[]) => void;
53
- error: (msg: string, ...meta: unknown[]) => void;
54
- setLevel: (level: LogLevel) => void;
55
- getLevel: () => LogLevel;
56
- }
57
- declare const logger: ILogger;
58
- declare function setLogLevel(level: LogLevel | string): void;
59
- declare function getLogLevel(): LogLevel;
60
-
61
- type MaskingMode = 'partial' | 'full';
62
- interface IPatternBasedMaskingRule {
63
- readonly patterns: readonly (IPatternEntry | string)[];
64
- readonly mode?: MaskingMode;
65
- }
66
- interface IPatternEntry {
67
- readonly name?: string | undefined;
68
- readonly pattern: string;
69
- }
70
- interface IAttributesMaskingRule extends IPatternBasedMaskingRule {
71
- readonly patterns: readonly (IPatternEntry | string)[];
72
- readonly attributePattern?: string;
73
- readonly mode?: MaskingMode;
74
- }
75
- interface IEventMaskingRule extends IAttributesMaskingRule {
76
- readonly eventNamePattern?: string;
77
- }
78
- interface ISpanMaskingConfig {
79
- readonly disableDefaultRules?: boolean;
80
- readonly rules?: readonly IAttributesMaskingRule[];
81
- }
82
- interface ILogMaskingConfig {
83
- readonly disableDefaultRules?: boolean;
84
- readonly maskBody?: boolean;
85
- readonly rules?: readonly IAttributesMaskingRule[];
86
- }
87
- type IEventMaskingConfig = ILogMaskingConfig;
88
- interface IMaskingConfig {
89
- readonly spanMasking?: ISpanMaskingConfig;
90
- readonly eventMasking?: IEventMaskingConfig;
91
- }
92
-
93
- declare const DEFAULT_PII_PATTERNS: IPatternEntry[];
94
-
95
- declare function maskValue(value: unknown, rule: IPatternBasedMaskingRule): unknown;
96
- declare function maskAttributes(attributes: Record<string, unknown>, rules: readonly IAttributesMaskingRule[], outputOriginalValue?: boolean): Record<string, unknown>;
97
-
98
- interface IBrizzInitializeOptions {
99
- appName?: string;
100
- appVersion?: string;
101
- baseUrl?: string;
102
- apiKey?: string;
103
- dsn?: string;
104
- headers?: Record<string, string>;
105
- disableBatch?: boolean;
106
- environment?: string;
107
- masking?: boolean | IMaskingConfig;
108
- logLevel?: LogLevel | string;
109
- instrumentModules?: IInstrumentModules;
110
- disableNodeSdk?: boolean;
111
- customSpanExporter?: SpanExporter;
112
- customLogExporter?: LogRecordExporter;
113
- customMetricReader?: MetricReader;
114
- disableSpanExporter?: boolean;
115
- resourceAttributes?: Record<string, AttributeValue>;
116
- beforeSendSpan?: (span: ReadableSpan) => boolean | Promise<boolean>;
117
- }
118
- declare class _Brizz {
119
- private static instance;
120
- static getInstance(): _Brizz;
121
- private _initialized;
122
- private _tracerProvider;
123
- private _meterProvider;
124
- private setupInstrumentation;
125
- private createAndStartProviders;
126
- private initializeModules;
127
- private detectModuleSystem;
128
- private shutdownModules;
129
- initialize(options: IBrizzInitializeOptions): void;
130
- shutdown(): Promise<void>;
131
- }
132
- declare const Brizz: _Brizz;
133
-
134
- declare function emitEvent(name: string, attributes?: Record<string, string | number | boolean>, body?: LogBody, severityNumber?: SeverityNumber): void;
135
- declare function emitEventWithSessionId(sessionId: string, name: string, attributes?: Record<string, string | number | boolean>, body?: LogBody, severityNumber?: SeverityNumber): void;
136
-
137
- declare function getSpanExporter(): SpanExporter;
138
- declare function getSpanProcessor(): SpanProcessor;
139
-
140
- declare function setCurrentSpanCustomProperties(properties: Record<string, AttributeValue>): void;
141
- declare function callWithProperties<A extends unknown[], F extends (...args: A) => ReturnType<F>>(properties: {
142
- [name: string]: string;
143
- }, fn: F, thisArg?: ThisParameterType<F>, ...args: A): ReturnType<F>;
144
- declare function withProperties<F extends (this: any, ...args: any[]) => any>(properties: {
145
- [name: string]: string;
146
- }, fn: F, thisArg?: ThisParameterType<F>): F;
147
- declare function setUser(user: {
148
- id: string;
149
- email?: string;
150
- name?: string;
151
- role?: string;
152
- plan?: string;
153
- traits?: Record<string, string>;
154
- }): void;
155
- declare function setOrganization(org: {
156
- id: string;
157
- name?: string;
158
- plan?: string;
159
- domain?: string;
160
- traits?: Record<string, string>;
161
- }): void;
162
- declare function setMessageId(id: string): void;
163
- declare function callWithUser<A extends unknown[], F extends (...args: A) => ReturnType<F>>(user: {
164
- id: string;
165
- email?: string;
166
- name?: string;
167
- role?: string;
168
- plan?: string;
169
- traits?: Record<string, string>;
170
- }, fn: F, thisArg?: ThisParameterType<F>, ...args: A): ReturnType<F>;
171
- declare function withUser<F extends (this: any, ...args: any[]) => any>(user: {
172
- id: string;
173
- email?: string;
174
- name?: string;
175
- role?: string;
176
- plan?: string;
177
- traits?: Record<string, string>;
178
- }, fn: F, thisArg?: ThisParameterType<F>): F;
179
- declare function callWithOrganization<A extends unknown[], F extends (...args: A) => ReturnType<F>>(org: {
180
- id: string;
181
- name?: string;
182
- plan?: string;
183
- domain?: string;
184
- traits?: Record<string, string>;
185
- }, fn: F, thisArg?: ThisParameterType<F>, ...args: A): ReturnType<F>;
186
- declare function withOrganization<F extends (this: any, ...args: any[]) => any>(org: {
187
- id: string;
188
- name?: string;
189
- plan?: string;
190
- domain?: string;
191
- traits?: Record<string, string>;
192
- }, fn: F, thisArg?: ThisParameterType<F>): F;
193
- declare function callWithMessageId<A extends unknown[], F extends (...args: A) => ReturnType<F>>(id: string, fn: F, thisArg?: ThisParameterType<F>, ...args: A): ReturnType<F>;
194
- declare function withMessageId<F extends (this: any, ...args: any[]) => any>(id: string, fn: F, thisArg?: ThisParameterType<F>): F;
195
- interface IMuteOptions {
196
- input?: boolean;
197
- output?: boolean;
198
- tools?: boolean;
199
- }
200
- declare function callWithMute<A extends unknown[], F extends (...args: A) => ReturnType<F>>(options: IMuteOptions, fn: F, thisArg?: ThisParameterType<F>, ...args: A): ReturnType<F>;
201
- declare function withMute<F extends (this: any, ...args: any[]) => any>(options: IMuteOptions, fn: F, thisArg?: ThisParameterType<F>): F;
202
- declare function withSessionId<F extends (this: any, ...args: any[]) => any>(sessionId: string, fn: F, thisArg?: ThisParameterType<F>, extraProperties?: Record<string, string>): F;
203
- declare function callWithSessionId<A extends unknown[], F extends (...args: A) => ReturnType<F>>(sessionId: string, fn: F, thisArg?: ThisParameterType<F>, ...args: A): ReturnType<F>;
204
- declare class Session {
205
- private readonly span;
206
- private inputs;
207
- private outputs;
208
- private inputContexts;
209
- private outputContexts;
210
- readonly sessionId: string;
211
- constructor(sessionId: string, span: Span);
212
- setInput(text: string | null, context?: Record<string, AttributeValue>): void;
213
- setOutput(text: string | null, context?: Record<string, AttributeValue>): void;
214
- setTitle(title: string): void;
215
- updateProperties(properties: Record<string, AttributeValue>): void;
216
- setUser(user: {
217
- id: string;
218
- email?: string;
219
- name?: string;
220
- role?: string;
221
- plan?: string;
222
- traits?: Record<string, string>;
223
- }): void;
224
- setOrganization(org: {
225
- id: string;
226
- name?: string;
227
- plan?: string;
228
- domain?: string;
229
- traits?: Record<string, string>;
230
- }): void;
231
- addExternalLink(url: string, options?: {
232
- title?: string;
233
- linkType?: string;
234
- }): void;
235
- }
236
- declare class SessionTitle {
237
- private readonly span;
238
- constructor(span: Span);
239
- setTitle(title: string): void;
240
- }
241
- declare function getActiveSession(): Session | undefined;
242
- declare function addExternalLink(url: string, options?: {
243
- sessionId?: string;
244
- title?: string;
245
- linkType?: string;
246
- }): void;
247
- declare function recordFeedback(type: string, options?: {
248
- score?: number;
249
- reason?: string;
250
- comment?: string;
251
- source?: string;
252
- messageId?: string;
253
- sessionId?: string;
254
- attributes?: Record<string, string>;
255
- }): void;
256
- declare function recordMetric(options: {
257
- name: string;
258
- value: number | boolean;
259
- unit?: string;
260
- comment?: string;
261
- attributes?: Record<string, string>;
262
- polarity?: 'positive' | 'negative';
263
- minValue?: number;
264
- maxValue?: number;
265
- timestamp?: Date;
266
- sessionId?: string;
267
- }): void;
268
- declare function startSession<T>(sessionId: string, callback: (session: Session) => T, extraProperties?: Record<string, AttributeValue>, options?: {
269
- mode?: 'default' | 'title';
270
- }): T;
271
- declare function startSessionTitle<T>(callback: (title: SessionTitle) => T, options?: {
272
- sessionId?: string;
273
- }): T;
274
-
275
- declare function getMetricsExporter(): OTLPMetricExporter;
276
- declare function getMetricsReader(): MetricReader;
277
-
278
- interface RuntimeInfo {
279
- isESM: boolean;
280
- isCJS: boolean;
281
- nodeVersion: string;
282
- supportsLoaderAPI: boolean;
283
- supportsRegister: boolean;
284
- }
285
- declare function detectRuntime(): RuntimeInfo;
286
-
287
- declare namespace init {
288
- export { };
289
- }
290
-
291
- export { Brizz, DEFAULT_PII_PATTERNS, type IAttributesMaskingRule, type IBrizzInitializeOptions, type IEventMaskingConfig, type IEventMaskingRule, type IInstrumentModules, type ILogMaskingConfig, type ILogger, type IMCPManualModules, type IMaskingConfig, type IMuteOptions, type ISpanMaskingConfig, LogLevel, type MaskingMode, type RuntimeInfo, Session, SessionTitle, addExternalLink, callWithMessageId, callWithMute, callWithOrganization, callWithProperties, callWithSessionId, callWithUser, detectRuntime, emitEvent, emitEventWithSessionId, getActiveSession, getLogLevel, getMetricsExporter, getMetricsReader, getSpanExporter, getSpanProcessor, init, logger, maskAttributes, maskValue, recordFeedback, recordMetric, setCurrentSpanCustomProperties, setLogLevel, setMessageId, setOrganization, setUser, startSession, startSessionTitle, withMessageId, withMute, withOrganization, withProperties, withSessionId, withUser };
package/dist/index.d.ts DELETED
@@ -1,291 +0,0 @@
1
- import { AttributeValue, Span } from '@opentelemetry/api';
2
- export { AttributeValue } from '@opentelemetry/api';
3
- import { LogRecordExporter } from '@opentelemetry/sdk-logs';
4
- import { MetricReader } from '@opentelemetry/sdk-metrics';
5
- import { SpanExporter, ReadableSpan } from '@opentelemetry/sdk-trace-base';
6
- export { ReadableSpan } from '@opentelemetry/sdk-trace-base';
7
- import { LogBody, SeverityNumber } from '@opentelemetry/api-logs';
8
- export { SeverityNumber } from '@opentelemetry/api-logs';
9
- import { SpanProcessor } from '@opentelemetry/sdk-trace-node';
10
- import { OTLPMetricExporter } from '@opentelemetry/exporter-metrics-otlp-http';
11
-
12
- interface IMCPManualModules {
13
- clientSSEModule?: unknown;
14
- serverSSEModule?: unknown;
15
- clientStdioModule?: unknown;
16
- serverStdioModule?: unknown;
17
- clientStreamableHTTPModule?: unknown;
18
- serverStreamableHTTPModule?: unknown;
19
- protocolModule?: unknown;
20
- }
21
-
22
- interface IInstrumentModules {
23
- openAI?: unknown;
24
- anthropic?: unknown;
25
- cohere?: unknown;
26
- google_vertexai?: unknown;
27
- google_aiplatform?: unknown;
28
- google_genai?: unknown;
29
- bedrock?: unknown;
30
- pinecone?: unknown;
31
- langchain?: {
32
- callbackManagerModule?: unknown;
33
- };
34
- llamaindex?: unknown;
35
- chromadb?: unknown;
36
- qdrant?: unknown;
37
- together?: unknown;
38
- vercelAI?: unknown;
39
- mcp?: IMCPManualModules;
40
- }
41
-
42
- declare enum LogLevel {
43
- NONE = 0,
44
- ERROR = 1,
45
- WARN = 2,
46
- INFO = 3,
47
- DEBUG = 4
48
- }
49
- interface ILogger {
50
- debug: (msg: string, ...meta: unknown[]) => void;
51
- info: (msg: string, ...meta: unknown[]) => void;
52
- warn: (msg: string, ...meta: unknown[]) => void;
53
- error: (msg: string, ...meta: unknown[]) => void;
54
- setLevel: (level: LogLevel) => void;
55
- getLevel: () => LogLevel;
56
- }
57
- declare const logger: ILogger;
58
- declare function setLogLevel(level: LogLevel | string): void;
59
- declare function getLogLevel(): LogLevel;
60
-
61
- type MaskingMode = 'partial' | 'full';
62
- interface IPatternBasedMaskingRule {
63
- readonly patterns: readonly (IPatternEntry | string)[];
64
- readonly mode?: MaskingMode;
65
- }
66
- interface IPatternEntry {
67
- readonly name?: string | undefined;
68
- readonly pattern: string;
69
- }
70
- interface IAttributesMaskingRule extends IPatternBasedMaskingRule {
71
- readonly patterns: readonly (IPatternEntry | string)[];
72
- readonly attributePattern?: string;
73
- readonly mode?: MaskingMode;
74
- }
75
- interface IEventMaskingRule extends IAttributesMaskingRule {
76
- readonly eventNamePattern?: string;
77
- }
78
- interface ISpanMaskingConfig {
79
- readonly disableDefaultRules?: boolean;
80
- readonly rules?: readonly IAttributesMaskingRule[];
81
- }
82
- interface ILogMaskingConfig {
83
- readonly disableDefaultRules?: boolean;
84
- readonly maskBody?: boolean;
85
- readonly rules?: readonly IAttributesMaskingRule[];
86
- }
87
- type IEventMaskingConfig = ILogMaskingConfig;
88
- interface IMaskingConfig {
89
- readonly spanMasking?: ISpanMaskingConfig;
90
- readonly eventMasking?: IEventMaskingConfig;
91
- }
92
-
93
- declare const DEFAULT_PII_PATTERNS: IPatternEntry[];
94
-
95
- declare function maskValue(value: unknown, rule: IPatternBasedMaskingRule): unknown;
96
- declare function maskAttributes(attributes: Record<string, unknown>, rules: readonly IAttributesMaskingRule[], outputOriginalValue?: boolean): Record<string, unknown>;
97
-
98
- interface IBrizzInitializeOptions {
99
- appName?: string;
100
- appVersion?: string;
101
- baseUrl?: string;
102
- apiKey?: string;
103
- dsn?: string;
104
- headers?: Record<string, string>;
105
- disableBatch?: boolean;
106
- environment?: string;
107
- masking?: boolean | IMaskingConfig;
108
- logLevel?: LogLevel | string;
109
- instrumentModules?: IInstrumentModules;
110
- disableNodeSdk?: boolean;
111
- customSpanExporter?: SpanExporter;
112
- customLogExporter?: LogRecordExporter;
113
- customMetricReader?: MetricReader;
114
- disableSpanExporter?: boolean;
115
- resourceAttributes?: Record<string, AttributeValue>;
116
- beforeSendSpan?: (span: ReadableSpan) => boolean | Promise<boolean>;
117
- }
118
- declare class _Brizz {
119
- private static instance;
120
- static getInstance(): _Brizz;
121
- private _initialized;
122
- private _tracerProvider;
123
- private _meterProvider;
124
- private setupInstrumentation;
125
- private createAndStartProviders;
126
- private initializeModules;
127
- private detectModuleSystem;
128
- private shutdownModules;
129
- initialize(options: IBrizzInitializeOptions): void;
130
- shutdown(): Promise<void>;
131
- }
132
- declare const Brizz: _Brizz;
133
-
134
- declare function emitEvent(name: string, attributes?: Record<string, string | number | boolean>, body?: LogBody, severityNumber?: SeverityNumber): void;
135
- declare function emitEventWithSessionId(sessionId: string, name: string, attributes?: Record<string, string | number | boolean>, body?: LogBody, severityNumber?: SeverityNumber): void;
136
-
137
- declare function getSpanExporter(): SpanExporter;
138
- declare function getSpanProcessor(): SpanProcessor;
139
-
140
- declare function setCurrentSpanCustomProperties(properties: Record<string, AttributeValue>): void;
141
- declare function callWithProperties<A extends unknown[], F extends (...args: A) => ReturnType<F>>(properties: {
142
- [name: string]: string;
143
- }, fn: F, thisArg?: ThisParameterType<F>, ...args: A): ReturnType<F>;
144
- declare function withProperties<F extends (this: any, ...args: any[]) => any>(properties: {
145
- [name: string]: string;
146
- }, fn: F, thisArg?: ThisParameterType<F>): F;
147
- declare function setUser(user: {
148
- id: string;
149
- email?: string;
150
- name?: string;
151
- role?: string;
152
- plan?: string;
153
- traits?: Record<string, string>;
154
- }): void;
155
- declare function setOrganization(org: {
156
- id: string;
157
- name?: string;
158
- plan?: string;
159
- domain?: string;
160
- traits?: Record<string, string>;
161
- }): void;
162
- declare function setMessageId(id: string): void;
163
- declare function callWithUser<A extends unknown[], F extends (...args: A) => ReturnType<F>>(user: {
164
- id: string;
165
- email?: string;
166
- name?: string;
167
- role?: string;
168
- plan?: string;
169
- traits?: Record<string, string>;
170
- }, fn: F, thisArg?: ThisParameterType<F>, ...args: A): ReturnType<F>;
171
- declare function withUser<F extends (this: any, ...args: any[]) => any>(user: {
172
- id: string;
173
- email?: string;
174
- name?: string;
175
- role?: string;
176
- plan?: string;
177
- traits?: Record<string, string>;
178
- }, fn: F, thisArg?: ThisParameterType<F>): F;
179
- declare function callWithOrganization<A extends unknown[], F extends (...args: A) => ReturnType<F>>(org: {
180
- id: string;
181
- name?: string;
182
- plan?: string;
183
- domain?: string;
184
- traits?: Record<string, string>;
185
- }, fn: F, thisArg?: ThisParameterType<F>, ...args: A): ReturnType<F>;
186
- declare function withOrganization<F extends (this: any, ...args: any[]) => any>(org: {
187
- id: string;
188
- name?: string;
189
- plan?: string;
190
- domain?: string;
191
- traits?: Record<string, string>;
192
- }, fn: F, thisArg?: ThisParameterType<F>): F;
193
- declare function callWithMessageId<A extends unknown[], F extends (...args: A) => ReturnType<F>>(id: string, fn: F, thisArg?: ThisParameterType<F>, ...args: A): ReturnType<F>;
194
- declare function withMessageId<F extends (this: any, ...args: any[]) => any>(id: string, fn: F, thisArg?: ThisParameterType<F>): F;
195
- interface IMuteOptions {
196
- input?: boolean;
197
- output?: boolean;
198
- tools?: boolean;
199
- }
200
- declare function callWithMute<A extends unknown[], F extends (...args: A) => ReturnType<F>>(options: IMuteOptions, fn: F, thisArg?: ThisParameterType<F>, ...args: A): ReturnType<F>;
201
- declare function withMute<F extends (this: any, ...args: any[]) => any>(options: IMuteOptions, fn: F, thisArg?: ThisParameterType<F>): F;
202
- declare function withSessionId<F extends (this: any, ...args: any[]) => any>(sessionId: string, fn: F, thisArg?: ThisParameterType<F>, extraProperties?: Record<string, string>): F;
203
- declare function callWithSessionId<A extends unknown[], F extends (...args: A) => ReturnType<F>>(sessionId: string, fn: F, thisArg?: ThisParameterType<F>, ...args: A): ReturnType<F>;
204
- declare class Session {
205
- private readonly span;
206
- private inputs;
207
- private outputs;
208
- private inputContexts;
209
- private outputContexts;
210
- readonly sessionId: string;
211
- constructor(sessionId: string, span: Span);
212
- setInput(text: string | null, context?: Record<string, AttributeValue>): void;
213
- setOutput(text: string | null, context?: Record<string, AttributeValue>): void;
214
- setTitle(title: string): void;
215
- updateProperties(properties: Record<string, AttributeValue>): void;
216
- setUser(user: {
217
- id: string;
218
- email?: string;
219
- name?: string;
220
- role?: string;
221
- plan?: string;
222
- traits?: Record<string, string>;
223
- }): void;
224
- setOrganization(org: {
225
- id: string;
226
- name?: string;
227
- plan?: string;
228
- domain?: string;
229
- traits?: Record<string, string>;
230
- }): void;
231
- addExternalLink(url: string, options?: {
232
- title?: string;
233
- linkType?: string;
234
- }): void;
235
- }
236
- declare class SessionTitle {
237
- private readonly span;
238
- constructor(span: Span);
239
- setTitle(title: string): void;
240
- }
241
- declare function getActiveSession(): Session | undefined;
242
- declare function addExternalLink(url: string, options?: {
243
- sessionId?: string;
244
- title?: string;
245
- linkType?: string;
246
- }): void;
247
- declare function recordFeedback(type: string, options?: {
248
- score?: number;
249
- reason?: string;
250
- comment?: string;
251
- source?: string;
252
- messageId?: string;
253
- sessionId?: string;
254
- attributes?: Record<string, string>;
255
- }): void;
256
- declare function recordMetric(options: {
257
- name: string;
258
- value: number | boolean;
259
- unit?: string;
260
- comment?: string;
261
- attributes?: Record<string, string>;
262
- polarity?: 'positive' | 'negative';
263
- minValue?: number;
264
- maxValue?: number;
265
- timestamp?: Date;
266
- sessionId?: string;
267
- }): void;
268
- declare function startSession<T>(sessionId: string, callback: (session: Session) => T, extraProperties?: Record<string, AttributeValue>, options?: {
269
- mode?: 'default' | 'title';
270
- }): T;
271
- declare function startSessionTitle<T>(callback: (title: SessionTitle) => T, options?: {
272
- sessionId?: string;
273
- }): T;
274
-
275
- declare function getMetricsExporter(): OTLPMetricExporter;
276
- declare function getMetricsReader(): MetricReader;
277
-
278
- interface RuntimeInfo {
279
- isESM: boolean;
280
- isCJS: boolean;
281
- nodeVersion: string;
282
- supportsLoaderAPI: boolean;
283
- supportsRegister: boolean;
284
- }
285
- declare function detectRuntime(): RuntimeInfo;
286
-
287
- declare namespace init {
288
- export { };
289
- }
290
-
291
- export { Brizz, DEFAULT_PII_PATTERNS, type IAttributesMaskingRule, type IBrizzInitializeOptions, type IEventMaskingConfig, type IEventMaskingRule, type IInstrumentModules, type ILogMaskingConfig, type ILogger, type IMCPManualModules, type IMaskingConfig, type IMuteOptions, type ISpanMaskingConfig, LogLevel, type MaskingMode, type RuntimeInfo, Session, SessionTitle, addExternalLink, callWithMessageId, callWithMute, callWithOrganization, callWithProperties, callWithSessionId, callWithUser, detectRuntime, emitEvent, emitEventWithSessionId, getActiveSession, getLogLevel, getMetricsExporter, getMetricsReader, getSpanExporter, getSpanProcessor, init, logger, maskAttributes, maskValue, recordFeedback, recordMetric, setCurrentSpanCustomProperties, setLogLevel, setMessageId, setOrganization, setUser, startSession, startSessionTitle, withMessageId, withMute, withOrganization, withProperties, withSessionId, withUser };