@brizz/sdk 0.1.42 → 0.1.43

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.
@@ -0,0 +1,240 @@
1
+ import {
2
+ logger
3
+ } from "./chunk-Y4HNUX3Q.js";
4
+ import {
5
+ BRIZZ,
6
+ PROPERTIES_CONTEXT_KEY,
7
+ SESSION_ID
8
+ } from "./chunk-Y7NMZAQT.js";
9
+
10
+ // src/internal/instrumentation/mcp/session.ts
11
+ import { context } from "@opentelemetry/api";
12
+ var INTENT_PROPERTY = "internal.intent";
13
+ var FALLBACK_SESSION_ID = /* @__PURE__ */ Symbol("brizz.mcp.fallback-session-id");
14
+ var FALLBACK_SESSION_ID_BYTES = 16;
15
+ function generateSessionId() {
16
+ let id = "";
17
+ for (let i = 0; i < FALLBACK_SESSION_ID_BYTES; i++) {
18
+ id += Math.floor(Math.random() * 256).toString(16).padStart(2, "0");
19
+ }
20
+ return id;
21
+ }
22
+ function isSessionCarrier(value) {
23
+ return typeof value === "object" && value !== null;
24
+ }
25
+ function resolveTransportSessionId(protocol) {
26
+ if (!isSessionCarrier(protocol)) {
27
+ return void 0;
28
+ }
29
+ return protocol.sessionId ?? protocol._transport?.sessionId;
30
+ }
31
+ function resolveSessionId(protocol, baseContext) {
32
+ if (!isSessionCarrier(protocol)) {
33
+ return void 0;
34
+ }
35
+ const fromTransport = resolveTransportSessionId(protocol);
36
+ if (fromTransport) {
37
+ return fromTransport;
38
+ }
39
+ try {
40
+ const bound = baseContext.getValue(PROPERTIES_CONTEXT_KEY);
41
+ if (bound?.[SESSION_ID]) {
42
+ return void 0;
43
+ }
44
+ } catch {
45
+ }
46
+ protocol[FALLBACK_SESSION_ID] ??= generateSessionId();
47
+ return protocol[FALLBACK_SESSION_ID];
48
+ }
49
+ function stampAndPropagateSession(span, sessionId, baseContext = context.active(), intent) {
50
+ if (!sessionId && !intent) {
51
+ return { context: baseContext, sessionId: null };
52
+ }
53
+ const properties = {};
54
+ if (sessionId) {
55
+ properties[SESSION_ID] = sessionId;
56
+ }
57
+ if (intent) {
58
+ properties[INTENT_PROPERTY] = intent;
59
+ }
60
+ if (span.isRecording()) {
61
+ for (const [key, value] of Object.entries(properties)) {
62
+ try {
63
+ span.setAttribute(`${BRIZZ}.${key}`, value);
64
+ } catch (error) {
65
+ logger.warn(`Brizz MCP: failed to stamp ${key} on span: ${String(error)}`);
66
+ }
67
+ }
68
+ }
69
+ try {
70
+ const prev = baseContext.getValue(PROPERTIES_CONTEXT_KEY);
71
+ const merged = prev ? { ...prev, ...properties } : properties;
72
+ return {
73
+ context: baseContext.setValue(PROPERTIES_CONTEXT_KEY, merged),
74
+ sessionId: sessionId ?? null
75
+ };
76
+ } catch (error) {
77
+ logger.warn(`Brizz MCP: failed to attach session context: ${String(error)}`);
78
+ return { context: baseContext, sessionId: sessionId ?? null };
79
+ }
80
+ }
81
+
82
+ // src/internal/instrumentation/mcp/client-session.ts
83
+ var DEFAULT_SESSION_PARAM = "brizz_mcp_session_id";
84
+ var DEFAULT_SESSION_TOOL_NAME = "brizz_start_session";
85
+ var INTENT_PARAM = "brizz_intent";
86
+ var INTENT_PARAM_DESCRIPTION = "Short natural-language description of what the user is ultimately trying to accomplish with this call. Repeat the same intent across the calls that serve one goal; change it when the goal changes.";
87
+ var enabled = false;
88
+ var intentEnabled = true;
89
+ var sessionParamName = DEFAULT_SESSION_PARAM;
90
+ var sessionToolName = DEFAULT_SESSION_TOOL_NAME;
91
+ var nameTakenByServer = false;
92
+ function configure(config) {
93
+ if (typeof config === "boolean" || config === void 0) {
94
+ enabled = config === true;
95
+ intentEnabled = true;
96
+ sessionParamName = DEFAULT_SESSION_PARAM;
97
+ sessionToolName = DEFAULT_SESSION_TOOL_NAME;
98
+ nameTakenByServer = false;
99
+ return;
100
+ }
101
+ enabled = config.enabled === true;
102
+ intentEnabled = config.intent !== false;
103
+ sessionParamName = config.sessionParamName?.trim() || DEFAULT_SESSION_PARAM;
104
+ sessionToolName = config.sessionToolName?.trim() || DEFAULT_SESSION_TOOL_NAME;
105
+ nameTakenByServer = false;
106
+ }
107
+ function isEnabled() {
108
+ return enabled;
109
+ }
110
+ function sessionParamDescription() {
111
+ return `Conversation-continuity token for this MCP server. Call \`${sessionToolName}\` once at the start of the conversation to obtain it, then send that same value on EVERY later call. If you already have one from earlier in this conversation, reuse it \u2014 do not call \`${sessionToolName}\` again, and never make up your own value.`;
112
+ }
113
+ function sessionToolDescription() {
114
+ return "Obtain the session id required by every other tool on this server. Call this ONCE, before your first other tool call, and reuse the value it returns for the whole conversation. If you have already called it in this conversation, do not call it again \u2014 reuse the value you were given.";
115
+ }
116
+ function sessionToolEntry() {
117
+ return {
118
+ name: sessionToolName,
119
+ description: sessionToolDescription(),
120
+ inputSchema: { type: "object", properties: {}, required: [] }
121
+ };
122
+ }
123
+ function isSessionToolCall(request) {
124
+ if (!enabled || nameTakenByServer || !request || typeof request !== "object") {
125
+ return false;
126
+ }
127
+ const params = request.params;
128
+ return params?.name === sessionToolName;
129
+ }
130
+ function sessionToolResult() {
131
+ const id = generateSessionId();
132
+ return { id, result: { content: [{ type: "text", text: id }] } };
133
+ }
134
+ function patchSchema(schema) {
135
+ const base = schema && typeof schema === "object" ? { ...schema } : {};
136
+ base["type"] = base["type"] ?? "object";
137
+ const properties = base["properties"] && typeof base["properties"] === "object" ? { ...base["properties"] } : {};
138
+ properties[sessionParamName] = { type: "string", description: sessionParamDescription() };
139
+ if (intentEnabled) {
140
+ properties[INTENT_PARAM] = { type: "string", description: INTENT_PARAM_DESCRIPTION };
141
+ }
142
+ base["properties"] = properties;
143
+ const required = Array.isArray(base["required"]) ? [...base["required"]] : [];
144
+ if (!required.includes(sessionParamName)) {
145
+ required.push(sessionParamName);
146
+ }
147
+ if (base["additionalProperties"] === false && intentEnabled && !required.includes(INTENT_PARAM)) {
148
+ required.push(INTENT_PARAM);
149
+ }
150
+ base["required"] = required;
151
+ return base;
152
+ }
153
+ function preamble() {
154
+ const intentHint = intentEnabled ? ` Optionally pass \`${INTENT_PARAM}\` describing the user's goal.` : "";
155
+ return `[Session tracking] This server requires \`${sessionParamName}\` on every call \u2014 call \`${sessionToolName}\` once to get it, then reuse that value.${intentHint}
156
+
157
+ `;
158
+ }
159
+ function patchListToolsResult(result) {
160
+ if (!result || typeof result !== "object") {
161
+ return result;
162
+ }
163
+ const tools = result.tools;
164
+ if (!Array.isArray(tools)) {
165
+ return result;
166
+ }
167
+ if (tools.some((t) => t?.name === sessionToolName)) {
168
+ if (!nameTakenByServer) {
169
+ nameTakenByServer = true;
170
+ logger.error(
171
+ `Brizz MCP: this server already publishes a tool named "${sessionToolName}", so Brizz cannot issue session ids through it. Session tracking is off. Set sessionToolName to a free name.`
172
+ );
173
+ }
174
+ return result;
175
+ }
176
+ const patched = tools.map((tool) => {
177
+ if (!tool || typeof tool !== "object") {
178
+ return tool;
179
+ }
180
+ try {
181
+ const entry = tool;
182
+ return {
183
+ ...entry,
184
+ inputSchema: patchSchema(entry["inputSchema"]),
185
+ description: preamble() + String(entry["description"] ?? "")
186
+ };
187
+ } catch (error) {
188
+ logger.warn(`Brizz MCP: could not patch tool schema, advertising it unchanged: ${String(error)}`);
189
+ return tool;
190
+ }
191
+ });
192
+ return {
193
+ ...result,
194
+ tools: [...patched, sessionToolEntry()]
195
+ };
196
+ }
197
+ function popTrackingArguments(request) {
198
+ if (!request || typeof request !== "object") {
199
+ return {};
200
+ }
201
+ const params = request.params;
202
+ if (!params || typeof params !== "object") {
203
+ return {};
204
+ }
205
+ const args = params.arguments;
206
+ if (!args || typeof args !== "object") {
207
+ return {};
208
+ }
209
+ const bag = args;
210
+ const sessionId = bag[sessionParamName];
211
+ const intent = bag[INTENT_PARAM];
212
+ delete bag[sessionParamName];
213
+ delete bag[INTENT_PARAM];
214
+ const tracking = {};
215
+ if (typeof sessionId === "string" && sessionId) {
216
+ tracking.sessionId = sessionId;
217
+ }
218
+ if (intentEnabled && typeof intent === "string" && intent) {
219
+ tracking.intent = intent;
220
+ }
221
+ return tracking;
222
+ }
223
+
224
+ // src/internal/version.ts
225
+ function getSDKVersion() {
226
+ return "0.1.43";
227
+ }
228
+
229
+ export {
230
+ resolveTransportSessionId,
231
+ resolveSessionId,
232
+ stampAndPropagateSession,
233
+ configure,
234
+ isEnabled,
235
+ isSessionToolCall,
236
+ sessionToolResult,
237
+ patchListToolsResult,
238
+ popTrackingArguments,
239
+ getSDKVersion
240
+ };
@@ -0,0 +1,240 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
+
3
+ var _chunkWC573FCIcjs = require('./chunk-WC573FCI.cjs');
4
+
5
+
6
+
7
+
8
+ var _chunkFORVS4QWcjs = require('./chunk-FORVS4QW.cjs');
9
+
10
+ // src/internal/instrumentation/mcp/session.ts
11
+ var _api = require('@opentelemetry/api');
12
+ var INTENT_PROPERTY = "internal.intent";
13
+ var FALLBACK_SESSION_ID = /* @__PURE__ */ Symbol("brizz.mcp.fallback-session-id");
14
+ var FALLBACK_SESSION_ID_BYTES = 16;
15
+ function generateSessionId() {
16
+ let id = "";
17
+ for (let i = 0; i < FALLBACK_SESSION_ID_BYTES; i++) {
18
+ id += Math.floor(Math.random() * 256).toString(16).padStart(2, "0");
19
+ }
20
+ return id;
21
+ }
22
+ function isSessionCarrier(value) {
23
+ return typeof value === "object" && value !== null;
24
+ }
25
+ function resolveTransportSessionId(protocol) {
26
+ if (!isSessionCarrier(protocol)) {
27
+ return void 0;
28
+ }
29
+ return _nullishCoalesce(protocol.sessionId, () => ( _optionalChain([protocol, 'access', _ => _._transport, 'optionalAccess', _2 => _2.sessionId])));
30
+ }
31
+ function resolveSessionId(protocol, baseContext) {
32
+ if (!isSessionCarrier(protocol)) {
33
+ return void 0;
34
+ }
35
+ const fromTransport = resolveTransportSessionId(protocol);
36
+ if (fromTransport) {
37
+ return fromTransport;
38
+ }
39
+ try {
40
+ const bound = baseContext.getValue(_chunkFORVS4QWcjs.PROPERTIES_CONTEXT_KEY);
41
+ if (_optionalChain([bound, 'optionalAccess', _3 => _3[_chunkFORVS4QWcjs.SESSION_ID]])) {
42
+ return void 0;
43
+ }
44
+ } catch (e) {
45
+ }
46
+ protocol[FALLBACK_SESSION_ID] ??= generateSessionId();
47
+ return protocol[FALLBACK_SESSION_ID];
48
+ }
49
+ function stampAndPropagateSession(span, sessionId, baseContext = _api.context.active(), intent) {
50
+ if (!sessionId && !intent) {
51
+ return { context: baseContext, sessionId: null };
52
+ }
53
+ const properties = {};
54
+ if (sessionId) {
55
+ properties[_chunkFORVS4QWcjs.SESSION_ID] = sessionId;
56
+ }
57
+ if (intent) {
58
+ properties[INTENT_PROPERTY] = intent;
59
+ }
60
+ if (span.isRecording()) {
61
+ for (const [key, value] of Object.entries(properties)) {
62
+ try {
63
+ span.setAttribute(`${_chunkFORVS4QWcjs.BRIZZ}.${key}`, value);
64
+ } catch (error) {
65
+ _chunkWC573FCIcjs.logger.warn(`Brizz MCP: failed to stamp ${key} on span: ${String(error)}`);
66
+ }
67
+ }
68
+ }
69
+ try {
70
+ const prev = baseContext.getValue(_chunkFORVS4QWcjs.PROPERTIES_CONTEXT_KEY);
71
+ const merged = prev ? { ...prev, ...properties } : properties;
72
+ return {
73
+ context: baseContext.setValue(_chunkFORVS4QWcjs.PROPERTIES_CONTEXT_KEY, merged),
74
+ sessionId: _nullishCoalesce(sessionId, () => ( null))
75
+ };
76
+ } catch (error) {
77
+ _chunkWC573FCIcjs.logger.warn(`Brizz MCP: failed to attach session context: ${String(error)}`);
78
+ return { context: baseContext, sessionId: _nullishCoalesce(sessionId, () => ( null)) };
79
+ }
80
+ }
81
+
82
+ // src/internal/instrumentation/mcp/client-session.ts
83
+ var DEFAULT_SESSION_PARAM = "brizz_mcp_session_id";
84
+ var DEFAULT_SESSION_TOOL_NAME = "brizz_start_session";
85
+ var INTENT_PARAM = "brizz_intent";
86
+ var INTENT_PARAM_DESCRIPTION = "Short natural-language description of what the user is ultimately trying to accomplish with this call. Repeat the same intent across the calls that serve one goal; change it when the goal changes.";
87
+ var enabled = false;
88
+ var intentEnabled = true;
89
+ var sessionParamName = DEFAULT_SESSION_PARAM;
90
+ var sessionToolName = DEFAULT_SESSION_TOOL_NAME;
91
+ var nameTakenByServer = false;
92
+ function configure(config) {
93
+ if (typeof config === "boolean" || config === void 0) {
94
+ enabled = config === true;
95
+ intentEnabled = true;
96
+ sessionParamName = DEFAULT_SESSION_PARAM;
97
+ sessionToolName = DEFAULT_SESSION_TOOL_NAME;
98
+ nameTakenByServer = false;
99
+ return;
100
+ }
101
+ enabled = config.enabled === true;
102
+ intentEnabled = config.intent !== false;
103
+ sessionParamName = _optionalChain([config, 'access', _4 => _4.sessionParamName, 'optionalAccess', _5 => _5.trim, 'call', _6 => _6()]) || DEFAULT_SESSION_PARAM;
104
+ sessionToolName = _optionalChain([config, 'access', _7 => _7.sessionToolName, 'optionalAccess', _8 => _8.trim, 'call', _9 => _9()]) || DEFAULT_SESSION_TOOL_NAME;
105
+ nameTakenByServer = false;
106
+ }
107
+ function isEnabled() {
108
+ return enabled;
109
+ }
110
+ function sessionParamDescription() {
111
+ return `Conversation-continuity token for this MCP server. Call \`${sessionToolName}\` once at the start of the conversation to obtain it, then send that same value on EVERY later call. If you already have one from earlier in this conversation, reuse it \u2014 do not call \`${sessionToolName}\` again, and never make up your own value.`;
112
+ }
113
+ function sessionToolDescription() {
114
+ return "Obtain the session id required by every other tool on this server. Call this ONCE, before your first other tool call, and reuse the value it returns for the whole conversation. If you have already called it in this conversation, do not call it again \u2014 reuse the value you were given.";
115
+ }
116
+ function sessionToolEntry() {
117
+ return {
118
+ name: sessionToolName,
119
+ description: sessionToolDescription(),
120
+ inputSchema: { type: "object", properties: {}, required: [] }
121
+ };
122
+ }
123
+ function isSessionToolCall(request) {
124
+ if (!enabled || nameTakenByServer || !request || typeof request !== "object") {
125
+ return false;
126
+ }
127
+ const params = request.params;
128
+ return _optionalChain([params, 'optionalAccess', _10 => _10.name]) === sessionToolName;
129
+ }
130
+ function sessionToolResult() {
131
+ const id = generateSessionId();
132
+ return { id, result: { content: [{ type: "text", text: id }] } };
133
+ }
134
+ function patchSchema(schema) {
135
+ const base = schema && typeof schema === "object" ? { ...schema } : {};
136
+ base["type"] = _nullishCoalesce(base["type"], () => ( "object"));
137
+ const properties = base["properties"] && typeof base["properties"] === "object" ? { ...base["properties"] } : {};
138
+ properties[sessionParamName] = { type: "string", description: sessionParamDescription() };
139
+ if (intentEnabled) {
140
+ properties[INTENT_PARAM] = { type: "string", description: INTENT_PARAM_DESCRIPTION };
141
+ }
142
+ base["properties"] = properties;
143
+ const required = Array.isArray(base["required"]) ? [...base["required"]] : [];
144
+ if (!required.includes(sessionParamName)) {
145
+ required.push(sessionParamName);
146
+ }
147
+ if (base["additionalProperties"] === false && intentEnabled && !required.includes(INTENT_PARAM)) {
148
+ required.push(INTENT_PARAM);
149
+ }
150
+ base["required"] = required;
151
+ return base;
152
+ }
153
+ function preamble() {
154
+ const intentHint = intentEnabled ? ` Optionally pass \`${INTENT_PARAM}\` describing the user's goal.` : "";
155
+ return `[Session tracking] This server requires \`${sessionParamName}\` on every call \u2014 call \`${sessionToolName}\` once to get it, then reuse that value.${intentHint}
156
+
157
+ `;
158
+ }
159
+ function patchListToolsResult(result) {
160
+ if (!result || typeof result !== "object") {
161
+ return result;
162
+ }
163
+ const tools = result.tools;
164
+ if (!Array.isArray(tools)) {
165
+ return result;
166
+ }
167
+ if (tools.some((t) => _optionalChain([t, 'optionalAccess', _11 => _11.name]) === sessionToolName)) {
168
+ if (!nameTakenByServer) {
169
+ nameTakenByServer = true;
170
+ _chunkWC573FCIcjs.logger.error(
171
+ `Brizz MCP: this server already publishes a tool named "${sessionToolName}", so Brizz cannot issue session ids through it. Session tracking is off. Set sessionToolName to a free name.`
172
+ );
173
+ }
174
+ return result;
175
+ }
176
+ const patched = tools.map((tool) => {
177
+ if (!tool || typeof tool !== "object") {
178
+ return tool;
179
+ }
180
+ try {
181
+ const entry = tool;
182
+ return {
183
+ ...entry,
184
+ inputSchema: patchSchema(entry["inputSchema"]),
185
+ description: preamble() + String(_nullishCoalesce(entry["description"], () => ( "")))
186
+ };
187
+ } catch (error) {
188
+ _chunkWC573FCIcjs.logger.warn(`Brizz MCP: could not patch tool schema, advertising it unchanged: ${String(error)}`);
189
+ return tool;
190
+ }
191
+ });
192
+ return {
193
+ ...result,
194
+ tools: [...patched, sessionToolEntry()]
195
+ };
196
+ }
197
+ function popTrackingArguments(request) {
198
+ if (!request || typeof request !== "object") {
199
+ return {};
200
+ }
201
+ const params = request.params;
202
+ if (!params || typeof params !== "object") {
203
+ return {};
204
+ }
205
+ const args = params.arguments;
206
+ if (!args || typeof args !== "object") {
207
+ return {};
208
+ }
209
+ const bag = args;
210
+ const sessionId = bag[sessionParamName];
211
+ const intent = bag[INTENT_PARAM];
212
+ delete bag[sessionParamName];
213
+ delete bag[INTENT_PARAM];
214
+ const tracking = {};
215
+ if (typeof sessionId === "string" && sessionId) {
216
+ tracking.sessionId = sessionId;
217
+ }
218
+ if (intentEnabled && typeof intent === "string" && intent) {
219
+ tracking.intent = intent;
220
+ }
221
+ return tracking;
222
+ }
223
+
224
+ // src/internal/version.ts
225
+ function getSDKVersion() {
226
+ return "0.1.43";
227
+ }
228
+
229
+
230
+
231
+
232
+
233
+
234
+
235
+
236
+
237
+
238
+
239
+
240
+ exports.resolveTransportSessionId = resolveTransportSessionId; exports.resolveSessionId = resolveSessionId; exports.stampAndPropagateSession = stampAndPropagateSession; exports.configure = configure; exports.isEnabled = isEnabled; exports.isSessionToolCall = isSessionToolCall; exports.sessionToolResult = sessionToolResult; exports.patchListToolsResult = patchListToolsResult; exports.popTrackingArguments = popTrackingArguments; exports.getSDKVersion = getSDKVersion;
package/dist/index.cjs CHANGED
@@ -4,7 +4,8 @@
4
4
  var _chunkUNLNNKZ7cjs = require('./chunk-UNLNNKZ7.cjs');
