@brizz/sdk 0.1.55 → 0.1.57

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.
@@ -9,7 +9,7 @@ import {
9
9
 
10
10
  // src/internal/version.ts
11
11
  function getSDKVersion() {
12
- return "0.1.55";
12
+ return "0.1.57";
13
13
  }
14
14
 
15
15
  // src/internal/instrumentation/mcp/session.ts
@@ -9,7 +9,7 @@ var _chunkRV7JIIDGcjs = require('./chunk-RV7JIIDG.cjs');
9
9
 
10
10
  // src/internal/version.ts
11
11
  function getSDKVersion() {
12
- return "0.1.55";
12
+ return "0.1.57";
13
13
  }
14
14
 
15
15
  // src/internal/instrumentation/mcp/session.ts
package/dist/index.cjs CHANGED
@@ -5,7 +5,7 @@ var _chunkUNLNNKZ7cjs = require('./chunk-UNLNNKZ7.cjs');
5
5
 
6
6
 
7
7
 
8
- var _chunkCF4CXFQPcjs = require('./chunk-CF4CXFQP.cjs');
8
+ var _chunkDCXOK7PXcjs = require('./chunk-DCXOK7PX.cjs');
9
9
 
10
10
 
11
11
 
@@ -113,7 +113,7 @@ var _api = require('@opentelemetry/api');
113
113
 
114
114
  // src/internal/instrumentation/langgraph/attributes.ts
115
115
  var INSTRUMENTATION_NAME = "@brizz/sdk/langgraph";
116
- var INSTRUMENTATION_VERSION = _chunkCF4CXFQPcjs.getSDKVersion.call(void 0, );
116
+ var INSTRUMENTATION_VERSION = _chunkDCXOK7PXcjs.getSDKVersion.call(void 0, );
117
117
  var MODULE_NAME = "@langchain/langgraph";
118
118
  var SUPPORTED_VERSIONS = [">=0.2.0 <2"];
119
119
  function isSupportedVersion(version) {
@@ -469,7 +469,7 @@ var ATTR_ANSWERS = "typesafe.answers";
469
469
  var PATCHED_FLAG2 = /* @__PURE__ */ Symbol.for("brizz.typesafe.patched");
470
470
  var TypeSafeInstrumentation = class extends _instrumentation.InstrumentationBase {
471
471
  constructor(config = {}) {
472
- super(INSTRUMENTATION_NAME2, _chunkCF4CXFQPcjs.getSDKVersion.call(void 0, ), config);
472
+ super(INSTRUMENTATION_NAME2, _chunkDCXOK7PXcjs.getSDKVersion.call(void 0, ), config);
473
473
  this.setTracerProvider(_chunkDC2MFO65cjs.brizzTracerProvider);
474
474
  }
475
475
  init() {
@@ -698,7 +698,7 @@ function loadGenAIInstrumentations() {
698
698
  function loadMCPInstrumentation() {
699
699
  void (async () => {
700
700
  try {
701
- const { MCPInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("./mcp-CYQ3TGCK.cjs")));
701
+ const { MCPInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("./mcp-WHXEBLRI.cjs")));
702
702
  const mcp = new MCPInstrumentation({ exceptionLogger });
703
703
  _instrumentation.registerInstrumentations.call(void 0, { instrumentations: [mcp], tracerProvider: _chunkDC2MFO65cjs.brizzTracerProvider });
704
704
  _chunkWC573FCIcjs.logger.debug("Auto-loaded MCP instrumentation");
@@ -1014,6 +1014,8 @@ var SDK_LANGUAGE = "typescript";
1014
1014
 
1015
1015
  var SCOPE_NAME = "@arizeai/openinference-instrumentation-langchain";
1016
1016
  var PATCHED_MARKER = /* @__PURE__ */ Symbol.for("brizz.langchain.callbackManagerPatched");
1017
+ var TRACER_PATCHED_MARKER = /* @__PURE__ */ Symbol.for("brizz.langchain.tracerPatched");
1018
+ var runContexts = /* @__PURE__ */ new WeakMap();
1017
1019
  var OMITTED_KEYS = /* @__PURE__ */ new Set([
1018
1020
  _chunkRV7JIIDGcjs.USER_EMAIL,
1019
1021
  _chunkRV7JIIDGcjs.USER_NAME,
@@ -1060,15 +1062,50 @@ function patchCallbackManagerModule(module2) {
1060
1062
  }
1061
1063
  } catch (e2) {
1062
1064
  }
1065
+ _optionalChain([manager, 'optionalAccess', _32 => _32.handlers, 'optionalAccess', _33 => _33.forEach, 'call', _34 => _34((handler) => {
1066
+ try {
1067
+ patchTracer(handler);
1068
+ } catch (e3) {
1069
+ }
1070
+ })]);
1063
1071
  return manager;
1064
1072
  };
1065
1073
  patchToolStart(statics["prototype"]);
1066
1074
  statics[PATCHED_MARKER] = true;
1067
1075
  return true;
1068
1076
  }
1077
+ function patchTracer(handler) {
1078
+ const tracer = handler;
1079
+ if (typeof tracer !== "object" || tracer === null || tracer[TRACER_PATCHED_MARKER] === true) {
1080
+ return;
1081
+ }
1082
+ const addRunToRunMap = tracer["_addRunToRunMap"];
1083
+ const onRunCreate = tracer["onRunCreate"];
1084
+ const endTrace = tracer["_endTrace"];
1085
+ if (typeof addRunToRunMap !== "function" || typeof onRunCreate !== "function" || typeof endTrace !== "function") {
1086
+ return;
1087
+ }
1088
+ tracer[TRACER_PATCHED_MARKER] = true;
1089
+ tracer["onRunCreate"] = inRunContext(onRunCreate);
1090
+ tracer["_endTrace"] = inRunContext(endTrace);
1091
+ const addRun = addRunToRunMap;
1092
+ tracer["_addRunToRunMap"] = function(...args) {
1093
+ const run = addRun.apply(this, args);
1094
+ if (typeof run === "object" && run !== null) {
1095
+ runContexts.set(run, _api.context.active());
1096
+ }
1097
+ return run;
1098
+ };
1099
+ }
1100
+ function inRunContext(method) {
1101
+ return function(...args) {
1102
+ const runContext = runContexts.get(args[0]);
1103
+ return runContext ? _api.context.with(runContext, () => method.apply(this, args)) : method.apply(this, args);
1104
+ };
1105
+ }
1069
1106
  function patchToolStart(prototype) {
1070
1107
  const proto = prototype;
1071
- const original = _optionalChain([proto, 'optionalAccess', _32 => _32["handleToolStart"]]);
1108
+ const original = _optionalChain([proto, 'optionalAccess', _35 => _35["handleToolStart"]]);
1072
1109
  if (!proto || typeof original !== "function") {
1073
1110
  return;
1074
1111
  }
@@ -1083,7 +1120,7 @@ function patchToolStart(prototype) {
1083
1120
  delete rest[TOOL_CALL_ID_METADATA_KEY];
1084
1121
  this.metadata = rest;
1085
1122
  }
1086
- } catch (e3) {
1123
+ } catch (e4) {
1087
1124
  }
1088
1125
  return handleToolStart.apply(this, args);
1089
1126
  };
@@ -1106,7 +1143,7 @@ function patchInstalledCallbackManager() {
1106
1143
  function restampLangChainSpan(span) {
1107
1144
  try {
1108
1145
  const scope = span.instrumentationScope;
1109
- if (_optionalChain([scope, 'optionalAccess', _33 => _33.name]) !== SCOPE_NAME) {
1146
+ if (_optionalChain([scope, 'optionalAccess', _36 => _36.name]) !== SCOPE_NAME) {
1110
1147
  return;
1111
1148
  }
1112
1149
  const attrs = span.attributes;
@@ -1168,7 +1205,7 @@ var InstrumentationRegistry = (_class = class _InstrumentationRegistry {construc
1168
1205
  * @private
1169
1206
  */
1170
1207
  loadManualInstrumentations(instrumentations, exceptionLogger2) {
1171
- if (_optionalChain([this, 'access', _34 => _34.manualModules, 'optionalAccess', _35 => _35.openAI])) {
1208
+ if (_optionalChain([this, 'access', _37 => _37.manualModules, 'optionalAccess', _38 => _38.openAI])) {
1172
1209
  try {
1173
1210
  const openAIInst = new BrizzOpenAIInstrumentation();
1174
1211
  openAIInst.manuallyInstrument(this.manualModules.openAI);
@@ -1179,18 +1216,18 @@ var InstrumentationRegistry = (_class = class _InstrumentationRegistry {construc
1179
1216
  }
1180
1217
  }
1181
1218
  const instrumentationConfigs = [
1182
- { class: _instrumentationanthropic.AnthropicInstrumentation, name: "Anthropic", module: _optionalChain([this, 'access', _36 => _36.manualModules, 'optionalAccess', _37 => _37.anthropic]) },
1183
- { class: _instrumentationcohere.CohereInstrumentation, name: "Cohere", module: _optionalChain([this, 'access', _38 => _38.manualModules, 'optionalAccess', _39 => _39.cohere]) },
1184
- { class: _instrumentationbedrock.BedrockInstrumentation, name: "Bedrock", module: _optionalChain([this, 'access', _40 => _40.manualModules, 'optionalAccess', _41 => _41.bedrock]) },
1185
- { class: _instrumentationpinecone.PineconeInstrumentation, name: "Pinecone", module: _optionalChain([this, 'access', _42 => _42.manualModules, 'optionalAccess', _43 => _43.pinecone]) },
1219
+ { class: _instrumentationanthropic.AnthropicInstrumentation, name: "Anthropic", module: _optionalChain([this, 'access', _39 => _39.manualModules, 'optionalAccess', _40 => _40.anthropic]) },
1220
+ { class: _instrumentationcohere.CohereInstrumentation, name: "Cohere", module: _optionalChain([this, 'access', _41 => _41.manualModules, 'optionalAccess', _42 => _42.cohere]) },
1221
+ { class: _instrumentationbedrock.BedrockInstrumentation, name: "Bedrock", module: _optionalChain([this, 'access', _43 => _43.manualModules, 'optionalAccess', _44 => _44.bedrock]) },
1222
+ { class: _instrumentationpinecone.PineconeInstrumentation, name: "Pinecone", module: _optionalChain([this, 'access', _45 => _45.manualModules, 'optionalAccess', _46 => _46.pinecone]) },
1186
1223
  {
1187
1224
  class: _instrumentationllamaindex.LlamaIndexInstrumentation,
1188
1225
  name: "LlamaIndex",
1189
- module: _optionalChain([this, 'access', _44 => _44.manualModules, 'optionalAccess', _45 => _45.llamaindex])
1226
+ module: _optionalChain([this, 'access', _47 => _47.manualModules, 'optionalAccess', _48 => _48.llamaindex])
1190
1227
  },
1191
- { class: _instrumentationchromadb.ChromaDBInstrumentation, name: "ChromaDB", module: _optionalChain([this, 'access', _46 => _46.manualModules, 'optionalAccess', _47 => _47.chromadb]) },
1192
- { class: _instrumentationqdrant.QdrantInstrumentation, name: "Qdrant", module: _optionalChain([this, 'access', _48 => _48.manualModules, 'optionalAccess', _49 => _49.qdrant]) },
1193
- { class: _instrumentationtogether.TogetherInstrumentation, name: "Together", module: _optionalChain([this, 'access', _50 => _50.manualModules, 'optionalAccess', _51 => _51.together]) }
1228
+ { class: _instrumentationchromadb.ChromaDBInstrumentation, name: "ChromaDB", module: _optionalChain([this, 'access', _49 => _49.manualModules, 'optionalAccess', _50 => _50.chromadb]) },
1229
+ { class: _instrumentationqdrant.QdrantInstrumentation, name: "Qdrant", module: _optionalChain([this, 'access', _51 => _51.manualModules, 'optionalAccess', _52 => _52.qdrant]) },
1230
+ { class: _instrumentationtogether.TogetherInstrumentation, name: "Together", module: _optionalChain([this, 'access', _53 => _53.manualModules, 'optionalAccess', _54 => _54.together]) }
1194
1231
  ];
1195
1232
  for (const config of instrumentationConfigs) {
1196
1233
  if (!config.module) {
@@ -1206,7 +1243,7 @@ var InstrumentationRegistry = (_class = class _InstrumentationRegistry {construc
1206
1243
  instrumentations.push(instrumentation);
1207
1244
  }
1208
1245
  }
1209
- if (_optionalChain([this, 'access', _52 => _52.manualModules, 'optionalAccess', _53 => _53.langchain, 'optionalAccess', _54 => _54.callbackManagerModule])) {
1246
+ if (_optionalChain([this, 'access', _55 => _55.manualModules, 'optionalAccess', _56 => _56.langchain, 'optionalAccess', _57 => _57.callbackManagerModule])) {
1210
1247
  const callbackManagerModule = this.manualModules.langchain.callbackManagerModule;
1211
1248
  void (async () => {
1212
1249
  try {
@@ -1222,7 +1259,7 @@ var InstrumentationRegistry = (_class = class _InstrumentationRegistry {construc
1222
1259
  }
1223
1260
  })();
1224
1261
  }
1225
- if (_optionalChain([this, 'access', _55 => _55.manualModules, 'optionalAccess', _56 => _56.langgraph])) {
1262
+ if (_optionalChain([this, 'access', _58 => _58.manualModules, 'optionalAccess', _59 => _59.langgraph])) {
1226
1263
  try {
1227
1264
  new LangGraphInstrumentation().manuallyInstrument(this.manualModules.langgraph);
1228
1265
  _chunkWC573FCIcjs.logger.debug("Manual instrumentation enabled for LangGraph");
@@ -1230,7 +1267,7 @@ var InstrumentationRegistry = (_class = class _InstrumentationRegistry {construc
1230
1267
  _chunkWC573FCIcjs.logger.error(`Failed to apply LangGraph instrumentation: ${String(error)}`);
1231
1268
  }
1232
1269
  }
1233
- if (_optionalChain([this, 'access', _57 => _57.manualModules, 'optionalAccess', _58 => _58.typesafe])) {
1270
+ if (_optionalChain([this, 'access', _60 => _60.manualModules, 'optionalAccess', _61 => _61.typesafe])) {
1234
1271
  try {
1235
1272
  new TypeSafeInstrumentation().manuallyInstrument(this.manualModules.typesafe);
1236
1273
  _chunkWC573FCIcjs.logger.debug("Manual instrumentation enabled for TypeSafe");
@@ -1238,7 +1275,7 @@ var InstrumentationRegistry = (_class = class _InstrumentationRegistry {construc
1238
1275
  _chunkWC573FCIcjs.logger.error(`Failed to apply TypeSafe instrumentation: ${String(error)}`);
1239
1276
  }
1240
1277
  }
1241
- if (_optionalChain([this, 'access', _59 => _59.manualModules, 'optionalAccess', _60 => _60.google_vertexai])) {
1278
+ if (_optionalChain([this, 'access', _62 => _62.manualModules, 'optionalAccess', _63 => _63.google_vertexai])) {
1242
1279
  const vertexModule = this.manualModules.google_vertexai;
1243
1280
  void (async () => {
1244
1281
  try {
@@ -1253,7 +1290,7 @@ var InstrumentationRegistry = (_class = class _InstrumentationRegistry {construc
1253
1290
  }
1254
1291
  })();
1255
1292
  }
1256
- if (_optionalChain([this, 'access', _61 => _61.manualModules, 'optionalAccess', _62 => _62.google_genai])) {
1293
+ if (_optionalChain([this, 'access', _64 => _64.manualModules, 'optionalAccess', _65 => _65.google_genai])) {
1257
1294
  const genaiModule = this.manualModules.google_genai;
1258
1295
  void (async () => {
1259
1296
  try {
@@ -1268,11 +1305,11 @@ var InstrumentationRegistry = (_class = class _InstrumentationRegistry {construc
1268
1305
  }
1269
1306
  })();
1270
1307
  }
1271
- if (_optionalChain([this, 'access', _63 => _63.manualModules, 'optionalAccess', _64 => _64.mcp])) {
1308
+ if (_optionalChain([this, 'access', _66 => _66.manualModules, 'optionalAccess', _67 => _67.mcp])) {
1272
1309
  const mcpModules = this.manualModules.mcp;
1273
1310
  void (async () => {
1274
1311
  try {
1275
- const { MCPInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("./mcp-CYQ3TGCK.cjs")));
1312
+ const { MCPInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("./mcp-WHXEBLRI.cjs")));
1276
1313
  const instrumentation = new MCPInstrumentation({ exceptionLogger: exceptionLogger2 });
1277
1314
  instrumentation.manuallyInstrument(mcpModules);
1278
1315
  _chunkWC573FCIcjs.logger.debug("Manual instrumentation enabled for MCP");
@@ -1325,7 +1362,7 @@ function setCurrentSpanCustomProperties(properties) {
1325
1362
  for (const [key, value] of Object.entries(properties)) {
1326
1363
  try {
1327
1364
  current.setAttribute(`${_chunkRV7JIIDGcjs.BRIZZ}.${key}`, value);
1328
- } catch (e4) {
1365
+ } catch (e5) {
1329
1366
  }
1330
1367
  }
1331
1368
  }
@@ -1349,15 +1386,15 @@ function withProperties(properties, fn, thisArg) {
1349
1386
  function propagatePropertiesImperatively(properties, base = _api.context.active()) {
1350
1387
  try {
1351
1388
  const manager = _api.context;
1352
- const mgr = _optionalChain([manager, 'access', _65 => _65._getContextManager, 'optionalCall', _66 => _66()]);
1353
- const store = _optionalChain([mgr, 'optionalAccess', _67 => _67._asyncLocalStorage]);
1389
+ const mgr = _optionalChain([manager, 'access', _68 => _68._getContextManager, 'optionalCall', _69 => _69()]);
1390
+ const store = _optionalChain([mgr, 'optionalAccess', _70 => _70._asyncLocalStorage]);
1354
1391
  if (!store || typeof store.enterWith !== "function") {
1355
1392
  return;
1356
1393
  }
1357
1394
  const prev = base.getValue(_chunkRV7JIIDGcjs.PROPERTIES_CONTEXT_KEY);
1358
1395
  const merged = prev ? { ...prev, ...properties } : properties;
1359
1396
  store.enterWith(base.setValue(_chunkRV7JIIDGcjs.PROPERTIES_CONTEXT_KEY, merged));
1360
- } catch (e5) {
1397
+ } catch (e6) {
1361
1398
  }
1362
1399
  }
1363
1400
  function setUser(user) {
@@ -1452,7 +1489,7 @@ function withServiceName(name, fn, thisArg) {
1452
1489
  }
1453
1490
  function resolveServiceNameFromContext() {
1454
1491
  const props = _api.context.active().getValue(_chunkRV7JIIDGcjs.PROPERTIES_CONTEXT_KEY);
1455
- return _optionalChain([props, 'optionalAccess', _68 => _68[_chunkRV7JIIDGcjs.SERVICE_NAME]]);
1492
+ return _optionalChain([props, 'optionalAccess', _71 => _71[_chunkRV7JIIDGcjs.SERVICE_NAME]]);
1456
1493
  }
1457
1494
  function userProperties(user) {
1458
1495
  const properties = { [_chunkRV7JIIDGcjs.USER_ID]: user.id };
@@ -1519,7 +1556,7 @@ function withMessageId(id, fn, thisArg) {
1519
1556
  }
1520
1557
  function inheritedMuteTools() {
1521
1558
  const properties = _api.context.active().getValue(_chunkRV7JIIDGcjs.PROPERTIES_CONTEXT_KEY);
1522
- return _optionalChain([properties, 'optionalAccess', _69 => _69[_chunkRV7JIIDGcjs.MUTE_TOOLS]]);
1559
+ return _optionalChain([properties, 'optionalAccess', _72 => _72[_chunkRV7JIIDGcjs.MUTE_TOOLS]]);
1523
1560
  }
1524
1561
  function muteProperties(options) {
1525
1562
  const { input = true, output = true, tools = output } = options;
@@ -1681,7 +1718,7 @@ var Session = (_class2 = class {
1681
1718
  * (free-form category, defaults to `'generic'`)
1682
1719
  */
1683
1720
  addExternalLink(url, options) {
1684
- emitExternalLink(this.sessionId, url, _optionalChain([options, 'optionalAccess', _70 => _70.title]), _optionalChain([options, 'optionalAccess', _71 => _71.linkType]));
1721
+ emitExternalLink(this.sessionId, url, _optionalChain([options, 'optionalAccess', _73 => _73.title]), _optionalChain([options, 'optionalAccess', _74 => _74.linkType]));
1685
1722
  }
1686
1723
  }, _class2);
1687
1724
  var SessionTitle = class {
@@ -1707,11 +1744,11 @@ function resolveSessionIdFromContext() {
1707
1744
  return active.sessionId;
1708
1745
  }
1709
1746
  const props = _api.context.active().getValue(_chunkRV7JIIDGcjs.PROPERTIES_CONTEXT_KEY);
1710
- return _optionalChain([props, 'optionalAccess', _72 => _72[_chunkRV7JIIDGcjs.SESSION_ID]]);
1747
+ return _optionalChain([props, 'optionalAccess', _75 => _75[_chunkRV7JIIDGcjs.SESSION_ID]]);
1711
1748
  }
1712
1749
  function resolveMessageIdFromContext() {
1713
1750
  const props = _api.context.active().getValue(_chunkRV7JIIDGcjs.PROPERTIES_CONTEXT_KEY);
1714
- return _optionalChain([props, 'optionalAccess', _73 => _73[_chunkRV7JIIDGcjs.MESSAGE_ID]]);
1751
+ return _optionalChain([props, 'optionalAccess', _76 => _76[_chunkRV7JIIDGcjs.MESSAGE_ID]]);
1715
1752
  }
1716
1753
  function emitExternalLink(sessionId, url, title, linkType) {
1717
1754
  try {
@@ -1725,30 +1762,30 @@ function emitExternalLink(sessionId, url, title, linkType) {
1725
1762
  }
1726
1763
  }
1727
1764
  function addExternalLink(url, options) {
1728
- const sessionId = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _74 => _74.sessionId]), () => ( resolveSessionIdFromContext()));
1765
+ const sessionId = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _77 => _77.sessionId]), () => ( resolveSessionIdFromContext()));
1729
1766
  if (!sessionId) {
1730
1767
  _chunkWC573FCIcjs.logger.warn(
1731
1768
  "addExternalLink called without a resolvable session id; link dropped. Pass options.sessionId or call inside a startSession/callWithSessionId scope."
1732
1769
  );
1733
1770
  return;
1734
1771
  }
1735
- emitExternalLink(sessionId, url, _optionalChain([options, 'optionalAccess', _75 => _75.title]), _optionalChain([options, 'optionalAccess', _76 => _76.linkType]));
1772
+ emitExternalLink(sessionId, url, _optionalChain([options, 'optionalAccess', _78 => _78.title]), _optionalChain([options, 'optionalAccess', _79 => _79.linkType]));
1736
1773
  }
1737
1774
  function recordFeedback(type, options) {
1738
1775
  const eventAttributes = { [_chunkRV7JIIDGcjs.FEEDBACK_TYPE]: type };
1739
- if (_optionalChain([options, 'optionalAccess', _77 => _77.score]) !== void 0) {
1776
+ if (_optionalChain([options, 'optionalAccess', _80 => _80.score]) !== void 0) {
1740
1777
  eventAttributes[_chunkRV7JIIDGcjs.FEEDBACK_SCORE] = options.score;
1741
1778
  }
1742
- if (_optionalChain([options, 'optionalAccess', _78 => _78.reason]) !== void 0) {
1779
+ if (_optionalChain([options, 'optionalAccess', _81 => _81.reason]) !== void 0) {
1743
1780
  eventAttributes[_chunkRV7JIIDGcjs.FEEDBACK_REASON] = options.reason;
1744
1781
  }
1745
- if (_optionalChain([options, 'optionalAccess', _79 => _79.comment]) !== void 0) {
1782
+ if (_optionalChain([options, 'optionalAccess', _82 => _82.comment]) !== void 0) {
1746
1783
  eventAttributes[_chunkRV7JIIDGcjs.FEEDBACK_COMMENT] = options.comment;
1747
1784
  }
1748
- if (_optionalChain([options, 'optionalAccess', _80 => _80.source]) !== void 0) {
1785
+ if (_optionalChain([options, 'optionalAccess', _83 => _83.source]) !== void 0) {
1749
1786
  eventAttributes[_chunkRV7JIIDGcjs.FEEDBACK_SOURCE] = options.source;
1750
1787
  }
1751
- if (_optionalChain([options, 'optionalAccess', _81 => _81.attributes])) {
1788
+ if (_optionalChain([options, 'optionalAccess', _84 => _84.attributes])) {
1752
1789
  for (const [key, value] of Object.entries(options.attributes)) {
1753
1790
  const k = `${_chunkRV7JIIDGcjs.FEEDBACK_ATTR_PREFIX}${key}`;
1754
1791
  if (eventAttributes[k] === void 0) {
@@ -1756,8 +1793,8 @@ function recordFeedback(type, options) {
1756
1793
  }
1757
1794
  }
1758
1795
  }
1759
- const messageId = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _82 => _82.messageId]), () => ( resolveMessageIdFromContext()));
1760
- const sessionId = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _83 => _83.sessionId]), () => ( resolveSessionIdFromContext()));
1796
+ const messageId = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _85 => _85.messageId]), () => ( resolveMessageIdFromContext()));
1797
+ const sessionId = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _86 => _86.sessionId]), () => ( resolveSessionIdFromContext()));
1761
1798
  if (messageId === void 0 && sessionId === void 0) {
1762
1799
  _chunkWC573FCIcjs.logger.warn(
1763
1800
  "recordFeedback called with no resolvable message id or session id; the feedback cannot be attributed to a message or conversation. Pass options.messageId / options.sessionId or call inside a startSession/callWithMessageId scope."
@@ -1788,7 +1825,7 @@ function recordMetric(options) {
1788
1825
  try {
1789
1826
  recordMetricImpl(options);
1790
1827
  } catch (error) {
1791
- _chunkWC573FCIcjs.logger.warn(`recordMetric(${JSON.stringify(_optionalChain([options, 'optionalAccess', _84 => _84.name]))}) failed; metric dropped.`, error);
1828
+ _chunkWC573FCIcjs.logger.warn(`recordMetric(${JSON.stringify(_optionalChain([options, 'optionalAccess', _87 => _87.name]))}) failed; metric dropped.`, error);
1792
1829
  }
1793
1830
  }
1794
1831
  function recordMetricImpl(options) {
@@ -1908,7 +1945,7 @@ function recordMetricImpl(options) {
1908
1945
  eventAttributes[_chunkRV7JIIDGcjs.METRIC_TRACE_ID] = traceId;
1909
1946
  }
1910
1947
  if (scope === _chunkRV7JIIDGcjs.METRIC_SCOPE_TRACE && traceId === void 0) {
1911
- const spanContext = _optionalChain([_api.trace, 'access', _85 => _85.getActiveSpan, 'call', _86 => _86(), 'optionalAccess', _87 => _87.spanContext, 'call', _88 => _88()]);
1948
+ const spanContext = _optionalChain([_api.trace, 'access', _88 => _88.getActiveSpan, 'call', _89 => _89(), 'optionalAccess', _90 => _90.spanContext, 'call', _91 => _91()]);
1912
1949
  if (!spanContext || !_api.isSpanContextValid.call(void 0, spanContext)) {
1913
1950
  _chunkWC573FCIcjs.logger.warn(
1914
1951
  `recordMetric(${name}) called with scope 'trace' but no trace; metric dropped. Pass options.traceId, or call inside the span of the trace being scored.`
@@ -1946,7 +1983,7 @@ function recordMetricImpl(options) {
1946
1983
  }
1947
1984
  }
1948
1985
  function startSession(sessionId, callback, extraProperties, options) {
1949
- const isTitle = _optionalChain([options, 'optionalAccess', _89 => _89.mode]) === "title";
1986
+ const isTitle = _optionalChain([options, 'optionalAccess', _92 => _92.mode]) === "title";
1950
1987
  const spanName = isTitle ? _chunkRV7JIIDGcjs.SESSION_TITLE_SPAN_NAME : _chunkRV7JIIDGcjs.SESSION_SPAN_NAME;
1951
1988
  return sessionTracer.startActiveSpan(spanName, (span) => {
1952
1989
  span.setAttribute(`${_chunkRV7JIIDGcjs.BRIZZ}.${_chunkRV7JIIDGcjs.SESSION_ID}`, sessionId);
@@ -1994,7 +2031,7 @@ function startSession(sessionId, callback, extraProperties, options) {
1994
2031
  });
1995
2032
  }
1996
2033
  function startSessionTitle(callback, options) {
1997
- const resolvedSessionId = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _90 => _90.sessionId]), () => ( _optionalChain([getActiveSession, 'call', _91 => _91(), 'optionalAccess', _92 => _92.sessionId])));
2034
+ const resolvedSessionId = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _93 => _93.sessionId]), () => ( _optionalChain([getActiveSession, 'call', _94 => _94(), 'optionalAccess', _95 => _95.sessionId])));
1998
2035
  return sessionTracer.startActiveSpan(_chunkRV7JIIDGcjs.SESSION_TITLE_SPAN_NAME, (span) => {
1999
2036
  if (resolvedSessionId) {
2000
2037
  span.setAttribute(`${_chunkRV7JIIDGcjs.BRIZZ}.${_chunkRV7JIIDGcjs.SESSION_ID}`, resolvedSessionId);
@@ -2217,7 +2254,7 @@ var DEFAULT_PII_PATTERNS = [
2217
2254
  },
2218
2255
  {
2219
2256
  name: "discover_cards",
2220
- pattern: String.raw`\b65[4-9][0-9]{13}|64[4-9][0-9]{13}|6011[0-9]{12}\b`
2257
+ pattern: String.raw`\b(?:65[4-9][0-9]{13}|64[4-9][0-9]{13}|6011[0-9]{12})\b`
2221
2258
  }
2222
2259
  ];
2223
2260
 
@@ -2467,7 +2504,7 @@ var BrizzSimpleLogRecordProcessor = class extends _sdklogs.SimpleLogRecordProces
2467
2504
  this.config = config;
2468
2505
  }
2469
2506
  onEmit(logRecord) {
2470
- const maskingConfig = _optionalChain([this, 'access', _93 => _93.config, 'access', _94 => _94.masking, 'optionalAccess', _95 => _95.eventMasking]);
2507
+ const maskingConfig = _optionalChain([this, 'access', _96 => _96.config, 'access', _97 => _97.masking, 'optionalAccess', _98 => _98.eventMasking]);
2471
2508
  if (maskingConfig) {
2472
2509
  maskLog(logRecord, maskingConfig);
2473
2510
  }
@@ -2487,7 +2524,7 @@ var BrizzBatchLogRecordProcessor = class extends _sdklogs.BatchLogRecordProcesso
2487
2524
  this.config = config;
2488
2525
  }
2489
2526
  onEmit(logRecord) {
2490
- const maskingConfig = _optionalChain([this, 'access', _96 => _96.config, 'access', _97 => _97.masking, 'optionalAccess', _98 => _98.eventMasking]);
2527
+ const maskingConfig = _optionalChain([this, 'access', _99 => _99.config, 'access', _100 => _100.masking, 'optionalAccess', _101 => _101.eventMasking]);
2491
2528
  if (maskingConfig) {
2492
2529
  maskLog(logRecord, maskingConfig);
2493
2530
  }
@@ -2588,14 +2625,14 @@ var LoggingModule = (_class3 = class _LoggingModule {constructor() { _class3.pro
2588
2625
  _chunkWC573FCIcjs.logger.debug("Creating logger provider", {
2589
2626
  serviceName,
2590
2627
  disableBatch: config.disableBatch,
2591
- hasMasking: !!_optionalChain([config, 'access', _99 => _99.masking, 'optionalAccess', _100 => _100.eventMasking])
2628
+ hasMasking: !!_optionalChain([config, 'access', _102 => _102.masking, 'optionalAccess', _103 => _103.eventMasking])
2592
2629
  });
2593
2630
  const exporter = this.createLogExporter(config, serviceName);
2594
2631
  const processor = config.disableBatch ? new BrizzSimpleLogRecordProcessor(exporter, config) : new BrizzBatchLogRecordProcessor(exporter, config);
2595
2632
  const resourceAttributes = {
2596
2633
  ...config.resourceAttributes,
2597
2634
  "service.name": serviceName,
2598
- [BRIZZ_SDK_VERSION]: _chunkCF4CXFQPcjs.getSDKVersion.call(void 0, ),
2635
+ [BRIZZ_SDK_VERSION]: _chunkDCXOK7PXcjs.getSDKVersion.call(void 0, ),
2599
2636
  [BRIZZ_SDK_LANGUAGE]: SDK_LANGUAGE
2600
2637
  };
2601
2638
  if (config.environment) {
@@ -2696,7 +2733,7 @@ var LoggingModule = (_class3 = class _LoggingModule {constructor() { _class3.pro
2696
2733
  }
2697
2734
  async forceFlush() {
2698
2735
  await Promise.all(
2699
- [...this.scopedProviders.values(), this.loggerProvider].map(async (p) => _optionalChain([p, 'optionalAccess', _101 => _101.forceFlush, 'call', _102 => _102()]))
2736
+ [...this.scopedProviders.values(), this.loggerProvider].map(async (p) => _optionalChain([p, 'optionalAccess', _104 => _104.forceFlush, 'call', _105 => _105()]))
2700
2737
  );
2701
2738
  }
2702
2739
  /**
@@ -2809,7 +2846,7 @@ var MetricsModule = (_class4 = class _MetricsModule {constructor() { _class4.pro
2809
2846
  return this.metricsReader;
2810
2847
  }
2811
2848
  async forceFlush() {
2812
- await _optionalChain([this, 'access', _103 => _103.metricsReader, 'optionalAccess', _104 => _104.forceFlush, 'call', _105 => _105()]);
2849
+ await _optionalChain([this, 'access', _106 => _106.metricsReader, 'optionalAccess', _107 => _107.forceFlush, 'call', _108 => _108()]);
2813
2850
  }
2814
2851
  /**
2815
2852
  * Shutdown the metrics module
@@ -2852,7 +2889,7 @@ var BrizzSpanExporter = (_class5 = class {
2852
2889
  const resourceAttrs = {
2853
2890
  ...config.resourceAttributes,
2854
2891
  "service.name": config.appName,
2855
- [BRIZZ_SDK_VERSION]: _chunkCF4CXFQPcjs.getSDKVersion.call(void 0, ),
2892
+ [BRIZZ_SDK_VERSION]: _chunkDCXOK7PXcjs.getSDKVersion.call(void 0, ),
2856
2893
  [BRIZZ_SDK_LANGUAGE]: SDK_LANGUAGE
2857
2894
  };
2858
2895
  if (config.environment) {
@@ -2979,8 +3016,8 @@ var BrizzSpanExporter = (_class5 = class {
2979
3016
  }
2980
3017
  async forceFlush() {
2981
3018
  await Promise.all([
2982
- _optionalChain([this, 'access', _106 => _106._delegate, 'access', _107 => _107.forceFlush, 'optionalCall', _108 => _108()]),
2983
- ...[...this._delegates.values()].map(async (delegate) => _optionalChain([delegate, 'access', _109 => _109.forceFlush, 'optionalCall', _110 => _110()]))
3019
+ _optionalChain([this, 'access', _109 => _109._delegate, 'access', _110 => _110.forceFlush, 'optionalCall', _111 => _111()]),
3020
+ ...[...this._delegates.values()].map(async (delegate) => _optionalChain([delegate, 'access', _112 => _112.forceFlush, 'optionalCall', _113 => _113()]))
2984
3021
  ]);
2985
3022
  }
2986
3023
  }, _class5);
@@ -3038,7 +3075,7 @@ var BrizzSimpleSpanProcessor = class extends _sdktrace.SimpleSpanProcessor {
3038
3075
  }
3039
3076
  onEnd(span) {
3040
3077
  restampLangChainSpan(span);
3041
- const maskingConfig = _optionalChain([this, 'access', _111 => _111.config, 'access', _112 => _112.masking, 'optionalAccess', _113 => _113.spanMasking]);
3078
+ const maskingConfig = _optionalChain([this, 'access', _114 => _114.config, 'access', _115 => _115.masking, 'optionalAccess', _116 => _116.spanMasking]);
3042
3079
  if (maskingConfig) {
3043
3080
  maskReadableSpan(span, maskingConfig);
3044
3081
  }
@@ -3057,7 +3094,7 @@ var BrizzBatchSpanProcessor = class extends _sdktrace.BatchSpanProcessor {
3057
3094
  }
3058
3095
  onEnd(span) {
3059
3096
  restampLangChainSpan(span);
3060
- const maskingConfig = _optionalChain([this, 'access', _114 => _114.config, 'access', _115 => _115.masking, 'optionalAccess', _116 => _116.spanMasking]);
3097
+ const maskingConfig = _optionalChain([this, 'access', _117 => _117.config, 'access', _118 => _118.masking, 'optionalAccess', _119 => _119.spanMasking]);
3061
3098
  if (maskingConfig) {
3062
3099
  maskReadableSpan(span, maskingConfig);
3063
3100
  }
@@ -3074,7 +3111,7 @@ function maskReadableSpan(span, config) {
3074
3111
  for (const [k, v] of Object.entries(attrs)) {
3075
3112
  masked[k] = v;
3076
3113
  }
3077
- if (_optionalChain([config, 'access', _117 => _117.rules, 'optionalAccess', _118 => _118.length])) {
3114
+ if (_optionalChain([config, 'access', _120 => _120.rules, 'optionalAccess', _121 => _121.length])) {
3078
3115
  masked = maskAttributes(masked, config.rules);
3079
3116
  }
3080
3117
  if (!config.disableDefaultRules) {
@@ -3146,7 +3183,7 @@ var TracingModule = (_class6 = class _TracingModule {constructor() { _class6.pro
3146
3183
  }
3147
3184
  _chunkWC573FCIcjs.logger.debug("Initializing span processor", {
3148
3185
  disableBatch: config.disableBatch,
3149
- hasMasking: !!_optionalChain([config, 'access', _119 => _119.masking, 'optionalAccess', _120 => _120.spanMasking])
3186
+ hasMasking: !!_optionalChain([config, 'access', _122 => _122.masking, 'optionalAccess', _123 => _123.spanMasking])
3150
3187
  });
3151
3188
  const spanProcessor = config.disableBatch ? new BrizzSimpleSpanProcessor(this.spanExporter, config) : new BrizzBatchSpanProcessor(this.spanExporter, config);
3152
3189
  _chunkWC573FCIcjs.logger.debug("Span processor initialized successfully");
@@ -3190,7 +3227,7 @@ var TracingModule = (_class6 = class _TracingModule {constructor() { _class6.pro
3190
3227
  return this.spanProcessor;
3191
3228
  }
3192
3229
  async forceFlush() {
3193
- await _optionalChain([this, 'access', _121 => _121.spanProcessor, 'optionalAccess', _122 => _122.forceFlush, 'call', _123 => _123()]);
3230
+ await _optionalChain([this, 'access', _124 => _124.spanProcessor, 'optionalAccess', _125 => _125.forceFlush, 'call', _126 => _126()]);
3194
3231
  }
3195
3232
  async shutdown() {
3196
3233
  _chunkWC573FCIcjs.logger.debug("Shutting down tracing module");
@@ -3236,7 +3273,7 @@ function currentTraceparent() {
3236
3273
  const carrier = {};
3237
3274
  try {
3238
3275
  _chunkDC2MFO65cjs.injectTraceContext.call(void 0, _api.context.active(), carrier);
3239
- } catch (e6) {
3276
+ } catch (e7) {
3240
3277
  }
3241
3278
  return _nullishCoalesce(carrier["traceparent"], () => ( ""));
3242
3279
  }
@@ -3259,7 +3296,7 @@ function decodeToken(token) {
3259
3296
  try {
3260
3297
  const payload = JSON.parse(Buffer.from(token, "base64url").toString("utf8"));
3261
3298
  return payload.id ? payload : void 0;
3262
- } catch (e7) {
3299
+ } catch (e8) {
3263
3300
  return void 0;
3264
3301
  }
3265
3302
  }
@@ -3297,7 +3334,7 @@ function resolveAgent(agent) {
3297
3334
  if (decoded.traceparent) {
3298
3335
  try {
3299
3336
  parentContext = _chunkDC2MFO65cjs.extractTraceContext.call(void 0, parentContext, { traceparent: decoded.traceparent });
3300
- } catch (e8) {
3337
+ } catch (e9) {
3301
3338
  }
3302
3339
  }
3303
3340
  }
@@ -3374,7 +3411,7 @@ var _Brizz = (_class7 = class __Brizz {constructor() { _class7.prototype.__init1
3374
3411
  */
3375
3412
  setupInstrumentation(options) {
3376
3413
  const registry = InstrumentationRegistry.getInstance();
3377
- _chunkCF4CXFQPcjs.configure.call(void 0, resolveMcpSessionTracking(options.mcpSessionTracking));
3414
+ _chunkDCXOK7PXcjs.configure.call(void 0, resolveMcpSessionTracking(options.mcpSessionTracking));
3378
3415
  patchInstalledCallbackManager();
3379
3416
  patchInstalledLangGraph();
3380
3417
  patchInstalledTypeSafe();
@@ -3409,7 +3446,7 @@ var _Brizz = (_class7 = class __Brizz {constructor() { _class7.prototype.__init1
3409
3446
  const resourceAttributes = {
3410
3447
  ...resolvedConfig.resourceAttributes,
3411
3448
  "service.name": resolvedConfig.appName,
3412
- [BRIZZ_SDK_VERSION]: _chunkCF4CXFQPcjs.getSDKVersion.call(void 0, ),
3449
+ [BRIZZ_SDK_VERSION]: _chunkDCXOK7PXcjs.getSDKVersion.call(void 0, ),
3413
3450
  [BRIZZ_SDK_LANGUAGE]: SDK_LANGUAGE
3414
3451
  };
3415
3452
  if (resolvedConfig.environment) {
@@ -3519,19 +3556,19 @@ var _Brizz = (_class7 = class __Brizz {constructor() { _class7.prototype.__init1
3519
3556
  try {
3520
3557
  const tracingModule = TracingModule.getInstance();
3521
3558
  await tracingModule.shutdown();
3522
- } catch (e9) {
3559
+ } catch (e10) {
3523
3560
  _chunkWC573FCIcjs.logger.debug("Tracing module already shut down or not initialized");
3524
3561
  }
3525
3562
  try {
3526
3563
  const metricsModule = MetricsModule.getInstance();
3527
3564
  metricsModule.shutdown();
3528
- } catch (e10) {
3565
+ } catch (e11) {
3529
3566
  _chunkWC573FCIcjs.logger.debug("Metrics module already shut down or not initialized");
3530
3567
  }
3531
3568
  try {
3532
3569
  const loggingModule = LoggingModule.getInstance();
3533
3570
  await loggingModule.shutdown();
3534
- } catch (e11) {
3571
+ } catch (e12) {
3535
3572
  _chunkWC573FCIcjs.logger.debug("Logging module already shut down or not initialized");
3536
3573
  }
3537
3574
  _chunkWC573FCIcjs.logger.info("All telemetry modules shut down successfully");
@@ -3653,10 +3690,10 @@ var _Brizz = (_class7 = class __Brizz {constructor() { _class7.prototype.__init1
3653
3690
  }
3654
3691
  try {
3655
3692
  await this.shutdownModules();
3656
- await _optionalChain([this, 'access', _124 => _124._tracerProvider, 'optionalAccess', _125 => _125.forceFlush, 'call', _126 => _126()]);
3657
- await _optionalChain([this, 'access', _127 => _127._tracerProvider, 'optionalAccess', _128 => _128.shutdown, 'call', _129 => _129()]);
3658
- await _optionalChain([this, 'access', _130 => _130._meterProvider, 'optionalAccess', _131 => _131.forceFlush, 'call', _132 => _132()]);
3659
- await _optionalChain([this, 'access', _133 => _133._meterProvider, 'optionalAccess', _134 => _134.shutdown, 'call', _135 => _135()]);
3693
+ await _optionalChain([this, 'access', _127 => _127._tracerProvider, 'optionalAccess', _128 => _128.forceFlush, 'call', _129 => _129()]);
3694
+ await _optionalChain([this, 'access', _130 => _130._tracerProvider, 'optionalAccess', _131 => _131.shutdown, 'call', _132 => _132()]);
3695
+ await _optionalChain([this, 'access', _133 => _133._meterProvider, 'optionalAccess', _134 => _134.forceFlush, 'call', _135 => _135()]);
3696
+ await _optionalChain([this, 'access', _136 => _136._meterProvider, 'optionalAccess', _137 => _137.shutdown, 'call', _138 => _138()]);
3660
3697
  this._initialized = false;
3661
3698
  this._tracerProvider = null;
3662
3699
  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-WJZSFRB4.js";
8
+ } from "./chunk-42KYS2LU.js";
9
9
  import {
10
10
  bindToBrizz,
11
11
  brizzTracerProvider,
@@ -698,7 +698,7 @@ function loadGenAIInstrumentations() {
698
698
  function loadMCPInstrumentation() {
699
699
  void (async () => {
700
700
  try {
701
- const { MCPInstrumentation } = await import("./mcp-LLYYMR5M.js");
701
+ const { MCPInstrumentation } = await import("./mcp-FBTQYIOL.js");
702
702
  const mcp = new MCPInstrumentation({ exceptionLogger });
703
703
  registerInstrumentations({ instrumentations: [mcp], tracerProvider: brizzTracerProvider });
704
704
  logger.debug("Auto-loaded MCP instrumentation");
@@ -1014,6 +1014,8 @@ import { createRequire as createRequire3 } from "module";
1014
1014
  import { context as context3 } from "@opentelemetry/api";
1015
1015
  var SCOPE_NAME = "@arizeai/openinference-instrumentation-langchain";
1016
1016
  var PATCHED_MARKER = /* @__PURE__ */ Symbol.for("brizz.langchain.callbackManagerPatched");
1017
+ var TRACER_PATCHED_MARKER = /* @__PURE__ */ Symbol.for("brizz.langchain.tracerPatched");
1018
+ var runContexts = /* @__PURE__ */ new WeakMap();
1017
1019
  var OMITTED_KEYS = /* @__PURE__ */ new Set([
1018
1020
  USER_EMAIL,
1019
1021
  USER_NAME,
@@ -1060,12 +1062,47 @@ function patchCallbackManagerModule(module2) {
1060
1062
  }
1061
1063
  } catch {
1062
1064
  }
1065
+ manager?.handlers?.forEach((handler) => {
1066
+ try {
1067
+ patchTracer(handler);
1068
+ } catch {
1069
+ }
1070
+ });
1063
1071
  return manager;
1064
1072
  };
1065
1073
  patchToolStart(statics["prototype"]);
1066
1074
  statics[PATCHED_MARKER] = true;
1067
1075
  return true;
1068
1076
  }
1077
+ function patchTracer(handler) {
1078
+ const tracer = handler;
1079
+ if (typeof tracer !== "object" || tracer === null || tracer[TRACER_PATCHED_MARKER] === true) {
1080
+ return;
1081
+ }
1082
+ const addRunToRunMap = tracer["_addRunToRunMap"];
1083
+ const onRunCreate = tracer["onRunCreate"];
1084
+ const endTrace = tracer["_endTrace"];
1085
+ if (typeof addRunToRunMap !== "function" || typeof onRunCreate !== "function" || typeof endTrace !== "function") {
1086
+ return;
1087
+ }
1088
+ tracer[TRACER_PATCHED_MARKER] = true;
1089
+ tracer["onRunCreate"] = inRunContext(onRunCreate);
1090
+ tracer["_endTrace"] = inRunContext(endTrace);
1091
+ const addRun = addRunToRunMap;
1092
+ tracer["_addRunToRunMap"] = function(...args) {
1093
+ const run = addRun.apply(this, args);
1094
+ if (typeof run === "object" && run !== null) {
1095
+ runContexts.set(run, context3.active());
1096
+ }
1097
+ return run;
1098
+ };
1099
+ }
1100
+ function inRunContext(method) {
1101
+ return function(...args) {
1102
+ const runContext = runContexts.get(args[0]);
1103
+ return runContext ? context3.with(runContext, () => method.apply(this, args)) : method.apply(this, args);
1104
+ };
1105
+ }
1069
1106
  function patchToolStart(prototype) {
1070
1107
  const proto = prototype;
1071
1108
  const original = proto?.["handleToolStart"];
@@ -1272,7 +1309,7 @@ var InstrumentationRegistry = class _InstrumentationRegistry {
1272
1309
  const mcpModules = this.manualModules.mcp;
1273
1310
  void (async () => {
1274
1311
  try {
1275
- const { MCPInstrumentation } = await import("./mcp-LLYYMR5M.js");
1312
+ const { MCPInstrumentation } = await import("./mcp-FBTQYIOL.js");
1276
1313
  const instrumentation = new MCPInstrumentation({ exceptionLogger: exceptionLogger2 });
1277
1314
  instrumentation.manuallyInstrument(mcpModules);
1278
1315
  logger.debug("Manual instrumentation enabled for MCP");
@@ -2217,7 +2254,7 @@ var DEFAULT_PII_PATTERNS = [
2217
2254
  },
2218
2255
  {
2219
2256
  name: "discover_cards",
2220
- pattern: String.raw`\b65[4-9][0-9]{13}|64[4-9][0-9]{13}|6011[0-9]{12}\b`
2257
+ pattern: String.raw`\b(?:65[4-9][0-9]{13}|64[4-9][0-9]{13}|6011[0-9]{12})\b`
2221
2258
  }
2222
2259
  ];
2223
2260
 
@@ -8,7 +8,7 @@ import {
8
8
  resolveTransportSessionId,
9
9
  sessionToolResult,
10
10
  stampAndPropagateSession
11
- } from "./chunk-WJZSFRB4.js";
11
+ } from "./chunk-42KYS2LU.js";
12
12
  import {
13
13
  brizzTracerProvider,
14
14
  extractTraceContext,
@@ -8,7 +8,7 @@
8
8
 
9
9
 
10
10
 
11
- var _chunkCF4CXFQPcjs = require('./chunk-CF4CXFQP.cjs');
11
+ var _chunkDCXOK7PXcjs = require('./chunk-DCXOK7PX.cjs');
12
12
 
13
13
 
14
14
 
@@ -409,14 +409,14 @@ function wrapOnRequest(original, tracer) {
409
409
  return original.apply(this, args);
410
410
  }
411
411
  const method = request.method;
412
- if (method === METHOD_TOOLS_CALL && _chunkCF4CXFQPcjs.isSessionToolCall.call(void 0, request)) {
412
+ if (method === METHOD_TOOLS_CALL && _chunkDCXOK7PXcjs.isSessionToolCall.call(void 0, request)) {
413
413
  return answerSessionToolCall(this, request, tracer, args, original);
414
414
  }
415
415
  const handler = _nullishCoalesce(handlers.get(method), () => ( this.fallbackRequestHandler));
416
416
  if (!handler) {
417
417
  return original.apply(this, args);
418
418
  }
419
- const tracking = _chunkCF4CXFQPcjs.isEnabled.call(void 0, ) && method === METHOD_TOOLS_CALL ? _chunkCF4CXFQPcjs.popTrackingArguments.call(void 0, request) : {};
419
+ const tracking = _chunkDCXOK7PXcjs.isEnabled.call(void 0, ) && method === METHOD_TOOLS_CALL ? _chunkDCXOK7PXcjs.popTrackingArguments.call(void 0, request) : {};
420
420
  const started = safeStartServerSpan(tracer, request, this, tracking);
421
421
  if (!started) {
422
422
  return original.apply(this, args);
@@ -426,9 +426,9 @@ function wrapOnRequest(original, tracer) {
426
426
  if (method === METHOD_TOOLS_LIST) {
427
427
  hooks.onResult = (result) => {
428
428
  let advertised = result;
429
- if (_chunkCF4CXFQPcjs.isEnabled.call(void 0, )) {
429
+ if (_chunkDCXOK7PXcjs.isEnabled.call(void 0, )) {
430
430
  try {
431
- advertised = _chunkCF4CXFQPcjs.patchListToolsResult.call(void 0, result);
431
+ advertised = _chunkDCXOK7PXcjs.patchListToolsResult.call(void 0, result);
432
432
  } catch (error) {
433
433
  _chunkWC573FCIcjs.logger.warn(
434
434
  `Brizz MCP: failed to patch tools/list schemas: ${String(error)}`
@@ -439,7 +439,7 @@ function wrapOnRequest(original, tracer) {
439
439
  try {
440
440
  emitSchemaSpansFromListResponse(
441
441
  advertised,
442
- _chunkCF4CXFQPcjs.resolveTransportSessionId.call(void 0, this),
442
+ _chunkDCXOK7PXcjs.resolveTransportSessionId.call(void 0, this),
443
443
  tracer
444
444
  );
445
445
  } catch (error) {
@@ -452,7 +452,7 @@ function wrapOnRequest(original, tracer) {
452
452
  }
453
453
  if (method !== METHOD_TOOLS_CALL) {
454
454
  hooks.onError = () => {
455
- _chunkCF4CXFQPcjs.stampAndPropagateSession.call(void 0, span, _chunkCF4CXFQPcjs.resolveSessionId.call(void 0, this, spanCtx), spanCtx);
455
+ _chunkDCXOK7PXcjs.stampAndPropagateSession.call(void 0, span, _chunkDCXOK7PXcjs.resolveSessionId.call(void 0, this, spanCtx), spanCtx);
456
456
  };
457
457
  }
458
458
  const wrappedHandler = (req, extra) => _api.context.with(
@@ -486,7 +486,7 @@ function answerSessionToolCall(protocol, request, tracer, args, original) {
486
486
  if (!handlers) {
487
487
  return original.apply(protocol, args);
488
488
  }
489
- const { id, result } = _chunkCF4CXFQPcjs.sessionToolResult.call(void 0, );
489
+ const { id, result } = _chunkDCXOK7PXcjs.sessionToolResult.call(void 0, );
490
490
  const started = safeStartServerSpan(tracer, request, protocol, { sessionId: id });
491
491
  const handler = () => started ? _api.context.with(started.spanCtx, () => result) : result;
492
492
  const hadEntry = handlers.has(METHOD_TOOLS_CALL);
@@ -576,8 +576,8 @@ function safeStartServerSpan(tracer, request, protocol, tracking = {}) {
576
576
  parentCtx
577
577
  );
578
578
  applyServerRequestAttributes(span, request, protocol);
579
- const resolved = request.method === METHOD_TOOLS_CALL ? _nullishCoalesce(tracking.sessionId, () => ( _chunkCF4CXFQPcjs.resolveSessionId.call(void 0, protocol, parentCtx))) : void 0;
580
- const { context: sessCtx } = _chunkCF4CXFQPcjs.stampAndPropagateSession.call(void 0,
579
+ const resolved = request.method === METHOD_TOOLS_CALL ? _nullishCoalesce(tracking.sessionId, () => ( _chunkDCXOK7PXcjs.resolveSessionId.call(void 0, protocol, parentCtx))) : void 0;
580
+ const { context: sessCtx } = _chunkDCXOK7PXcjs.stampAndPropagateSession.call(void 0,
581
581
  span,
582
582
  resolved,
583
583
  parentCtx,
@@ -633,7 +633,7 @@ function safeEnd(span) {
633
633
 
634
634
  // src/internal/instrumentation/mcp/version.ts
635
635
  var INSTRUMENTATION_NAME = "@brizz/sdk/mcp";
636
- var INSTRUMENTATION_VERSION = _chunkCF4CXFQPcjs.getSDKVersion.call(void 0, );
636
+ var INSTRUMENTATION_VERSION = _chunkDCXOK7PXcjs.getSDKVersion.call(void 0, );
637
637
 
638
638
  // src/internal/instrumentation/mcp/instrumentation.ts
639
639
  var PROTOCOL_MODULE_NAME = "@modelcontextprotocol/sdk/shared/protocol.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brizz/sdk",
3
- "version": "0.1.55",
3
+ "version": "0.1.57",
4
4
  "type": "module",
5
5
  "description": "OpenTelemetry-based observability SDK for AI applications",
6
6
  "keywords": [
@@ -104,31 +104,31 @@
104
104
  "registry": "https://registry.npmjs.org/"
105
105
  },
106
106
  "devDependencies": {
107
- "@ai-sdk/anthropic": "^4.0.85",
108
- "@ai-sdk/openai": "^4.0.99",
109
- "@ai-sdk/otel": "^1.0.148",
107
+ "@ai-sdk/anthropic": "^4.0.88",
108
+ "@ai-sdk/openai": "^4.0.102",
109
+ "@ai-sdk/otel": "^1.0.153",
110
110
  "@arethetypeswrong/cli": "^0.18.5",
111
- "@arizeai/openinference-instrumentation-mcp": "^0.2.36",
112
- "@babel/core": "^8.0.7",
111
+ "@arizeai/openinference-instrumentation-mcp": "^0.2.37",
112
+ "@babel/core": "^8.0.9",
113
113
  "@babel/preset-env": "^8.0.7",
114
114
  "@babel/preset-typescript": "^8.0.7",
115
115
  "@changesets/changelog-github": "^1.0.1",
116
116
  "@changesets/cli": "^3.0.3",
117
- "@google/genai": "^2.30.0",
118
- "@langchain/core": "^1.2.20",
117
+ "@google/genai": "^2.31.0",
118
+ "@langchain/core": "^1.3.0",
119
119
  "@langchain/langgraph": "^1.5.2",
120
- "@modelcontextprotocol/sdk": "^1.32.1",
120
+ "@modelcontextprotocol/sdk": "^1.32.2",
121
121
  "@traceloop/instrumentation-google-generativeai": "^0.27.0",
122
122
  "@traceloop/instrumentation-vertexai": "^0.27.0",
123
123
  "@types/jest": "^30.0.0",
124
124
  "@types/node": "^26.6.5",
125
125
  "@typesafe-ai/sdk": "^0.7.0",
126
- "ai": "^7.0.148",
126
+ "ai": "^7.0.153",
127
127
  "babel-jest": "^30.5.2",
128
128
  "babel-plugin-transform-import-meta": "^3.1.0",
129
129
  "jest": "^30.5.2",
130
130
  "jest-environment-jsdom": "^30.5.2",
131
- "openai": "^7.41.0",
131
+ "openai": "^7.43.0",
132
132
  "oxlint": "^1.89.0",
133
133
  "prettier": "^3.9.10",
134
134
  "tsup": "^9.0.0",
@@ -181,7 +181,7 @@
181
181
  }
182
182
  },
183
183
  "dependencies": {
184
- "@arizeai/openinference-instrumentation-langchain": "^4.1.4",
184
+ "@arizeai/openinference-instrumentation-langchain": "^4.1.5",
185
185
  "@arizeai/openinference-instrumentation-openai": "^2.3.1",
186
186
  "@opentelemetry/api": "^1.10.0",
187
187
  "@opentelemetry/context-async-hooks": "^3.0.0",
@@ -212,7 +212,7 @@
212
212
  "packageManager": "pnpm@10.17.0+sha512.fce8a3dd29a4ed2ec566fb53efbb04d8c44a0f05bc6f24a73046910fb9c3ce7afa35a0980500668fa3573345bd644644fa98338fa168235c80f4aa17aa17fbef",
213
213
  "pnpm": {
214
214
  "overrides": {
215
- "@babel/core": "^8.0.7",
215
+ "@babel/core": "^8.0.9",
216
216
  "@opentelemetry/core@<2.12.0": "^2.12.0"
217
217
  },
218
218
  "updateConfig": {