@brizz/sdk 0.1.50 → 0.1.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-STM7QUQP.js → chunk-G6GTIFEQ.js} +1 -1
- package/dist/{chunk-VH5N6E54.cjs → chunk-JSTTHMQ3.cjs} +1 -1
- package/dist/index.cjs +41 -21
- package/dist/index.js +31 -11
- package/dist/{mcp-AOBKXJND.js → mcp-2ZFV5BK5.js} +1 -1
- package/dist/{mcp-3URJU7OY.cjs → mcp-FCUYTDGN.cjs} +11 -11
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -5,7 +5,7 @@ var _chunkUNLNNKZ7cjs = require('./chunk-UNLNNKZ7.cjs');
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _chunkJSTTHMQ3cjs = require('./chunk-JSTTHMQ3.cjs');
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
@@ -104,7 +104,7 @@ var _api = require('@opentelemetry/api');
|
|
|
104
104
|
|
|
105
105
|
// src/internal/instrumentation/langgraph/attributes.ts
|
|
106
106
|
var INSTRUMENTATION_NAME = "@brizz/sdk/langgraph";
|
|
107
|
-
var INSTRUMENTATION_VERSION =
|
|
107
|
+
var INSTRUMENTATION_VERSION = _chunkJSTTHMQ3cjs.getSDKVersion.call(void 0, );
|
|
108
108
|
var MODULE_NAME = "@langchain/langgraph";
|
|
109
109
|
var SUPPORTED_VERSIONS = [">=0.2.0 <2"];
|
|
110
110
|
function isSupportedVersion(version) {
|
|
@@ -468,7 +468,7 @@ function loadGenAIInstrumentations() {
|
|
|
468
468
|
function loadMCPInstrumentation() {
|
|
469
469
|
void (async () => {
|
|
470
470
|
try {
|
|
471
|
-
const { MCPInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("./mcp-
|
|
471
|
+
const { MCPInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("./mcp-FCUYTDGN.cjs")));
|
|
472
472
|
const mcp = new MCPInstrumentation({ exceptionLogger });
|
|
473
473
|
_instrumentation.registerInstrumentations.call(void 0, { instrumentations: [mcp] });
|
|
474
474
|
_chunkWC573FCIcjs.logger.debug("Auto-loaded MCP instrumentation");
|
|
@@ -964,7 +964,7 @@ var InstrumentationRegistry = (_class = class _InstrumentationRegistry {construc
|
|
|
964
964
|
const mcpModules = this.manualModules.mcp;
|
|
965
965
|
void (async () => {
|
|
966
966
|
try {
|
|
967
|
-
const { MCPInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("./mcp-
|
|
967
|
+
const { MCPInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("./mcp-FCUYTDGN.cjs")));
|
|
968
968
|
const instrumentation = new MCPInstrumentation({ exceptionLogger: exceptionLogger2 });
|
|
969
969
|
instrumentation.manuallyInstrument(mcpModules);
|
|
970
970
|
_chunkWC573FCIcjs.logger.debug("Manual instrumentation enabled for MCP");
|
|
@@ -2286,7 +2286,7 @@ var LoggingModule = (_class3 = class _LoggingModule {constructor() { _class3.pro
|
|
|
2286
2286
|
const resourceAttributes = {
|
|
2287
2287
|
...config.resourceAttributes,
|
|
2288
2288
|
"service.name": serviceName,
|
|
2289
|
-
[BRIZZ_SDK_VERSION]:
|
|
2289
|
+
[BRIZZ_SDK_VERSION]: _chunkJSTTHMQ3cjs.getSDKVersion.call(void 0, ),
|
|
2290
2290
|
[BRIZZ_SDK_LANGUAGE]: SDK_LANGUAGE
|
|
2291
2291
|
};
|
|
2292
2292
|
if (config.environment) {
|
|
@@ -2535,7 +2535,7 @@ var BrizzSpanExporter = (_class5 = class {
|
|
|
2535
2535
|
const resourceAttrs = {
|
|
2536
2536
|
...config.resourceAttributes,
|
|
2537
2537
|
"service.name": config.appName,
|
|
2538
|
-
[BRIZZ_SDK_VERSION]:
|
|
2538
|
+
[BRIZZ_SDK_VERSION]: _chunkJSTTHMQ3cjs.getSDKVersion.call(void 0, ),
|
|
2539
2539
|
[BRIZZ_SDK_LANGUAGE]: SDK_LANGUAGE
|
|
2540
2540
|
};
|
|
2541
2541
|
if (config.environment) {
|
|
@@ -2682,9 +2682,27 @@ function applyContextAttributes(span) {
|
|
|
2682
2682
|
}
|
|
2683
2683
|
}
|
|
2684
2684
|
}
|
|
2685
|
+
var LIBRARY_ID_ATTRIBUTES = [
|
|
2686
|
+
"mcp.request.id",
|
|
2687
|
+
"mcp.session.id",
|
|
2688
|
+
"jsonrpc.request.id",
|
|
2689
|
+
"gen_ai.response.id",
|
|
2690
|
+
"ai.response.id",
|
|
2691
|
+
// Session-id aliases the streamer copies into brizz.session.id (sessionIDAliases).
|
|
2692
|
+
"session.id",
|
|
2693
|
+
"langfuse.trace.metadata.session.id",
|
|
2694
|
+
"langfuse.trace.metadata.brizz.session.id",
|
|
2695
|
+
"langsmith.metadata.thread_id",
|
|
2696
|
+
"langsmith.metadata.session_id",
|
|
2697
|
+
"langsmith.metadata.conversation_id",
|
|
2698
|
+
"langsmith.trace.session_id"
|
|
2699
|
+
];
|
|
2700
|
+
var DEFAULT_RULE_ATTRIBUTES = String.raw`^(?!brizz\.(?!session\.(?:input|output)(?:\.context)?$|session\.title$|internal\.intent$)` + `|(?:${LIBRARY_ID_ATTRIBUTES.map((key) => key.replaceAll(".", String.raw`\.`)).join("|")})$)`;
|
|
2701
|
+
var isText = (value) => typeof value === "string" || Array.isArray(value) && value.some((item) => typeof item === "string");
|
|
2685
2702
|
var DEFAULT_MASKING_RULES = [
|
|
2686
2703
|
{
|
|
2687
2704
|
mode: "partial",
|
|
2705
|
+
attributePattern: DEFAULT_RULE_ATTRIBUTES,
|
|
2688
2706
|
patterns: DEFAULT_PII_PATTERNS
|
|
2689
2707
|
}
|
|
2690
2708
|
];
|
|
@@ -2731,17 +2749,19 @@ function maskReadableSpan(span, config) {
|
|
|
2731
2749
|
if (!attrs || Object.keys(attrs).length === 0) {
|
|
2732
2750
|
return;
|
|
2733
2751
|
}
|
|
2734
|
-
let rules = config.rules ? [...config.rules] : [];
|
|
2735
|
-
if (!config.disableDefaultRules) {
|
|
2736
|
-
rules = [...rules, ...DEFAULT_MASKING_RULES];
|
|
2737
|
-
}
|
|
2738
2752
|
try {
|
|
2739
|
-
|
|
2753
|
+
let masked = {};
|
|
2740
2754
|
for (const [k, v] of Object.entries(attrs)) {
|
|
2741
|
-
|
|
2755
|
+
masked[k] = v;
|
|
2756
|
+
}
|
|
2757
|
+
if (_optionalChain([config, 'access', _100 => _100.rules, 'optionalAccess', _101 => _101.length])) {
|
|
2758
|
+
masked = maskAttributes(masked, config.rules);
|
|
2759
|
+
}
|
|
2760
|
+
if (!config.disableDefaultRules) {
|
|
2761
|
+
const text = Object.fromEntries(Object.entries(masked).filter(([k]) => isText(attrs[k])));
|
|
2762
|
+
Object.assign(masked, maskAttributes(text, DEFAULT_MASKING_RULES));
|
|
2742
2763
|
}
|
|
2743
|
-
const
|
|
2744
|
-
const maskedEntries = Object.entries(_nullishCoalesce(masked, () => ( {})));
|
|
2764
|
+
const maskedEntries = Object.entries(masked);
|
|
2745
2765
|
for (const [k, v] of maskedEntries) {
|
|
2746
2766
|
if (attrs[k] !== v) {
|
|
2747
2767
|
attrs[k] = v;
|
|
@@ -2806,7 +2826,7 @@ var TracingModule = (_class6 = class _TracingModule {constructor() { _class6.pro
|
|
|
2806
2826
|
}
|
|
2807
2827
|
_chunkWC573FCIcjs.logger.debug("Initializing span processor", {
|
|
2808
2828
|
disableBatch: config.disableBatch,
|
|
2809
|
-
hasMasking: !!_optionalChain([config, 'access',
|
|
2829
|
+
hasMasking: !!_optionalChain([config, 'access', _102 => _102.masking, 'optionalAccess', _103 => _103.spanMasking])
|
|
2810
2830
|
});
|
|
2811
2831
|
const spanProcessor = config.disableBatch ? new BrizzSimpleSpanProcessor(this.spanExporter, config) : new BrizzBatchSpanProcessor(this.spanExporter, config);
|
|
2812
2832
|
_chunkWC573FCIcjs.logger.debug("Span processor initialized successfully");
|
|
@@ -3026,7 +3046,7 @@ var _Brizz = (_class7 = class __Brizz {constructor() { _class7.prototype.__init1
|
|
|
3026
3046
|
*/
|
|
3027
3047
|
setupInstrumentation(options) {
|
|
3028
3048
|
const registry = InstrumentationRegistry.getInstance();
|
|
3029
|
-
|
|
3049
|
+
_chunkJSTTHMQ3cjs.configure.call(void 0, resolveMcpSessionTracking(options.mcpSessionTracking));
|
|
3030
3050
|
patchInstalledCallbackManager();
|
|
3031
3051
|
patchInstalledLangGraph();
|
|
3032
3052
|
if (options.instrumentModules && Object.keys(options.instrumentModules).length > 0) {
|
|
@@ -3051,7 +3071,7 @@ var _Brizz = (_class7 = class __Brizz {constructor() { _class7.prototype.__init1
|
|
|
3051
3071
|
const resourceAttributes = {
|
|
3052
3072
|
...resolvedConfig.resourceAttributes,
|
|
3053
3073
|
"service.name": resolvedConfig.appName,
|
|
3054
|
-
[BRIZZ_SDK_VERSION]:
|
|
3074
|
+
[BRIZZ_SDK_VERSION]: _chunkJSTTHMQ3cjs.getSDKVersion.call(void 0, ),
|
|
3055
3075
|
[BRIZZ_SDK_LANGUAGE]: SDK_LANGUAGE
|
|
3056
3076
|
};
|
|
3057
3077
|
if (resolvedConfig.environment) {
|
|
@@ -3199,10 +3219,10 @@ var _Brizz = (_class7 = class __Brizz {constructor() { _class7.prototype.__init1
|
|
|
3199
3219
|
}
|
|
3200
3220
|
try {
|
|
3201
3221
|
await this.shutdownModules();
|
|
3202
|
-
await _optionalChain([this, 'access',
|
|
3203
|
-
await _optionalChain([this, 'access',
|
|
3204
|
-
await _optionalChain([this, 'access',
|
|
3205
|
-
await _optionalChain([this, 'access',
|
|
3222
|
+
await _optionalChain([this, 'access', _104 => _104._tracerProvider, 'optionalAccess', _105 => _105.forceFlush, 'call', _106 => _106()]);
|
|
3223
|
+
await _optionalChain([this, 'access', _107 => _107._tracerProvider, 'optionalAccess', _108 => _108.shutdown, 'call', _109 => _109()]);
|
|
3224
|
+
await _optionalChain([this, 'access', _110 => _110._meterProvider, 'optionalAccess', _111 => _111.forceFlush, 'call', _112 => _112()]);
|
|
3225
|
+
await _optionalChain([this, 'access', _113 => _113._meterProvider, 'optionalAccess', _114 => _114.shutdown, 'call', _115 => _115()]);
|
|
3206
3226
|
this._initialized = false;
|
|
3207
3227
|
this._tracerProvider = null;
|
|
3208
3228
|
this._meterProvider = null;
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
import {
|
|
6
6
|
configure,
|
|
7
7
|
getSDKVersion
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-G6GTIFEQ.js";
|
|
9
9
|
import {
|
|
10
10
|
DEFAULT_LOG_LEVEL,
|
|
11
11
|
LogLevel,
|
|
@@ -468,7 +468,7 @@ function loadGenAIInstrumentations() {
|
|
|
468
468
|
function loadMCPInstrumentation() {
|
|
469
469
|
void (async () => {
|
|
470
470
|
try {
|
|
471
|
-
const { MCPInstrumentation } = await import("./mcp-
|
|
471
|
+
const { MCPInstrumentation } = await import("./mcp-2ZFV5BK5.js");
|
|
472
472
|
const mcp = new MCPInstrumentation({ exceptionLogger });
|
|
473
473
|
registerInstrumentations({ instrumentations: [mcp] });
|
|
474
474
|
logger.debug("Auto-loaded MCP instrumentation");
|
|
@@ -964,7 +964,7 @@ var InstrumentationRegistry = class _InstrumentationRegistry {
|
|
|
964
964
|
const mcpModules = this.manualModules.mcp;
|
|
965
965
|
void (async () => {
|
|
966
966
|
try {
|
|
967
|
-
const { MCPInstrumentation } = await import("./mcp-
|
|
967
|
+
const { MCPInstrumentation } = await import("./mcp-2ZFV5BK5.js");
|
|
968
968
|
const instrumentation = new MCPInstrumentation({ exceptionLogger: exceptionLogger2 });
|
|
969
969
|
instrumentation.manuallyInstrument(mcpModules);
|
|
970
970
|
logger.debug("Manual instrumentation enabled for MCP");
|
|
@@ -2682,9 +2682,27 @@ function applyContextAttributes(span) {
|
|
|
2682
2682
|
}
|
|
2683
2683
|
}
|
|
2684
2684
|
}
|
|
2685
|
+
var LIBRARY_ID_ATTRIBUTES = [
|
|
2686
|
+
"mcp.request.id",
|
|
2687
|
+
"mcp.session.id",
|
|
2688
|
+
"jsonrpc.request.id",
|
|
2689
|
+
"gen_ai.response.id",
|
|
2690
|
+
"ai.response.id",
|
|
2691
|
+
// Session-id aliases the streamer copies into brizz.session.id (sessionIDAliases).
|
|
2692
|
+
"session.id",
|
|
2693
|
+
"langfuse.trace.metadata.session.id",
|
|
2694
|
+
"langfuse.trace.metadata.brizz.session.id",
|
|
2695
|
+
"langsmith.metadata.thread_id",
|
|
2696
|
+
"langsmith.metadata.session_id",
|
|
2697
|
+
"langsmith.metadata.conversation_id",
|
|
2698
|
+
"langsmith.trace.session_id"
|
|
2699
|
+
];
|
|
2700
|
+
var DEFAULT_RULE_ATTRIBUTES = String.raw`^(?!brizz\.(?!session\.(?:input|output)(?:\.context)?$|session\.title$|internal\.intent$)` + `|(?:${LIBRARY_ID_ATTRIBUTES.map((key) => key.replaceAll(".", String.raw`\.`)).join("|")})$)`;
|
|
2701
|
+
var isText = (value) => typeof value === "string" || Array.isArray(value) && value.some((item) => typeof item === "string");
|
|
2685
2702
|
var DEFAULT_MASKING_RULES = [
|
|
2686
2703
|
{
|
|
2687
2704
|
mode: "partial",
|
|
2705
|
+
attributePattern: DEFAULT_RULE_ATTRIBUTES,
|
|
2688
2706
|
patterns: DEFAULT_PII_PATTERNS
|
|
2689
2707
|
}
|
|
2690
2708
|
];
|
|
@@ -2731,17 +2749,19 @@ function maskReadableSpan(span, config) {
|
|
|
2731
2749
|
if (!attrs || Object.keys(attrs).length === 0) {
|
|
2732
2750
|
return;
|
|
2733
2751
|
}
|
|
2734
|
-
let rules = config.rules ? [...config.rules] : [];
|
|
2735
|
-
if (!config.disableDefaultRules) {
|
|
2736
|
-
rules = [...rules, ...DEFAULT_MASKING_RULES];
|
|
2737
|
-
}
|
|
2738
2752
|
try {
|
|
2739
|
-
|
|
2753
|
+
let masked = {};
|
|
2740
2754
|
for (const [k, v] of Object.entries(attrs)) {
|
|
2741
|
-
|
|
2755
|
+
masked[k] = v;
|
|
2756
|
+
}
|
|
2757
|
+
if (config.rules?.length) {
|
|
2758
|
+
masked = maskAttributes(masked, config.rules);
|
|
2759
|
+
}
|
|
2760
|
+
if (!config.disableDefaultRules) {
|
|
2761
|
+
const text = Object.fromEntries(Object.entries(masked).filter(([k]) => isText(attrs[k])));
|
|
2762
|
+
Object.assign(masked, maskAttributes(text, DEFAULT_MASKING_RULES));
|
|
2742
2763
|
}
|
|
2743
|
-
const
|
|
2744
|
-
const maskedEntries = Object.entries(masked ?? {});
|
|
2764
|
+
const maskedEntries = Object.entries(masked);
|
|
2745
2765
|
for (const [k, v] of maskedEntries) {
|
|
2746
2766
|
if (attrs[k] !== v) {
|
|
2747
2767
|
attrs[k] = v;
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
var
|
|
11
|
+
var _chunkJSTTHMQ3cjs = require('./chunk-JSTTHMQ3.cjs');
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
var _chunkWC573FCIcjs = require('./chunk-WC573FCI.cjs');
|
|
@@ -387,14 +387,14 @@ function wrapOnRequest(original, tracer) {
|
|
|
387
387
|
return original.apply(this, args);
|
|
388
388
|
}
|
|
389
389
|
const method = request.method;
|
|
390
|
-
if (method === METHOD_TOOLS_CALL &&
|
|
390
|
+
if (method === METHOD_TOOLS_CALL && _chunkJSTTHMQ3cjs.isSessionToolCall.call(void 0, request)) {
|
|
391
391
|
return answerSessionToolCall(this, request, tracer, args, original);
|
|
392
392
|
}
|
|
393
393
|
const handler = _nullishCoalesce(handlers.get(method), () => ( this.fallbackRequestHandler));
|
|
394
394
|
if (!handler) {
|
|
395
395
|
return original.apply(this, args);
|
|
396
396
|
}
|
|
397
|
-
const tracking =
|
|
397
|
+
const tracking = _chunkJSTTHMQ3cjs.isEnabled.call(void 0, ) && method === METHOD_TOOLS_CALL ? _chunkJSTTHMQ3cjs.popTrackingArguments.call(void 0, request) : {};
|
|
398
398
|
const started = safeStartServerSpan(tracer, request, this, tracking);
|
|
399
399
|
if (!started) {
|
|
400
400
|
return original.apply(this, args);
|
|
@@ -404,9 +404,9 @@ function wrapOnRequest(original, tracer) {
|
|
|
404
404
|
if (method === METHOD_TOOLS_LIST) {
|
|
405
405
|
hooks.onResult = (result) => {
|
|
406
406
|
let advertised = result;
|
|
407
|
-
if (
|
|
407
|
+
if (_chunkJSTTHMQ3cjs.isEnabled.call(void 0, )) {
|
|
408
408
|
try {
|
|
409
|
-
advertised =
|
|
409
|
+
advertised = _chunkJSTTHMQ3cjs.patchListToolsResult.call(void 0, result);
|
|
410
410
|
} catch (error) {
|
|
411
411
|
_chunkWC573FCIcjs.logger.warn(
|
|
412
412
|
`Brizz MCP: failed to patch tools/list schemas: ${String(error)}`
|
|
@@ -417,7 +417,7 @@ function wrapOnRequest(original, tracer) {
|
|
|
417
417
|
try {
|
|
418
418
|
emitSchemaSpansFromListResponse(
|
|
419
419
|
advertised,
|
|
420
|
-
|
|
420
|
+
_chunkJSTTHMQ3cjs.resolveTransportSessionId.call(void 0, this),
|
|
421
421
|
tracer
|
|
422
422
|
);
|
|
423
423
|
} catch (error) {
|
|
@@ -430,7 +430,7 @@ function wrapOnRequest(original, tracer) {
|
|
|
430
430
|
}
|
|
431
431
|
if (method !== METHOD_TOOLS_CALL) {
|
|
432
432
|
hooks.onError = () => {
|
|
433
|
-
|
|
433
|
+
_chunkJSTTHMQ3cjs.stampAndPropagateSession.call(void 0, span, _chunkJSTTHMQ3cjs.resolveSessionId.call(void 0, this, spanCtx), spanCtx);
|
|
434
434
|
};
|
|
435
435
|
}
|
|
436
436
|
const wrappedHandler = (req, extra) => _api.context.with(
|
|
@@ -464,7 +464,7 @@ function answerSessionToolCall(protocol, request, tracer, args, original) {
|
|
|
464
464
|
if (!handlers) {
|
|
465
465
|
return original.apply(protocol, args);
|
|
466
466
|
}
|
|
467
|
-
const { id, result } =
|
|
467
|
+
const { id, result } = _chunkJSTTHMQ3cjs.sessionToolResult.call(void 0, );
|
|
468
468
|
const started = safeStartServerSpan(tracer, request, protocol, { sessionId: id });
|
|
469
469
|
const handler = () => started ? _api.context.with(started.spanCtx, () => result) : result;
|
|
470
470
|
const hadEntry = handlers.has(METHOD_TOOLS_CALL);
|
|
@@ -554,8 +554,8 @@ function safeStartServerSpan(tracer, request, protocol, tracking = {}) {
|
|
|
554
554
|
parentCtx
|
|
555
555
|
);
|
|
556
556
|
applyServerRequestAttributes(span, request, protocol);
|
|
557
|
-
const resolved = request.method === METHOD_TOOLS_CALL ? _nullishCoalesce(tracking.sessionId, () => (
|
|
558
|
-
const { context: sessCtx } =
|
|
557
|
+
const resolved = request.method === METHOD_TOOLS_CALL ? _nullishCoalesce(tracking.sessionId, () => ( _chunkJSTTHMQ3cjs.resolveSessionId.call(void 0, protocol, parentCtx))) : void 0;
|
|
558
|
+
const { context: sessCtx } = _chunkJSTTHMQ3cjs.stampAndPropagateSession.call(void 0,
|
|
559
559
|
span,
|
|
560
560
|
resolved,
|
|
561
561
|
parentCtx,
|
|
@@ -611,7 +611,7 @@ function safeEnd(span) {
|
|
|
611
611
|
|
|
612
612
|
// src/internal/instrumentation/mcp/version.ts
|
|
613
613
|
var INSTRUMENTATION_NAME = "@brizz/sdk/mcp";
|
|
614
|
-
var INSTRUMENTATION_VERSION =
|
|
614
|
+
var INSTRUMENTATION_VERSION = _chunkJSTTHMQ3cjs.getSDKVersion.call(void 0, );
|
|
615
615
|
|
|
616
616
|
// src/internal/instrumentation/mcp/instrumentation.ts
|
|
617
617
|
var PROTOCOL_MODULE_NAME = "@modelcontextprotocol/sdk/shared/protocol.js";
|