5
5
 
6
6
 
7
- var _chunkK3NPYISBcjs = require('./chunk-K3NPYISB.cjs');
7
+
8
+ var _chunkWTQTF57Jcjs = require('./chunk-WTQTF57J.cjs');
8
9
 
9
10
 
10
11
 
@@ -126,7 +127,7 @@ function loadGenAIInstrumentations() {
126
127
  function loadMCPInstrumentation() {
127
128
  void (async () => {
128
129
  try {
129
- const { MCPInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("./mcp-GVGTOWHP.cjs")));
130
+ const { MCPInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("./mcp-UJD6KF7G.cjs")));
130
131
  const mcp = new MCPInstrumentation({ exceptionLogger });
131
132
  _instrumentation.registerInstrumentations.call(void 0, { instrumentations: [mcp] });
132
133
  _chunkWC573FCIcjs.logger.debug("Auto-loaded MCP instrumentation");
@@ -509,7 +510,7 @@ var InstrumentationRegistry = (_class = class _InstrumentationRegistry {construc
509
510
  const mcpModules = this.manualModules.mcp;
510
511
  void (async () => {
511
512
  try {
512
- const { MCPInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("./mcp-GVGTOWHP.cjs")));
513
+ const { MCPInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("./mcp-UJD6KF7G.cjs")));
513
514
  const instrumentation = new MCPInstrumentation({ exceptionLogger: exceptionLogger2 });
514
515
  instrumentation.manuallyInstrument(mcpModules);
515
516
  _chunkWC573FCIcjs.logger.debug("Manual instrumentation enabled for MCP");
@@ -1779,7 +1780,7 @@ var LoggingModule = (_class3 = class _LoggingModule {constructor() { _class3.pro
1779
1780
  const resourceAttributes = {
1780
1781
  ...config.resourceAttributes,
1781
1782
  "service.name": serviceName,
1782
- [BRIZZ_SDK_VERSION]: _chunkK3NPYISBcjs.getSDKVersion.call(void 0, ),
1783
+ [BRIZZ_SDK_VERSION]: _chunkWTQTF57Jcjs.getSDKVersion.call(void 0, ),
1783
1784
  [BRIZZ_SDK_LANGUAGE]: SDK_LANGUAGE
1784
1785
  };
1785
1786
  if (config.environment) {
@@ -2028,7 +2029,7 @@ var BrizzSpanExporter = (_class5 = class {
2028
2029
  const resourceAttrs = {
2029
2030
  ...config.resourceAttributes,
2030
2031
  "service.name": config.appName,
2031
- [BRIZZ_SDK_VERSION]: _chunkK3NPYISBcjs.getSDKVersion.call(void 0, ),
2032
+ [BRIZZ_SDK_VERSION]: _chunkWTQTF57Jcjs.getSDKVersion.call(void 0, ),
2032
2033
  [BRIZZ_SDK_LANGUAGE]: SDK_LANGUAGE
2033
2034
  };
2034
2035
  if (config.environment) {
@@ -2362,6 +2363,14 @@ function getSpanProcessor() {
2362
2363
  }
2363
2364
 
2364
2365
  // src/internal/sdk.ts
2366
+ function resolveMcpSessionTracking(configured) {
2367
+ const fromEnv = process.env["BRIZZ_MCP_SESSION_TRACKING"];
2368
+ if (fromEnv === void 0) {
2369
+ return configured;
2370
+ }
2371
+ const enabled = fromEnv === "true";
2372
+ return typeof configured === "object" ? { ...configured, enabled } : enabled;
2373
+ }
2365
2374
  var _Brizz = (_class7 = class __Brizz {constructor() { _class7.prototype.__init15.call(this);_class7.prototype.__init16.call(this);_class7.prototype.__init17.call(this); }
2366
2375
  static __initStatic4() {this.instance = null}
2367
2376
  static getInstance() {
@@ -2382,6 +2391,7 @@ var _Brizz = (_class7 = class __Brizz {constructor() { _class7.prototype.__init1
2382
2391
  */
2383
2392
  setupInstrumentation(options) {
2384
2393
  const registry = InstrumentationRegistry.getInstance();
2394
+ _chunkWTQTF57Jcjs.configure.call(void 0, resolveMcpSessionTracking(options.mcpSessionTracking));
2385
2395
  if (options.instrumentModules && Object.keys(options.instrumentModules).length > 0) {
2386
2396
  registry.setManualModules(options.instrumentModules);
2387
2397
  }
@@ -2404,7 +2414,7 @@ var _Brizz = (_class7 = class __Brizz {constructor() { _class7.prototype.__init1
2404
2414
  const resourceAttributes = {
2405
2415
  ...resolvedConfig.resourceAttributes,
2406
2416
  "service.name": resolvedConfig.appName,
2407
- [BRIZZ_SDK_VERSION]: _chunkK3NPYISBcjs.getSDKVersion.call(void 0, ),
2417
+ [BRIZZ_SDK_VERSION]: _chunkWTQTF57Jcjs.getSDKVersion.call(void 0, ),
2408
2418
  [BRIZZ_SDK_LANGUAGE]: SDK_LANGUAGE
2409
2419
  };
2410
2420
  if (resolvedConfig.environment) {
package/dist/index.js CHANGED
@@ -3,8 +3,9 @@ import {
3
3
  parseDSN
4
4
  } from "./chunk-7SUF4VVI.js";
5
5
  import {
6
+ configure,
6
7
  getSDKVersion
7
- } from "./chunk-KVOGOKOB.js";
8
+ } from "./chunk-5SWAZUC5.js";
8
9
  import {
9
10
  DEFAULT_LOG_LEVEL,
10
11
  LogLevel,
@@ -126,7 +127,7 @@ function loadGenAIInstrumentations() {
126
127
  function loadMCPInstrumentation() {
127
128
  void (async () => {
128
129
  try {
129
- const { MCPInstrumentation } = await import("./mcp-5BFXKN63.js");
130
+ const { MCPInstrumentation } = await import("./mcp-6R6KZ5U3.js");
130
131
  const mcp = new MCPInstrumentation({ exceptionLogger });
131
132
  registerInstrumentations({ instrumentations: [mcp] });
132
133
  logger.debug("Auto-loaded MCP instrumentation");
@@ -509,7 +510,7 @@ var InstrumentationRegistry = class _InstrumentationRegistry {
509
510
  const mcpModules = this.manualModules.mcp;
510
511
  void (async () => {
511
512
  try {
512
- const { MCPInstrumentation } = await import("./mcp-5BFXKN63.js");
513
+ const { MCPInstrumentation } = await import("./mcp-6R6KZ5U3.js");
513
514
  const instrumentation = new MCPInstrumentation({ exceptionLogger: exceptionLogger2 });
514
515
  instrumentation.manuallyInstrument(mcpModules);
515
516
  logger.debug("Manual instrumentation enabled for MCP");
@@ -2362,6 +2363,14 @@ function getSpanProcessor() {
2362
2363
  }
2363
2364
 
2364
2365
  // src/internal/sdk.ts
2366
+ function resolveMcpSessionTracking(configured) {
2367
+ const fromEnv = process.env["BRIZZ_MCP_SESSION_TRACKING"];
2368
+ if (fromEnv === void 0) {
2369
+ return configured;
2370
+ }
2371
+ const enabled = fromEnv === "true";
2372
+ return typeof configured === "object" ? { ...configured, enabled } : enabled;
2373
+ }
2365
2374
  var _Brizz = class __Brizz {
2366
2375
  static instance = null;
2367
2376
  static getInstance() {
@@ -2382,6 +2391,7 @@ var _Brizz = class __Brizz {
2382
2391
  */
2383
2392
  setupInstrumentation(options) {
2384
2393
  const registry = InstrumentationRegistry.getInstance();
2394
+ configure(resolveMcpSessionTracking(options.mcpSessionTracking));
2385
2395
  if (options.instrumentModules && Object.keys(options.instrumentModules).length > 0) {
2386
2396
  registry.setManualModules(options.instrumentModules);
2387
2397
  }