@brizz/sdk 0.1.37 → 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-OR3YPY4I.js → chunk-JBNWC4YN.js} +1 -1
  3. package/dist/{chunk-2DSTZTDA.cjs → chunk-NMDPWJMU.cjs} +1 -1
  4. package/dist/index.cjs +2257 -13
  5. package/dist/index.js +2292 -48
  6. package/dist/{mcp-NC5OXRT4.cjs → mcp-3N3DAQGD.cjs} +2 -2
  7. package/dist/{mcp-7Y3O5QSS.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 +57 -57
  90. package/dist/chunk-4Q2CRWI6.js +0 -2377
  91. package/dist/chunk-O5DVPC42.cjs +0 -2377
  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
@@ -0,0 +1,135 @@
1
+ import type { Span, AttributeValue } from '@opentelemetry/api';
2
+ export declare function setCurrentSpanCustomProperties(properties: Record<string, AttributeValue>): void;
3
+ export declare function callWithProperties<A extends unknown[], F extends (...args: A) => ReturnType<F>>(properties: {
4
+ [name: string]: string;
5
+ }, fn: F, thisArg?: ThisParameterType<F>, ...args: A): ReturnType<F>;
6
+ export declare function withProperties<F extends (this: any, ...args: any[]) => any>(properties: {
7
+ [name: string]: string;
8
+ }, fn: F, thisArg?: ThisParameterType<F>): F;
9
+ export declare function setUser(user: {
10
+ id: string;
11
+ email?: string;
12
+ name?: string;
13
+ role?: string;
14
+ plan?: string;
15
+ traits?: Record<string, string>;
16
+ }): void;
17
+ export declare function setOrganization(org: {
18
+ id: string;
19
+ name?: string;
20
+ plan?: string;
21
+ domain?: string;
22
+ traits?: Record<string, string>;
23
+ }): void;
24
+ export declare function setMessageId(id: string): void;
25
+ export declare function callWithUser<A extends unknown[], F extends (...args: A) => ReturnType<F>>(user: {
26
+ id: string;
27
+ email?: string;
28
+ name?: string;
29
+ role?: string;
30
+ plan?: string;
31
+ traits?: Record<string, string>;
32
+ }, fn: F, thisArg?: ThisParameterType<F>, ...args: A): ReturnType<F>;
33
+ export declare function withUser<F extends (this: any, ...args: any[]) => any>(user: {
34
+ id: string;
35
+ email?: string;
36
+ name?: string;
37
+ role?: string;
38
+ plan?: string;
39
+ traits?: Record<string, string>;
40
+ }, fn: F, thisArg?: ThisParameterType<F>): F;
41
+ export declare function callWithOrganization<A extends unknown[], F extends (...args: A) => ReturnType<F>>(org: {
42
+ id: string;
43
+ name?: string;
44
+ plan?: string;
45
+ domain?: string;
46
+ traits?: Record<string, string>;
47
+ }, fn: F, thisArg?: ThisParameterType<F>, ...args: A): ReturnType<F>;
48
+ export declare function withOrganization<F extends (this: any, ...args: any[]) => any>(org: {
49
+ id: string;
50
+ name?: string;
51
+ plan?: string;
52
+ domain?: string;
53
+ traits?: Record<string, string>;
54
+ }, fn: F, thisArg?: ThisParameterType<F>): F;
55
+ export declare function callWithMessageId<A extends unknown[], F extends (...args: A) => ReturnType<F>>(id: string, fn: F, thisArg?: ThisParameterType<F>, ...args: A): ReturnType<F>;
56
+ export declare function withMessageId<F extends (this: any, ...args: any[]) => any>(id: string, fn: F, thisArg?: ThisParameterType<F>): F;
57
+ export interface IMuteOptions {
58
+ input?: boolean;
59
+ output?: boolean;
60
+ tools?: boolean;
61
+ }
62
+ export declare function callWithMute<A extends unknown[], F extends (...args: A) => ReturnType<F>>(options: IMuteOptions, fn: F, thisArg?: ThisParameterType<F>, ...args: A): ReturnType<F>;
63
+ export declare function withMute<F extends (this: any, ...args: any[]) => any>(options: IMuteOptions, fn: F, thisArg?: ThisParameterType<F>): F;
64
+ export declare function withSessionId<F extends (this: any, ...args: any[]) => any>(sessionId: string, fn: F, thisArg?: ThisParameterType<F>, extraProperties?: Record<string, string>): F;
65
+ export declare function callWithSessionId<A extends unknown[], F extends (...args: A) => ReturnType<F>>(sessionId: string, fn: F, thisArg?: ThisParameterType<F>, ...args: A): ReturnType<F>;
66
+ export declare class Session {
67
+ private readonly span;
68
+ private inputs;
69
+ private outputs;
70
+ private inputContexts;
71
+ private outputContexts;
72
+ readonly sessionId: string;
73
+ constructor(sessionId: string, span: Span);
74
+ setInput(text: string | null, context?: Record<string, AttributeValue>): void;
75
+ setOutput(text: string | null, context?: Record<string, AttributeValue>): void;
76
+ setTitle(title: string): void;
77
+ updateProperties(properties: Record<string, AttributeValue>): void;
78
+ setUser(user: {
79
+ id: string;
80
+ email?: string;
81
+ name?: string;
82
+ role?: string;
83
+ plan?: string;
84
+ traits?: Record<string, string>;
85
+ }): void;
86
+ setOrganization(org: {
87
+ id: string;
88
+ name?: string;
89
+ plan?: string;
90
+ domain?: string;
91
+ traits?: Record<string, string>;
92
+ }): void;
93
+ addExternalLink(url: string, options?: {
94
+ title?: string;
95
+ linkType?: string;
96
+ }): void;
97
+ }
98
+ export declare class SessionTitle {
99
+ private readonly span;
100
+ constructor(span: Span);
101
+ setTitle(title: string): void;
102
+ }
103
+ export declare function getActiveSession(): Session | undefined;
104
+ export declare function addExternalLink(url: string, options?: {
105
+ sessionId?: string;
106
+ title?: string;
107
+ linkType?: string;
108
+ }): void;
109
+ export declare function recordFeedback(type: string, options?: {
110
+ score?: number;
111
+ reason?: string;
112
+ comment?: string;
113
+ source?: string;
114
+ messageId?: string;
115
+ sessionId?: string;
116
+ attributes?: Record<string, string>;
117
+ }): void;
118
+ export declare function recordMetric(options: {
119
+ name: string;
120
+ value: number | boolean;
121
+ unit?: string;
122
+ comment?: string;
123
+ attributes?: Record<string, string>;
124
+ polarity?: 'positive' | 'negative';
125
+ minValue?: number;
126
+ maxValue?: number;
127
+ timestamp?: Date;
128
+ sessionId?: string;
129
+ }): void;
130
+ export declare function startSession<T>(sessionId: string, callback: (session: Session) => T, extraProperties?: Record<string, AttributeValue>, options?: {
131
+ mode?: 'default' | 'title';
132
+ }): T;
133
+ export declare function startSessionTitle<T>(callback: (title: SessionTitle) => T, options?: {
134
+ sessionId?: string;
135
+ }): T;
@@ -0,0 +1,17 @@
1
+ import type { SpanExporter } from '@opentelemetry/sdk-trace-base';
2
+ import type { SpanProcessor } from '@opentelemetry/sdk-trace-node';
3
+ import type { IResolvedBrizzConfig } from '../config.js';
4
+ export declare class TracingModule {
5
+ private static instance;
6
+ static getInstance(): TracingModule;
7
+ private spanExporter;
8
+ private spanProcessor;
9
+ private initSpanExporter;
10
+ private initSpanProcessor;
11
+ setup(config: IResolvedBrizzConfig): void;
12
+ getSpanExporter(): SpanExporter;
13
+ getSpanProcessor(): SpanProcessor;
14
+ shutdown(): Promise<void>;
15
+ }
16
+ export declare function getSpanExporter(): SpanExporter;
17
+ export declare function getSpanProcessor(): SpanProcessor;
@@ -0,0 +1 @@
1
+ export declare function getSDKVersion(): string;
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "commonjs"
3
+ }
@@ -0,0 +1,2 @@
1
+ export { createEveSessionProcessor } from './internal/trace/processors/eve-session-processor.js';
2
+ export { createEveTraceExporter, createEveOtelConfig, } from './internal/trace/exporters/eve-trace-exporter.js';
@@ -0,0 +1 @@
1
+ export { instrumentGoogleGenAI } from './internal/instrumentation/google-genai.js';
@@ -0,0 +1,15 @@
1
+ import './internal/instrumentation/auto-init.js';
2
+ export { Brizz, type IBrizzInitializeOptions } from './internal/sdk.js';
3
+ export { type IInstrumentModules, type IMCPManualModules, } from './internal/instrumentation/index.js';
4
+ export { emitEvent, emitEventWithSessionId } from './internal/log/index.js';
5
+ export { getSpanExporter, getSpanProcessor, withSessionId, callWithSessionId, withProperties, callWithProperties, withMute, callWithMute, setCurrentSpanCustomProperties, setUser, setOrganization, setMessageId, withUser, callWithUser, withOrganization, callWithOrganization, withMessageId, callWithMessageId, Session, SessionTitle, startSession, startSessionTitle, getActiveSession, addExternalLink, recordFeedback, recordMetric, } from './internal/trace/index.js';
6
+ export type { IMuteOptions } from './internal/trace/index.js';
7
+ export { getMetricsExporter, getMetricsReader } from './internal/metric/index.js';
8
+ export type { IMaskingConfig, ISpanMaskingConfig, ILogMaskingConfig, IEventMaskingConfig, IEventMaskingRule, MaskingMode, IAttributesMaskingRule, } from './internal/masking/index.js';
9
+ export { DEFAULT_PII_PATTERNS } from './internal/masking/patterns.js';
10
+ export { maskValue, maskAttributes } from './internal/masking/utils.js';
11
+ export { LogLevel, logger, setLogLevel, getLogLevel } from './internal/logger.js';
12
+ export type { ILogger } from './internal/logger.js';
13
+ export { SeverityNumber } from '@opentelemetry/api-logs';
14
+ export type { AttributeValue } from '@opentelemetry/api';
15
+ export type { ReadableSpan } from '@opentelemetry/sdk-trace-base';
@@ -0,0 +1,19 @@
1
+ import type { AttributeValue } from '@opentelemetry/api';
2
+ import type { ReadableSpan } from '@opentelemetry/sdk-trace-base';
3
+ import type { IBrizzInitializeOptions } from '../index.js';
4
+ import type { LogLevel } from './logger.js';
5
+ import type { IMaskingConfig } from './masking/index.js';
6
+ export interface IResolvedBrizzConfig extends Omit<IBrizzInitializeOptions, 'masking'> {
7
+ appName: string;
8
+ baseUrl: string;
9
+ headers: Record<string, string>;
10
+ disableBatch: boolean;
11
+ environment?: string;
12
+ apiKey?: string;
13
+ logLevel: LogLevel;
14
+ masking?: IMaskingConfig;
15
+ resourceAttributes?: Record<string, AttributeValue>;
16
+ beforeSendSpan?: (span: ReadableSpan) => boolean | Promise<boolean>;
17
+ }
18
+ export declare function resolveConfig(options: IBrizzInitializeOptions): IResolvedBrizzConfig;
19
+ export declare function processEnvironmentConfig(options: IBrizzInitializeOptions): IResolvedBrizzConfig;
@@ -0,0 +1,3 @@
1
+ export declare const BRIZZ_SDK_VERSION = "brizz.sdk.version";
2
+ export declare const BRIZZ_SDK_LANGUAGE = "brizz.sdk.language";
3
+ export declare const SDK_LANGUAGE = "typescript";
@@ -0,0 +1,13 @@
1
+ export declare const PLACEHOLDER_SERVICE = "<service-name>";
2
+ export declare const SERVICE_NAME_HEADER = "X-Brizz-Service-Name";
3
+ export interface IParsedDSN {
4
+ scheme: 'http' | 'https';
5
+ host: string;
6
+ bearer: string;
7
+ service: string;
8
+ baseUrl: string;
9
+ }
10
+ export interface IParseDSNOptions {
11
+ allowPlaceholderService?: boolean;
12
+ }
13
+ export declare function parseDSN(dsn: string, options?: IParseDSNOptions): IParsedDSN | null;
@@ -0,0 +1,8 @@
1
+ type TelemetryRegister = (...integrations: unknown[]) => void;
2
+ interface AISdkTelemetryModule {
3
+ registerTelemetry?: TelemetryRegister;
4
+ registerTelemetryIntegration?: TelemetryRegister;
5
+ }
6
+ export declare function selectTelemetryRegister(ai: AISdkTelemetryModule): TelemetryRegister | undefined;
7
+ export declare const autoInstrumentationsLoaded: boolean;
8
+ export {};
@@ -0,0 +1,13 @@
1
+ import type { Instrumentation } from '@opentelemetry/instrumentation';
2
+ interface GoogleGenAIModule {
3
+ GoogleGenAI: new (...args: never[]) => object;
4
+ }
5
+ interface GoogleGenAIInstrumentationConfig {
6
+ exceptionLogger?: (error: Error) => void;
7
+ }
8
+ interface GoogleGenAIInstrumentationLike extends Instrumentation {
9
+ manuallyInstrument(module: GoogleGenAIModule): void;
10
+ }
11
+ export declare const GoogleGenAIInstrumentation: new (config?: GoogleGenAIInstrumentationConfig) => GoogleGenAIInstrumentationLike;
12
+ export declare function instrumentGoogleGenAI<T extends GoogleGenAIModule>(module: T): T['GoogleGenAI'];
13
+ export {};
@@ -0,0 +1,2 @@
1
+ export { InstrumentationRegistry, type IInstrumentModules } from './registry.js';
2
+ export type { IMCPManualModules } from './mcp/types.js';
@@ -0,0 +1,2 @@
1
+ export { MCPInstrumentation, isMCPInstrumentation } from './instrumentation.js';
2
+ export type { IMCPManualModules, IMCPInstrumentationConfig } from './types.js';
@@ -0,0 +1,15 @@
1
+ import { MCPInstrumentation as BaseMCPInstrumentation } from '@arizeai/openinference-instrumentation-mcp';
2
+ import type { Instrumentation, InstrumentationConfig } from '@opentelemetry/instrumentation';
3
+ import type { IMCPManualModules } from './types.js';
4
+ export declare class MCPInstrumentation extends BaseMCPInstrumentation {
5
+ private readonly brizzTracer;
6
+ constructor(_config?: {
7
+ exceptionLogger?: (error: Error) => void;
8
+ instrumentationConfig?: InstrumentationConfig;
9
+ });
10
+ private patchProtocolModule;
11
+ private unpatchProtocolModule;
12
+ protected init(): ReturnType<BaseMCPInstrumentation['init']>;
13
+ manuallyInstrument(modules: IMCPManualModules): void;
14
+ }
15
+ export declare function isMCPInstrumentation(value: unknown): value is Instrumentation;
@@ -0,0 +1,9 @@
1
+ import type { Span } from '@opentelemetry/api';
2
+ import type { IJsonRpcRequest, IProtocolLike } from '../types.js';
3
+ export declare function deriveSpanName(method: string, params?: Record<string, unknown>): string;
4
+ export declare function applyBaseAttributes(span: Span, request: IJsonRpcRequest): void;
5
+ export declare function applyClientRequestAttributes(span: Span, request: IJsonRpcRequest, transportName?: string): void;
6
+ export declare function applyServerRequestAttributes(span: Span, request: IJsonRpcRequest, protocol: IProtocolLike): void;
7
+ export declare function applyResultAttributes(span: Span, method: string, result: unknown): void;
8
+ export declare function applyErrorAttributes(span: Span, err: unknown): void;
9
+ export declare function serializeForAttribute(value: unknown): string;
@@ -0,0 +1,2 @@
1
+ import type { Tracer } from '@opentelemetry/api';
2
+ export declare function patchProtocolPrototype(prototype: unknown, tracer: Tracer): boolean;
@@ -0,0 +1,2 @@
1
+ import type { Tracer } from '@opentelemetry/api';
2
+ export declare function emitSchemaSpansFromListResponse(result: unknown, transportSessionId: string | null | undefined, tracer: Tracer): void;
@@ -0,0 +1,37 @@
1
+ export declare const MCP_TOOL_NAME = "mcp.tool.name";
2
+ export declare const MCP_TOOL_ARGUMENTS = "mcp.tool.arguments";
3
+ export declare const MCP_TOOL_RESULT = "mcp.tool.result";
4
+ export declare const MCP_COMPONENT_TYPE = "mcp.component.type";
5
+ export declare const MCP_COMPONENT_TOOL = "tool";
6
+ export declare const MCP_COMPONENT_TOOL_SCHEMA = "tool_schema";
7
+ export declare const MCP_TOOL_SCHEMA_PARAMETERS = "mcp.tool.schema.parameters";
8
+ export declare const MCP_TOOL_SCHEMA_OUTPUT = "mcp.tool.schema.output";
9
+ export declare const MCP_TOOL_DESCRIPTION = "mcp.tool.description";
10
+ export declare const SPAN_NAME_TOOL_REGISTER = "mcp.tool.register";
11
+ export declare const MCP_METHOD_NAME = "mcp.method.name";
12
+ export declare const MCP_REQUEST_ID = "mcp.request.id";
13
+ export declare const MCP_SESSION_ID = "mcp.session.id";
14
+ export declare const MCP_PROTOCOL_VERSION = "mcp.protocol.version";
15
+ export declare const MCP_RESOURCE_URI = "mcp.resource.uri";
16
+ export declare const MCP_NOTIFICATION_METHOD = "mcp.notification.method";
17
+ export declare const RPC_SYSTEM = "rpc.system";
18
+ export declare const RPC_SYSTEM_MCP = "mcp";
19
+ export declare const RPC_RESPONSE_STATUS_CODE = "rpc.response.status_code";
20
+ export declare const GEN_AI_TOOL_NAME = "gen_ai.tool.name";
21
+ export declare const GEN_AI_PROMPT_NAME = "gen_ai.prompt.name";
22
+ export declare const GEN_AI_OPERATION_NAME = "gen_ai.operation.name";
23
+ export declare const GEN_AI_OPERATION_EXECUTE_TOOL = "execute_tool";
24
+ export declare const NETWORK_TRANSPORT = "network.transport";
25
+ export declare const ERROR_TYPE = "error.type";
26
+ export declare const ERROR_TYPE_TOOL = "tool_error";
27
+ export declare const ERROR_TYPE_TIMEOUT = "timeout";
28
+ export declare const ERROR_TYPE_CANCELLED = "cancelled";
29
+ export declare const JSONRPC_REQUEST_ID = "jsonrpc.request.id";
30
+ export declare const SPAN_NAME_TOOLS_CALL = "tools/call";
31
+ export declare const MAX_ATTRIBUTE_LENGTH: number;
32
+ export declare const TRUNCATION_SUFFIX = "\u2026(truncated)";
33
+ export declare const METHOD_TOOLS_CALL = "tools/call";
34
+ export declare const METHOD_TOOLS_LIST = "tools/list";
35
+ export declare const METHOD_RESOURCES_READ = "resources/read";
36
+ export declare const METHOD_PROMPTS_GET = "prompts/get";
37
+ export declare const METHOD_INITIALIZE = "initialize";
@@ -0,0 +1,6 @@
1
+ import type { Context, Span } from '@opentelemetry/api';
2
+ export interface ISessionAttachResult {
3
+ context: Context;
4
+ sessionId: string | null;
5
+ }
6
+ export declare function stampAndPropagateSession(span: Span, sessionId: string | null | undefined, baseContext?: Context): ISessionAttachResult;
@@ -0,0 +1,47 @@
1
+ export interface IJsonRpcRequest {
2
+ method: string;
3
+ params?: IMessageParams;
4
+ id?: string | number;
5
+ }
6
+ export interface IMessageParams {
7
+ _meta?: IMessageMeta;
8
+ [key: string]: unknown;
9
+ }
10
+ export interface IMessageMeta {
11
+ [key: string]: unknown;
12
+ }
13
+ export interface IJsonRpcResponse {
14
+ jsonrpc: '2.0';
15
+ id?: string | number;
16
+ result?: unknown;
17
+ error?: {
18
+ code?: number;
19
+ message?: string;
20
+ data?: unknown;
21
+ };
22
+ }
23
+ export interface IProtocolLike {
24
+ sessionId?: string;
25
+ _transport?: ITransportLike;
26
+ _requestHandlers?: Map<string, RequestHandler>;
27
+ fallbackRequestHandler?: RequestHandler;
28
+ }
29
+ export interface ITransportLike {
30
+ sessionId?: string;
31
+ constructor?: {
32
+ name?: string;
33
+ };
34
+ }
35
+ export type RequestHandler = (request: unknown, extra: unknown) => unknown;
36
+ export interface IMCPManualModules {
37
+ clientSSEModule?: unknown;
38
+ serverSSEModule?: unknown;
39
+ clientStdioModule?: unknown;
40
+ serverStdioModule?: unknown;
41
+ clientStreamableHTTPModule?: unknown;
42
+ serverStreamableHTTPModule?: unknown;
43
+ protocolModule?: unknown;
44
+ }
45
+ export interface IMCPInstrumentationConfig {
46
+ captureNotifications?: boolean;
47
+ }
@@ -0,0 +1,2 @@
1
+ export declare const INSTRUMENTATION_NAME = "@brizz/sdk/mcp";
2
+ export declare const INSTRUMENTATION_VERSION: string;
@@ -0,0 +1,29 @@
1
+ import type { Instrumentation } from '@opentelemetry/instrumentation';
2
+ import type { IMCPManualModules } from './mcp/types.js';
3
+ export interface IInstrumentModules {
4
+ openAI?: unknown;
5
+ anthropic?: unknown;
6
+ cohere?: unknown;
7
+ google_vertexai?: unknown;
8
+ google_genai?: unknown;
9
+ bedrock?: unknown;
10
+ pinecone?: unknown;
11
+ langchain?: {
12
+ callbackManagerModule?: unknown;
13
+ };
14
+ llamaindex?: unknown;
15
+ chromadb?: unknown;
16
+ qdrant?: unknown;
17
+ together?: unknown;
18
+ mcp?: IMCPManualModules;
19
+ }
20
+ export type { IMCPManualModules } from './mcp/types.js';
21
+ export declare class InstrumentationRegistry {
22
+ private static instance;
23
+ static getInstance(): InstrumentationRegistry;
24
+ private manualModules;
25
+ private loadInstrumentation;
26
+ private loadManualInstrumentations;
27
+ setManualModules(modules: IInstrumentModules): void;
28
+ getManualInstrumentations(): Instrumentation[];
29
+ }
@@ -0,0 +1,11 @@
1
+ import { type Context } from '@opentelemetry/api';
2
+ import type { Span as SdkSpan, SpanProcessor } from '@opentelemetry/sdk-trace-base';
3
+ import type { Telemetry } from 'ai';
4
+ export declare function createInterruptIntegration(): Telemetry;
5
+ export declare class InterruptPropagator implements SpanProcessor {
6
+ onStart(span: SdkSpan, _parentContext: Context): void;
7
+ onEnd(): void;
8
+ shutdown(): Promise<void>;
9
+ forceFlush(): Promise<void>;
10
+ }
11
+ export declare function _resetInterruptState(): void;
@@ -0,0 +1 @@
1
+ export { LoggingModule, emitEvent, emitEventWithSessionId } from './logging.js';
@@ -0,0 +1,21 @@
1
+ import type { LogBody } from '@opentelemetry/api-logs';
2
+ import { SeverityNumber } from '@opentelemetry/api-logs';
3
+ import { LoggerProvider } from '@opentelemetry/sdk-logs';
4
+ import type { IResolvedBrizzConfig } from '../config.js';
5
+ export declare class LoggingModule {
6
+ private static instance;
7
+ static getInstance(): LoggingModule;
8
+ private logExporter;
9
+ private logProcessor;
10
+ private loggerProvider;
11
+ private initLogExporter;
12
+ private initLogProcessor;
13
+ private initLoggerProvider;
14
+ setup(config: IResolvedBrizzConfig): void;
15
+ emitEvent(name: string, attributes?: Record<string, string | number | boolean>, body?: LogBody, severityNumber?: SeverityNumber): void;
16
+ isInitialized(): boolean;
17
+ getLoggerProvider(): LoggerProvider | null;
18
+ shutdown(): Promise<void>;
19
+ }
20
+ export declare function emitEvent(name: string, attributes?: Record<string, string | number | boolean>, body?: LogBody, severityNumber?: SeverityNumber): void;
21
+ export declare function emitEventWithSessionId(sessionId: string, name: string, attributes?: Record<string, string | number | boolean>, body?: LogBody, severityNumber?: SeverityNumber): void;
@@ -0,0 +1,16 @@
1
+ import type { LogRecordExporter, SdkLogRecord } from '@opentelemetry/sdk-logs';
2
+ import { BatchLogRecordProcessor, SimpleLogRecordProcessor } from '@opentelemetry/sdk-logs';
3
+ import type { IResolvedBrizzConfig } from '../../config.js';
4
+ import type { IAttributesMaskingRule, ILogMaskingConfig } from '../../masking/types.js';
5
+ export declare const DEFAULT_LOG_MASKING_RULES: IAttributesMaskingRule[];
6
+ export declare class BrizzSimpleLogRecordProcessor extends SimpleLogRecordProcessor {
7
+ readonly config: IResolvedBrizzConfig;
8
+ constructor(exporter: LogRecordExporter, config: IResolvedBrizzConfig);
9
+ onEmit(logRecord: SdkLogRecord): void;
10
+ }
11
+ export declare class BrizzBatchLogRecordProcessor extends BatchLogRecordProcessor {
12
+ readonly config: IResolvedBrizzConfig;
13
+ constructor(exporter: LogRecordExporter, config: IResolvedBrizzConfig);
14
+ onEmit(logRecord: SdkLogRecord): void;
15
+ }
16
+ export declare function maskLog(logRecord: SdkLogRecord, config: ILogMaskingConfig): SdkLogRecord;
@@ -0,0 +1,23 @@
1
+ import { DiagLogLevel } from '@opentelemetry/api';
2
+ export declare enum LogLevel {
3
+ NONE = 0,
4
+ ERROR = 1,
5
+ WARN = 2,
6
+ INFO = 3,
7
+ DEBUG = 4
8
+ }
9
+ export declare const DEFAULT_LOG_LEVEL = LogLevel.WARN;
10
+ export interface ILogger {
11
+ debug: (msg: string, ...meta: unknown[]) => void;
12
+ info: (msg: string, ...meta: unknown[]) => void;
13
+ warn: (msg: string, ...meta: unknown[]) => void;
14
+ error: (msg: string, ...meta: unknown[]) => void;
15
+ setLevel: (level: LogLevel) => void;
16
+ getLevel: () => LogLevel;
17
+ }
18
+ export declare const noopLogger: ILogger;
19
+ export declare function parseLogLevel(level?: string): LogLevel;
20
+ export declare const logger: ILogger;
21
+ export declare function setLogLevel(level: LogLevel | string): void;
22
+ export declare function getLogLevel(): LogLevel;
23
+ export declare function mapLogLevelToDiagLevel(logLevel: LogLevel): DiagLogLevel;
@@ -0,0 +1,3 @@
1
+ export type { IPatternEntry, MaskingMode, IPatternBasedMaskingRule, ISpanMaskingConfig, IEventMaskingConfig, ILogMaskingConfig, MaskableValue, IMaskingConfig, IEventMaskingRule, IAttributesMaskingRule, } from './types.js';
2
+ export { DEFAULT_PII_PATTERNS } from './patterns.js';
3
+ export { maskValue, maskAttributes } from './utils.js';
@@ -0,0 +1,2 @@
1
+ import type { IPatternEntry } from './types.js';
2
+ export declare const DEFAULT_PII_PATTERNS: IPatternEntry[];
@@ -0,0 +1,32 @@
1
+ export type MaskingMode = 'partial' | 'full';
2
+ export interface IPatternBasedMaskingRule {
3
+ readonly patterns: readonly (IPatternEntry | string)[];
4
+ readonly mode?: MaskingMode;
5
+ }
6
+ export interface IPatternEntry {
7
+ readonly name?: string | undefined;
8
+ readonly pattern: string;
9
+ }
10
+ export interface IAttributesMaskingRule extends IPatternBasedMaskingRule {
11
+ readonly patterns: readonly (IPatternEntry | string)[];
12
+ readonly attributePattern?: string;
13
+ readonly mode?: MaskingMode;
14
+ }
15
+ export interface IEventMaskingRule extends IAttributesMaskingRule {
16
+ readonly eventNamePattern?: string;
17
+ }
18
+ export interface ISpanMaskingConfig {
19
+ readonly disableDefaultRules?: boolean;
20
+ readonly rules?: readonly IAttributesMaskingRule[];
21
+ }
22
+ export interface ILogMaskingConfig {
23
+ readonly disableDefaultRules?: boolean;
24
+ readonly maskBody?: boolean;
25
+ readonly rules?: readonly IAttributesMaskingRule[];
26
+ }
27
+ export type IEventMaskingConfig = ILogMaskingConfig;
28
+ export interface IMaskingConfig {
29
+ readonly spanMasking?: ISpanMaskingConfig;
30
+ readonly eventMasking?: IEventMaskingConfig;
31
+ }
32
+ export type MaskableValue = string | number | boolean | null | undefined | Record<string, unknown> | unknown[];
@@ -0,0 +1,5 @@
1
+ import type { IAttributesMaskingRule, IPatternBasedMaskingRule } from './types.js';
2
+ export declare function maskStringByPattern(value: string, pattern: RegExp, mode?: 'partial' | 'full'): string;
3
+ export declare function maskStringByPatternBasedRule(value: string, rule: IPatternBasedMaskingRule): string;
4
+ export declare function maskValue(value: unknown, rule: IPatternBasedMaskingRule): unknown;
5
+ export declare function maskAttributes(attributes: Record<string, unknown>, rules: readonly IAttributesMaskingRule[], outputOriginalValue?: boolean): Record<string, unknown>;
@@ -0,0 +1 @@
1
+ export { MetricsModule, getMetricsExporter, getMetricsReader } from './metrics.js';
@@ -0,0 +1,17 @@
1
+ import { OTLPMetricExporter } from '@opentelemetry/exporter-metrics-otlp-http';
2
+ import { type MetricReader } from '@opentelemetry/sdk-metrics';
3
+ import type { IResolvedBrizzConfig } from '../config.js';
4
+ export declare class MetricsModule {
5
+ private static instance;
6
+ static getInstance(): MetricsModule;
7
+ private metricsExporter;
8
+ private metricsReader;
9
+ private initMetricsExporter;
10
+ private initMetricsReader;
11
+ setup(config: IResolvedBrizzConfig): void;
12
+ getMetricsExporter(): OTLPMetricExporter;
13
+ getMetricsReader(): MetricReader;
14
+ shutdown(): void;
15
+ }
16
+ export declare function getMetricsExporter(): OTLPMetricExporter;
17
+ export declare function getMetricsReader(): MetricReader;
@@ -0,0 +1,42 @@
1
+ import type { AttributeValue } from '@opentelemetry/api';
2
+ import type { LogRecordExporter } from '@opentelemetry/sdk-logs';
3
+ import type { MetricReader } from '@opentelemetry/sdk-metrics';
4
+ import type { ReadableSpan, SpanExporter } from '@opentelemetry/sdk-trace-base';
5
+ import { type IInstrumentModules } from './instrumentation/index.js';
6
+ import type { LogLevel } from './logger.js';
7
+ import { type IMaskingConfig } from './masking/index.js';
8
+ export interface IBrizzInitializeOptions {
9
+ appName?: string;
10
+ appVersion?: string;
11
+ baseUrl?: string;
12
+ apiKey?: string;
13
+ dsn?: string;
14
+ headers?: Record<string, string>;
15
+ disableBatch?: boolean;
16
+ environment?: string;
17
+ masking?: boolean | IMaskingConfig;
18
+ logLevel?: LogLevel | string;
19
+ instrumentModules?: IInstrumentModules;
20
+ disableNodeSdk?: boolean;
21
+ customSpanExporter?: SpanExporter;
22
+ customLogExporter?: LogRecordExporter;
23
+ customMetricReader?: MetricReader;
24
+ disableSpanExporter?: boolean;
25
+ resourceAttributes?: Record<string, AttributeValue>;
26
+ beforeSendSpan?: (span: ReadableSpan) => boolean | Promise<boolean>;
27
+ }
28
+ export declare class _Brizz {
29
+ private static instance;
30
+ static getInstance(): _Brizz;
31
+ private _initialized;
32
+ private _tracerProvider;
33
+ private _meterProvider;
34
+ private setupInstrumentation;
35
+ private createAndStartProviders;
36
+ private initializeModules;
37
+ private detectModuleSystem;
38
+ private shutdownModules;
39
+ initialize(options: IBrizzInitializeOptions): void;
40
+ shutdown(): Promise<void>;
41
+ }
42
+ export declare const Brizz: _Brizz;