@brizz/sdk 0.1.45 → 0.1.46

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/index.cjs CHANGED
@@ -5,7 +5,7 @@ var _chunkUNLNNKZ7cjs = require('./chunk-UNLNNKZ7.cjs');
5
5
 
6
6
 
7
7
 
8
- var _chunkCBEDIRVKcjs = require('./chunk-CBEDIRVK.cjs');
8
+ var _chunkVFWTFL7Ecjs = require('./chunk-VFWTFL7E.cjs');
9
9
 
10
10
 
11
11
 
@@ -89,6 +89,294 @@ var _instrumentationllamaindex = require('@traceloop/instrumentation-llamaindex'
89
89
  var _instrumentationpinecone = require('@traceloop/instrumentation-pinecone');
90
90
  var _instrumentationqdrant = require('@traceloop/instrumentation-qdrant');
91
91
  var _instrumentationtogether = require('@traceloop/instrumentation-together');
92
+
93
+ // src/internal/instrumentation/langgraph/instrumentation.ts
94
+ var _api = require('@opentelemetry/api');
95
+
96
+
97
+
98
+
99
+
100
+ // src/internal/instrumentation/langgraph/attributes.ts
101
+ var INSTRUMENTATION_NAME = "@brizz/sdk/langgraph";
102
+ var INSTRUMENTATION_VERSION = _chunkVFWTFL7Ecjs.getSDKVersion.call(void 0, );
103
+ var MODULE_NAME = "@langchain/langgraph";
104
+ var SUPPORTED_VERSIONS = [">=0.2.0 <2"];
105
+ var CHECKPOINT_SPAN_NAME = "brizz.langgraph.checkpoint";
106
+ var ATTR_CHECKPOINT_PARENT_ID = "brizz.checkpoint_parent_id";
107
+ var ATTR_CHECKPOINT_ID = "brizz.checkpoint_id";
108
+ var ATTR_CHECKPOINT_NS = "brizz.checkpoint_ns";
109
+ var ATTR_CHECKPOINT_THREAD_ID = "brizz.checkpoint_thread_id";
110
+ function asNonEmptyString(value) {
111
+ return typeof value === "string" && value.length > 0 ? value : void 0;
112
+ }
113
+ function readCheckpointId(config) {
114
+ return asNonEmptyString(_optionalChain([config, 'optionalAccess', _2 => _2.configurable, 'optionalAccess', _3 => _3.checkpoint_id]));
115
+ }
116
+ function readCheckpointNs(config) {
117
+ return asNonEmptyString(_optionalChain([config, 'optionalAccess', _4 => _4.configurable, 'optionalAccess', _5 => _5.checkpoint_ns]));
118
+ }
119
+ function readThreadId(config) {
120
+ return asNonEmptyString(_optionalChain([config, 'optionalAccess', _6 => _6.configurable, 'optionalAccess', _7 => _7.thread_id]));
121
+ }
122
+ function readWrittenCheckpointId(checkpoint) {
123
+ return asNonEmptyString(_optionalChain([checkpoint, 'optionalAccess', _8 => _8.id]));
124
+ }
125
+ function resolveCheckpointer(graph, config) {
126
+ const inherited = _optionalChain([config, 'optionalAccess', _9 => _9.configurable, 'optionalAccess', _10 => _10.__pregel_checkpointer]);
127
+ const candidate = _nullishCoalesce(inherited, () => ( graph.checkpointer));
128
+ return typeof candidate === "object" && candidate !== null ? candidate : void 0;
129
+ }
130
+ function resolvePregelPrototype(module2) {
131
+ if (typeof module2 !== "object" || module2 === null) {
132
+ return void 0;
133
+ }
134
+ const exports2 = module2;
135
+ const direct = _optionalChain([exports2, 'access', _11 => _11["Pregel"], 'optionalAccess', _12 => _12.prototype]);
136
+ if (isPregelPrototype(direct)) {
137
+ return direct;
138
+ }
139
+ for (const name of ["CompiledStateGraph", "CompiledGraph", "MessageGraph"]) {
140
+ let proto = _optionalChain([exports2, 'access', _13 => _13[name], 'optionalAccess', _14 => _14.prototype]);
141
+ while (proto && proto !== Object.prototype) {
142
+ if (isPregelPrototype(proto)) {
143
+ return proto;
144
+ }
145
+ proto = Object.getPrototypeOf(proto);
146
+ }
147
+ }
148
+ return void 0;
149
+ }
150
+ function isPregelPrototype(value) {
151
+ if (typeof value !== "object" || value === null) {
152
+ return false;
153
+ }
154
+ return typeof value.stream === "function" && typeof value.getState === "function" && Object.prototype.hasOwnProperty.call(value, "stream") && Object.prototype.hasOwnProperty.call(value, "getState");
155
+ }
156
+
157
+ // src/internal/instrumentation/langgraph/instrumentation.ts
158
+ var PATCHED_FLAG = /* @__PURE__ */ Symbol.for("brizz.langgraph.patched");
159
+ var CHECKPOINT_SPAN_KEY = _api.createContextKey.call(void 0, "brizz.langgraph.checkpoint_span");
160
+ var patchedSavers = /* @__PURE__ */ new WeakSet();
161
+ var parentRecorded = /* @__PURE__ */ new WeakSet();
162
+ var LangGraphInstrumentation = class extends _instrumentation.InstrumentationBase {
163
+ constructor(config = {}) {
164
+ super(INSTRUMENTATION_NAME, INSTRUMENTATION_VERSION, config);
165
+ }
166
+ init() {
167
+ return [
168
+ new (0, _instrumentation.InstrumentationNodeModuleDefinition)(
169
+ MODULE_NAME,
170
+ SUPPORTED_VERSIONS,
171
+ (moduleExports) => {
172
+ this.applyPatch(moduleExports);
173
+ return moduleExports;
174
+ },
175
+ (moduleExports) => moduleExports
176
+ )
177
+ ];
178
+ }
179
+ /**
180
+ * Patch a LangGraph module the caller already imported.
181
+ *
182
+ * The module-load hook above only fires for CommonJS requires, so an ESM or
183
+ * bundled consumer reaches the instrumentation through here — via
184
+ * `Brizz.initialize({ instrumentModules: { langgraph } })`. Accepts either
185
+ * the package root or its `pregel` subpath.
186
+ */
187
+ manuallyInstrument(moduleExports) {
188
+ this.applyPatch(moduleExports);
189
+ }
190
+ applyPatch(moduleExports) {
191
+ const proto = resolvePregelPrototype(moduleExports);
192
+ if (!proto) {
193
+ _chunkWC573FCIcjs.logger.debug("Brizz LangGraph: module does not expose a Pregel prototype \u2014 skipping patch");
194
+ return;
195
+ }
196
+ if (patchPregelStream(proto, () => this.tracer)) {
197
+ _chunkWC573FCIcjs.logger.debug("Brizz LangGraph: patched Pregel.stream for checkpoint spans");
198
+ }
199
+ }
200
+ };
201
+ function patchPregelStream(proto, getTracer) {
202
+ const target = proto;
203
+ if (target[PATCHED_FLAG]) {
204
+ return false;
205
+ }
206
+ const originalStream = proto.stream;
207
+ if (typeof originalStream !== "function") {
208
+ return false;
209
+ }
210
+ proto.stream = async function patchedStream(input, options) {
211
+ const run = beginRun(this, options, getTracer);
212
+ if (!run) {
213
+ return await originalStream.call(this, input, options);
214
+ }
215
+ let stream;
216
+ try {
217
+ stream = await _api.context.with(run.runContext, () => originalStream.call(this, input, options));
218
+ } catch (error) {
219
+ endRun(run, error);
220
+ throw error;
221
+ }
222
+ return attachRunToIteration(stream, run);
223
+ };
224
+ target[PATCHED_FLAG] = true;
225
+ return true;
226
+ }
227
+ function patchSaver(checkpointer) {
228
+ const proto = Object.getPrototypeOf(checkpointer);
229
+ if (!proto || patchedSavers.has(proto)) {
230
+ return;
231
+ }
232
+ patchedSavers.add(proto);
233
+ const originalPut = proto.put;
234
+ if (typeof originalPut !== "function") {
235
+ _chunkWC573FCIcjs.logger.debug("Brizz LangGraph: checkpointer exposes no put \u2014 checkpoint ids unavailable");
236
+ return;
237
+ }
238
+ const patchedPut = function brizzPut(config, checkpoint, ...rest) {
239
+ recordCheckpoint(config, checkpoint);
240
+ return originalPut.call(this, config, checkpoint, ...rest);
241
+ };
242
+ proto.put = patchedPut;
243
+ }
244
+ function recordCheckpoint(config, checkpoint) {
245
+ try {
246
+ const span = _api.context.active().getValue(CHECKPOINT_SPAN_KEY);
247
+ if (!_optionalChain([span, 'optionalAccess', _15 => _15.isRecording, 'call', _16 => _16()])) {
248
+ return;
249
+ }
250
+ const checkpointId = readWrittenCheckpointId(checkpoint);
251
+ if (checkpointId) {
252
+ span.setAttribute(ATTR_CHECKPOINT_ID, checkpointId);
253
+ }
254
+ if (parentRecorded.has(span)) {
255
+ return;
256
+ }
257
+ parentRecorded.add(span);
258
+ setIfKnown(span, ATTR_CHECKPOINT_PARENT_ID, readCheckpointId(config));
259
+ setIfKnown(span, ATTR_CHECKPOINT_THREAD_ID, readThreadId(config));
260
+ setIfKnown(span, ATTR_CHECKPOINT_NS, readCheckpointNs(config));
261
+ } catch (error) {
262
+ _chunkWC573FCIcjs.logger.debug(`Brizz LangGraph: could not record a checkpoint write: ${String(error)}`);
263
+ }
264
+ }
265
+ function setIfKnown(span, key, value) {
266
+ if (value) {
267
+ span.setAttribute(key, value);
268
+ }
269
+ }
270
+ function beginRun(graph, options, getTracer) {
271
+ try {
272
+ if (!_optionalChain([options, 'optionalAccess', _17 => _17.configurable])) {
273
+ return void 0;
274
+ }
275
+ const checkpointer = resolveCheckpointer(graph, options);
276
+ if (!checkpointer) {
277
+ return void 0;
278
+ }
279
+ patchSaver(checkpointer);
280
+ const span = getTracer().startSpan(CHECKPOINT_SPAN_NAME);
281
+ return {
282
+ span,
283
+ runContext: _api.trace.setSpan(_api.context.active(), span).setValue(CHECKPOINT_SPAN_KEY, span)
284
+ };
285
+ } catch (error) {
286
+ _chunkWC573FCIcjs.logger.debug(`Brizz LangGraph: could not start checkpoint span: ${String(error)}`);
287
+ return void 0;
288
+ }
289
+ }
290
+ var CONTROL_FLOW_ERROR_NAMES = /* @__PURE__ */ new Set([
291
+ "GraphInterrupt",
292
+ "GraphBubbleUp",
293
+ "GraphDrained",
294
+ "NodeInterrupt",
295
+ "ParentCommand"
296
+ ]);
297
+ function isControlFlow(error) {
298
+ const name = _optionalChain([error, 'optionalAccess', _18 => _18.name]);
299
+ return typeof name === "string" && CONTROL_FLOW_ERROR_NAMES.has(name);
300
+ }
301
+ function endRun(run, error) {
302
+ try {
303
+ if (error !== void 0 && !isControlFlow(error)) {
304
+ run.span.recordException(
305
+ error instanceof Error ? error : new Error(String(error), { cause: error })
306
+ );
307
+ run.span.setStatus({ code: _api.SpanStatusCode.ERROR });
308
+ }
309
+ } catch (spanError) {
310
+ _chunkWC573FCIcjs.logger.debug(`Brizz LangGraph: could not finish checkpoint span: ${String(spanError)}`);
311
+ } finally {
312
+ run.span.end();
313
+ }
314
+ }
315
+ function attachRunToIteration(stream, run) {
316
+ if (typeof stream !== "object" || stream === null) {
317
+ endRun(run);
318
+ return stream;
319
+ }
320
+ const iterable = stream;
321
+ const originalIterator = iterable[Symbol.asyncIterator];
322
+ if (typeof originalIterator !== "function") {
323
+ endRun(run);
324
+ return stream;
325
+ }
326
+ let settled = false;
327
+ const settle = (error) => {
328
+ if (settled) {
329
+ return;
330
+ }
331
+ settled = true;
332
+ endRun(run, error);
333
+ };
334
+ Object.defineProperty(iterable, Symbol.asyncIterator, {
335
+ configurable: true,
336
+ writable: true,
337
+ value: function brizzCheckpointIterator() {
338
+ const inner = originalIterator.call(this);
339
+ return {
340
+ [Symbol.asyncIterator]() {
341
+ return this;
342
+ },
343
+ async next(...args) {
344
+ let result;
345
+ try {
346
+ result = await _api.context.with(run.runContext, () => inner.next(...args));
347
+ } catch (error) {
348
+ settle(error);
349
+ throw error;
350
+ }
351
+ if (result.done) {
352
+ settle();
353
+ }
354
+ return result;
355
+ },
356
+ async return(value) {
357
+ try {
358
+ return inner.return ? await _api.context.with(run.runContext, () => inner.return(value)) : { value, done: true };
359
+ } finally {
360
+ settle();
361
+ }
362
+ },
363
+ async throw(error) {
364
+ try {
365
+ if (!inner.throw) {
366
+ throw error;
367
+ }
368
+ return await _api.context.with(run.runContext, () => inner.throw(error));
369
+ } finally {
370
+ settle(error);
371
+ }
372
+ }
373
+ };
374
+ }
375
+ });
376
+ return iterable;
377
+ }
378
+
379
+ // src/internal/instrumentation/auto-init.ts
92
380
  var exceptionLogger = (error) => {
93
381
  _chunkWC573FCIcjs.logger.error(`Exception in instrumentation: ${String(error)}`);
94
382
  };
@@ -130,7 +418,7 @@ function loadGenAIInstrumentations() {
130
418
  function loadMCPInstrumentation() {
131
419
  void (async () => {
132
420
  try {
133
- const { MCPInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("./mcp-CCFYA5CI.cjs")));
421
+ const { MCPInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("./mcp-M3WRCR7G.cjs")));
134
422
  const mcp = new MCPInstrumentation({ exceptionLogger });
135
423
  _instrumentation.registerInstrumentations.call(void 0, { instrumentations: [mcp] });
136
424
  _chunkWC573FCIcjs.logger.debug("Auto-loaded MCP instrumentation");
@@ -141,6 +429,14 @@ function loadMCPInstrumentation() {
141
429
  }
142
430
  })();
143
431
  }
432
+ function loadLangGraphInstrumentation() {
433
+ try {
434
+ _instrumentation.registerInstrumentations.call(void 0, { instrumentations: [new LangGraphInstrumentation()] });
435
+ _chunkWC573FCIcjs.logger.debug("Auto-loaded LangGraph instrumentation");
436
+ } catch (error) {
437
+ _chunkWC573FCIcjs.logger.debug(`LangGraph instrumentation not loaded: ${String(error)}`);
438
+ }
439
+ }
144
440
  function loadVertexAIInstrumentation() {
145
441
  void (async () => {
146
442
  try {
@@ -218,6 +514,7 @@ function autoInitializeInstrumentations() {
218
514
  try {
219
515
  const genAIInstrumentations = loadGenAIInstrumentations();
220
516
  loadMCPInstrumentation();
517
+ loadLangGraphInstrumentation();
221
518
  loadVertexAIInstrumentation();
222
519
  loadGoogleGenAIInstrumentation();
223
520
  loadVercelAITelemetry();
@@ -233,7 +530,7 @@ function autoInitializeInstrumentations() {
233
530
  var autoInstrumentationsLoaded = autoInitializeInstrumentations();
234
531
 
235
532
  // src/internal/sdk.ts
236
- var _api = require('@opentelemetry/api');
533
+
237
534
 
238
535
 
239
536
 
@@ -248,7 +545,7 @@ var _sdktracenode = require('@opentelemetry/sdk-trace-node');
248
545
 
249
546
  // src/internal/config.ts
250
547
  function resolveConfig(options) {
251
- const envLogLevel = process.env["BRIZZ_LOG_LEVEL"] || _optionalChain([options, 'access', _2 => _2.logLevel, 'optionalAccess', _3 => _3.toString, 'call', _4 => _4()]) || _chunkWC573FCIcjs.DEFAULT_LOG_LEVEL.toString();
548
+ const envLogLevel = process.env["BRIZZ_LOG_LEVEL"] || _optionalChain([options, 'access', _19 => _19.logLevel, 'optionalAccess', _20 => _20.toString, 'call', _21 => _21()]) || _chunkWC573FCIcjs.DEFAULT_LOG_LEVEL.toString();
252
549
  let resolvedLogLevel;
253
550
  if (envLogLevel) {
254
551
  resolvedLogLevel = _chunkWC573FCIcjs.parseLogLevel.call(void 0, envLogLevel);
@@ -419,7 +716,7 @@ function runMetadataFromContext() {
419
716
  return Object.keys(metadata).length > 0 ? metadata : void 0;
420
717
  }
421
718
  function patchCallbackManagerModule(module2) {
422
- const callbackManager = _optionalChain([module2, 'optionalAccess', _5 => _5.CallbackManager]);
719
+ const callbackManager = _optionalChain([module2, 'optionalAccess', _22 => _22.CallbackManager]);
423
720
  if (callbackManager === null || typeof callbackManager !== "function" && typeof callbackManager !== "object") {
424
721
  return false;
425
722
  }
@@ -459,7 +756,7 @@ function patchInstalledCallbackManager() {
459
756
  function restampLangChainSpan(span) {
460
757
  try {
461
758
  const scope = span.instrumentationScope;
462
- if (_optionalChain([scope, 'optionalAccess', _6 => _6.name]) !== SCOPE_NAME) {
759
+ if (_optionalChain([scope, 'optionalAccess', _23 => _23.name]) !== SCOPE_NAME) {
463
760
  return;
464
761
  }
465
762
  const attrs = span.attributes;
@@ -514,7 +811,7 @@ var InstrumentationRegistry = (_class = class _InstrumentationRegistry {construc
514
811
  * @private
515
812
  */
516
813
  loadManualInstrumentations(instrumentations, exceptionLogger2) {
517
- if (_optionalChain([this, 'access', _7 => _7.manualModules, 'optionalAccess', _8 => _8.openAI])) {
814
+ if (_optionalChain([this, 'access', _24 => _24.manualModules, 'optionalAccess', _25 => _25.openAI])) {
518
815
  try {
519
816
  const openAIInst = new (0, _openinferenceinstrumentationopenai.OpenAIInstrumentation)();
520
817
  openAIInst.manuallyInstrument(this.manualModules.openAI);
@@ -525,18 +822,18 @@ var InstrumentationRegistry = (_class = class _InstrumentationRegistry {construc
525
822
  }
526
823
  }
527
824
  const instrumentationConfigs = [
528
- { class: _instrumentationanthropic.AnthropicInstrumentation, name: "Anthropic", module: _optionalChain([this, 'access', _9 => _9.manualModules, 'optionalAccess', _10 => _10.anthropic]) },
529
- { class: _instrumentationcohere.CohereInstrumentation, name: "Cohere", module: _optionalChain([this, 'access', _11 => _11.manualModules, 'optionalAccess', _12 => _12.cohere]) },
530
- { class: _instrumentationbedrock.BedrockInstrumentation, name: "Bedrock", module: _optionalChain([this, 'access', _13 => _13.manualModules, 'optionalAccess', _14 => _14.bedrock]) },
531
- { class: _instrumentationpinecone.PineconeInstrumentation, name: "Pinecone", module: _optionalChain([this, 'access', _15 => _15.manualModules, 'optionalAccess', _16 => _16.pinecone]) },
825
+ { class: _instrumentationanthropic.AnthropicInstrumentation, name: "Anthropic", module: _optionalChain([this, 'access', _26 => _26.manualModules, 'optionalAccess', _27 => _27.anthropic]) },
826
+ { class: _instrumentationcohere.CohereInstrumentation, name: "Cohere", module: _optionalChain([this, 'access', _28 => _28.manualModules, 'optionalAccess', _29 => _29.cohere]) },
827
+ { class: _instrumentationbedrock.BedrockInstrumentation, name: "Bedrock", module: _optionalChain([this, 'access', _30 => _30.manualModules, 'optionalAccess', _31 => _31.bedrock]) },
828
+ { class: _instrumentationpinecone.PineconeInstrumentation, name: "Pinecone", module: _optionalChain([this, 'access', _32 => _32.manualModules, 'optionalAccess', _33 => _33.pinecone]) },
532
829
  {
533
830
  class: _instrumentationllamaindex.LlamaIndexInstrumentation,
534
831
  name: "LlamaIndex",
535
- module: _optionalChain([this, 'access', _17 => _17.manualModules, 'optionalAccess', _18 => _18.llamaindex])
832
+ module: _optionalChain([this, 'access', _34 => _34.manualModules, 'optionalAccess', _35 => _35.llamaindex])
536
833
  },
537
- { class: _instrumentationchromadb.ChromaDBInstrumentation, name: "ChromaDB", module: _optionalChain([this, 'access', _19 => _19.manualModules, 'optionalAccess', _20 => _20.chromadb]) },
538
- { class: _instrumentationqdrant.QdrantInstrumentation, name: "Qdrant", module: _optionalChain([this, 'access', _21 => _21.manualModules, 'optionalAccess', _22 => _22.qdrant]) },
539
- { class: _instrumentationtogether.TogetherInstrumentation, name: "Together", module: _optionalChain([this, 'access', _23 => _23.manualModules, 'optionalAccess', _24 => _24.together]) }
834
+ { class: _instrumentationchromadb.ChromaDBInstrumentation, name: "ChromaDB", module: _optionalChain([this, 'access', _36 => _36.manualModules, 'optionalAccess', _37 => _37.chromadb]) },
835
+ { class: _instrumentationqdrant.QdrantInstrumentation, name: "Qdrant", module: _optionalChain([this, 'access', _38 => _38.manualModules, 'optionalAccess', _39 => _39.qdrant]) },
836
+ { class: _instrumentationtogether.TogetherInstrumentation, name: "Together", module: _optionalChain([this, 'access', _40 => _40.manualModules, 'optionalAccess', _41 => _41.together]) }
540
837
  ];
541
838
  for (const config of instrumentationConfigs) {
542
839
  if (!config.module) {
@@ -552,7 +849,7 @@ var InstrumentationRegistry = (_class = class _InstrumentationRegistry {construc
552
849
  instrumentations.push(instrumentation);
553
850
  }
554
851
  }
555
- if (_optionalChain([this, 'access', _25 => _25.manualModules, 'optionalAccess', _26 => _26.langchain, 'optionalAccess', _27 => _27.callbackManagerModule])) {
852
+ if (_optionalChain([this, 'access', _42 => _42.manualModules, 'optionalAccess', _43 => _43.langchain, 'optionalAccess', _44 => _44.callbackManagerModule])) {
556
853
  const callbackManagerModule = this.manualModules.langchain.callbackManagerModule;
557
854
  void (async () => {
558
855
  try {
@@ -568,7 +865,15 @@ var InstrumentationRegistry = (_class = class _InstrumentationRegistry {construc
568
865
  }
569
866
  })();
570
867
  }
571
- if (_optionalChain([this, 'access', _28 => _28.manualModules, 'optionalAccess', _29 => _29.google_vertexai])) {
868
+ if (_optionalChain([this, 'access', _45 => _45.manualModules, 'optionalAccess', _46 => _46.langgraph])) {
869
+ try {
870
+ new LangGraphInstrumentation().manuallyInstrument(this.manualModules.langgraph);
871
+ _chunkWC573FCIcjs.logger.debug("Manual instrumentation enabled for LangGraph");
872
+ } catch (error) {
873
+ _chunkWC573FCIcjs.logger.error(`Failed to apply LangGraph instrumentation: ${String(error)}`);
874
+ }
875
+ }
876
+ if (_optionalChain([this, 'access', _47 => _47.manualModules, 'optionalAccess', _48 => _48.google_vertexai])) {
572
877
  const vertexModule = this.manualModules.google_vertexai;
573
878
  void (async () => {
574
879
  try {
@@ -583,7 +888,7 @@ var InstrumentationRegistry = (_class = class _InstrumentationRegistry {construc
583
888
  }
584
889
  })();
585
890
  }
586
- if (_optionalChain([this, 'access', _30 => _30.manualModules, 'optionalAccess', _31 => _31.google_genai])) {
891
+ if (_optionalChain([this, 'access', _49 => _49.manualModules, 'optionalAccess', _50 => _50.google_genai])) {
587
892
  const genaiModule = this.manualModules.google_genai;
588
893
  void (async () => {
589
894
  try {
@@ -598,11 +903,11 @@ var InstrumentationRegistry = (_class = class _InstrumentationRegistry {construc
598
903
  }
599
904
  })();
600
905
  }
601
- if (_optionalChain([this, 'access', _32 => _32.manualModules, 'optionalAccess', _33 => _33.mcp])) {
906
+ if (_optionalChain([this, 'access', _51 => _51.manualModules, 'optionalAccess', _52 => _52.mcp])) {
602
907
  const mcpModules = this.manualModules.mcp;
603
908
  void (async () => {
604
909
  try {
605
- const { MCPInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("./mcp-CCFYA5CI.cjs")));
910
+ const { MCPInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("./mcp-M3WRCR7G.cjs")));
606
911
  const instrumentation = new MCPInstrumentation({ exceptionLogger: exceptionLogger2 });
607
912
  instrumentation.manuallyInstrument(mcpModules);
608
913
  _chunkWC573FCIcjs.logger.debug("Manual instrumentation enabled for MCP");
@@ -678,8 +983,8 @@ function withProperties(properties, fn, thisArg) {
678
983
  function propagatePropertiesImperatively(properties, base = _api.context.active()) {
679
984
  try {
680
985
  const manager = _api.context;
681
- const mgr = _optionalChain([manager, 'access', _34 => _34._getContextManager, 'optionalCall', _35 => _35()]);
682
- const store = _optionalChain([mgr, 'optionalAccess', _36 => _36._asyncLocalStorage]);
986
+ const mgr = _optionalChain([manager, 'access', _53 => _53._getContextManager, 'optionalCall', _54 => _54()]);
987
+ const store = _optionalChain([mgr, 'optionalAccess', _55 => _55._asyncLocalStorage]);
683
988
  if (!store || typeof store.enterWith !== "function") {
684
989
  return;
685
990
  }
@@ -780,7 +1085,7 @@ function withServiceName(name, fn, thisArg) {
780
1085
  }
781
1086
  function resolveServiceNameFromContext() {
782
1087
  const props = _api.context.active().getValue(_chunk5WBPX342cjs.PROPERTIES_CONTEXT_KEY);
783
- return _optionalChain([props, 'optionalAccess', _37 => _37[_chunk5WBPX342cjs.SERVICE_NAME]]);
1088
+ return _optionalChain([props, 'optionalAccess', _56 => _56[_chunk5WBPX342cjs.SERVICE_NAME]]);
784
1089
  }
785
1090
  function userProperties(user) {
786
1091
  const properties = { [_chunk5WBPX342cjs.USER_ID]: user.id };
@@ -847,7 +1152,7 @@ function withMessageId(id, fn, thisArg) {
847
1152
  }
848
1153
  function inheritedMuteTools() {
849
1154
  const properties = _api.context.active().getValue(_chunk5WBPX342cjs.PROPERTIES_CONTEXT_KEY);
850
- return _optionalChain([properties, 'optionalAccess', _38 => _38[_chunk5WBPX342cjs.MUTE_TOOLS]]);
1155
+ return _optionalChain([properties, 'optionalAccess', _57 => _57[_chunk5WBPX342cjs.MUTE_TOOLS]]);
851
1156
  }
852
1157
  function muteProperties(options) {
853
1158
  const { input = true, output = true, tools = output } = options;
@@ -906,9 +1211,9 @@ var Session = (_class2 = class {
906
1211
  * @param text - Text to append (null becomes a null/"hide marker")
907
1212
  * @param context - Optional per-turn context bag to attach to this turn
908
1213
  */
909
- setInput(text, context6) {
1214
+ setInput(text, context7) {
910
1215
  this.inputs.push(text);
911
- this.inputContexts.push(_nullishCoalesce(context6, () => ( {})));
1216
+ this.inputContexts.push(_nullishCoalesce(context7, () => ( {})));
912
1217
  this.span.setAttribute(_chunk5WBPX342cjs.SESSION_INPUT, JSON.stringify(this.inputs));
913
1218
  this.span.setAttribute(_chunk5WBPX342cjs.SESSION_INPUT_CONTEXT, JSON.stringify(this.inputContexts));
914
1219
  }
@@ -922,9 +1227,9 @@ var Session = (_class2 = class {
922
1227
  * @param text - Text to append (null becomes a null/"hide marker")
923
1228
  * @param context - Optional per-turn context bag to attach to this turn
924
1229
  */
925
- setOutput(text, context6) {
1230
+ setOutput(text, context7) {
926
1231
  this.outputs.push(text);
927
- this.outputContexts.push(_nullishCoalesce(context6, () => ( {})));
1232
+ this.outputContexts.push(_nullishCoalesce(context7, () => ( {})));
928
1233
  this.span.setAttribute(_chunk5WBPX342cjs.SESSION_OUTPUT, JSON.stringify(this.outputs));
929
1234
  this.span.setAttribute(_chunk5WBPX342cjs.SESSION_OUTPUT_CONTEXT, JSON.stringify(this.outputContexts));
930
1235
  }
@@ -1009,7 +1314,7 @@ var Session = (_class2 = class {
1009
1314
  * (free-form category, defaults to `'generic'`)
1010
1315
  */
1011
1316
  addExternalLink(url, options) {
1012
- emitExternalLink(this.sessionId, url, _optionalChain([options, 'optionalAccess', _39 => _39.title]), _optionalChain([options, 'optionalAccess', _40 => _40.linkType]));
1317
+ emitExternalLink(this.sessionId, url, _optionalChain([options, 'optionalAccess', _58 => _58.title]), _optionalChain([options, 'optionalAccess', _59 => _59.linkType]));
1013
1318
  }
1014
1319
  }, _class2);
1015
1320
  var SessionTitle = class {
@@ -1035,11 +1340,11 @@ function resolveSessionIdFromContext() {
1035
1340
  return active.sessionId;
1036
1341
  }
1037
1342
  const props = _api.context.active().getValue(_chunk5WBPX342cjs.PROPERTIES_CONTEXT_KEY);
1038
- return _optionalChain([props, 'optionalAccess', _41 => _41[_chunk5WBPX342cjs.SESSION_ID]]);
1343
+ return _optionalChain([props, 'optionalAccess', _60 => _60[_chunk5WBPX342cjs.SESSION_ID]]);
1039
1344
  }
1040
1345
  function resolveMessageIdFromContext() {
1041
1346
  const props = _api.context.active().getValue(_chunk5WBPX342cjs.PROPERTIES_CONTEXT_KEY);
1042
- return _optionalChain([props, 'optionalAccess', _42 => _42[_chunk5WBPX342cjs.MESSAGE_ID]]);
1347
+ return _optionalChain([props, 'optionalAccess', _61 => _61[_chunk5WBPX342cjs.MESSAGE_ID]]);
1043
1348
  }
1044
1349
  function emitExternalLink(sessionId, url, title, linkType) {
1045
1350
  try {
@@ -1053,30 +1358,30 @@ function emitExternalLink(sessionId, url, title, linkType) {
1053
1358
  }
1054
1359
  }
1055
1360
  function addExternalLink(url, options) {
1056
- const sessionId = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _43 => _43.sessionId]), () => ( resolveSessionIdFromContext()));
1361
+ const sessionId = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _62 => _62.sessionId]), () => ( resolveSessionIdFromContext()));
1057
1362
  if (!sessionId) {
1058
1363
  _chunkWC573FCIcjs.logger.warn(
1059
1364
  "addExternalLink called without a resolvable session id; link dropped. Pass options.sessionId or call inside a startSession/callWithSessionId scope."
1060
1365
  );
1061
1366
  return;
1062
1367
  }
1063
- emitExternalLink(sessionId, url, _optionalChain([options, 'optionalAccess', _44 => _44.title]), _optionalChain([options, 'optionalAccess', _45 => _45.linkType]));
1368
+ emitExternalLink(sessionId, url, _optionalChain([options, 'optionalAccess', _63 => _63.title]), _optionalChain([options, 'optionalAccess', _64 => _64.linkType]));
1064
1369
  }
1065
1370
  function recordFeedback(type, options) {
1066
1371
  const eventAttributes = { [_chunk5WBPX342cjs.FEEDBACK_TYPE]: type };
1067
- if (_optionalChain([options, 'optionalAccess', _46 => _46.score]) !== void 0) {
1372
+ if (_optionalChain([options, 'optionalAccess', _65 => _65.score]) !== void 0) {
1068
1373
  eventAttributes[_chunk5WBPX342cjs.FEEDBACK_SCORE] = options.score;
1069
1374
  }
1070
- if (_optionalChain([options, 'optionalAccess', _47 => _47.reason]) !== void 0) {
1375
+ if (_optionalChain([options, 'optionalAccess', _66 => _66.reason]) !== void 0) {
1071
1376
  eventAttributes[_chunk5WBPX342cjs.FEEDBACK_REASON] = options.reason;
1072
1377
  }
1073
- if (_optionalChain([options, 'optionalAccess', _48 => _48.comment]) !== void 0) {
1378
+ if (_optionalChain([options, 'optionalAccess', _67 => _67.comment]) !== void 0) {
1074
1379
  eventAttributes[_chunk5WBPX342cjs.FEEDBACK_COMMENT] = options.comment;
1075
1380
  }
1076
- if (_optionalChain([options, 'optionalAccess', _49 => _49.source]) !== void 0) {
1381
+ if (_optionalChain([options, 'optionalAccess', _68 => _68.source]) !== void 0) {
1077
1382
  eventAttributes[_chunk5WBPX342cjs.FEEDBACK_SOURCE] = options.source;
1078
1383
  }
1079
- if (_optionalChain([options, 'optionalAccess', _50 => _50.attributes])) {
1384
+ if (_optionalChain([options, 'optionalAccess', _69 => _69.attributes])) {
1080
1385
  for (const [key, value] of Object.entries(options.attributes)) {
1081
1386
  const k = `${_chunk5WBPX342cjs.FEEDBACK_ATTR_PREFIX}${key}`;
1082
1387
  if (eventAttributes[k] === void 0) {
@@ -1084,8 +1389,8 @@ function recordFeedback(type, options) {
1084
1389
  }
1085
1390
  }
1086
1391
  }
1087
- const messageId = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _51 => _51.messageId]), () => ( resolveMessageIdFromContext()));
1088
- const sessionId = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _52 => _52.sessionId]), () => ( resolveSessionIdFromContext()));
1392
+ const messageId = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _70 => _70.messageId]), () => ( resolveMessageIdFromContext()));
1393
+ const sessionId = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _71 => _71.sessionId]), () => ( resolveSessionIdFromContext()));
1089
1394
  if (messageId === void 0 && sessionId === void 0) {
1090
1395
  _chunkWC573FCIcjs.logger.warn(
1091
1396
  "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."
@@ -1116,7 +1421,7 @@ function recordMetric(options) {
1116
1421
  try {
1117
1422
  recordMetricImpl(options);
1118
1423
  } catch (error) {
1119
- _chunkWC573FCIcjs.logger.warn(`recordMetric(${JSON.stringify(_optionalChain([options, 'optionalAccess', _53 => _53.name]))}) failed; metric dropped.`, error);
1424
+ _chunkWC573FCIcjs.logger.warn(`recordMetric(${JSON.stringify(_optionalChain([options, 'optionalAccess', _72 => _72.name]))}) failed; metric dropped.`, error);
1120
1425
  }
1121
1426
  }
1122
1427
  function recordMetricImpl(options) {
@@ -1231,7 +1536,7 @@ function recordMetricImpl(options) {
1231
1536
  }
1232
1537
  }
1233
1538
  function startSession(sessionId, callback, extraProperties, options) {
1234
- const isTitle = _optionalChain([options, 'optionalAccess', _54 => _54.mode]) === "title";
1539
+ const isTitle = _optionalChain([options, 'optionalAccess', _73 => _73.mode]) === "title";
1235
1540
  const spanName = isTitle ? _chunk5WBPX342cjs.SESSION_TITLE_SPAN_NAME : _chunk5WBPX342cjs.SESSION_SPAN_NAME;
1236
1541
  const tracer = _api.trace.getTracer("@brizz/sdk");
1237
1542
  return tracer.startActiveSpan(spanName, (span) => {
@@ -1280,7 +1585,7 @@ function startSession(sessionId, callback, extraProperties, options) {
1280
1585
  });
1281
1586
  }
1282
1587
  function startSessionTitle(callback, options) {
1283
- const resolvedSessionId = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _55 => _55.sessionId]), () => ( _optionalChain([getActiveSession, 'call', _56 => _56(), 'optionalAccess', _57 => _57.sessionId])));
1588
+ const resolvedSessionId = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _74 => _74.sessionId]), () => ( _optionalChain([getActiveSession, 'call', _75 => _75(), 'optionalAccess', _76 => _76.sessionId])));
1284
1589
  const tracer = _api.trace.getTracer("@brizz/sdk");
1285
1590
  return tracer.startActiveSpan(_chunk5WBPX342cjs.SESSION_TITLE_SPAN_NAME, (span) => {
1286
1591
  if (resolvedSessionId) {
@@ -1752,7 +2057,7 @@ var BrizzSimpleLogRecordProcessor = class extends _sdklogs.SimpleLogRecordProces
1752
2057
  this.config = config;
1753
2058
  }
1754
2059
  onEmit(logRecord) {
1755
- const maskingConfig = _optionalChain([this, 'access', _58 => _58.config, 'access', _59 => _59.masking, 'optionalAccess', _60 => _60.eventMasking]);
2060
+ const maskingConfig = _optionalChain([this, 'access', _77 => _77.config, 'access', _78 => _78.masking, 'optionalAccess', _79 => _79.eventMasking]);
1756
2061
  if (maskingConfig) {
1757
2062
  maskLog(logRecord, maskingConfig);
1758
2063
  }
@@ -1772,7 +2077,7 @@ var BrizzBatchLogRecordProcessor = class extends _sdklogs.BatchLogRecordProcesso
1772
2077
  this.config = config;
1773
2078
  }
1774
2079
  onEmit(logRecord) {
1775
- const maskingConfig = _optionalChain([this, 'access', _61 => _61.config, 'access', _62 => _62.masking, 'optionalAccess', _63 => _63.eventMasking]);
2080
+ const maskingConfig = _optionalChain([this, 'access', _80 => _80.config, 'access', _81 => _81.masking, 'optionalAccess', _82 => _82.eventMasking]);
1776
2081
  if (maskingConfig) {
1777
2082
  maskLog(logRecord, maskingConfig);
1778
2083
  }
@@ -1864,14 +2169,14 @@ var LoggingModule = (_class3 = class _LoggingModule {constructor() { _class3.pro
1864
2169
  _chunkWC573FCIcjs.logger.debug("Creating logger provider", {
1865
2170
  serviceName,
1866
2171
  disableBatch: config.disableBatch,
1867
- hasMasking: !!_optionalChain([config, 'access', _64 => _64.masking, 'optionalAccess', _65 => _65.eventMasking])
2172
+ hasMasking: !!_optionalChain([config, 'access', _83 => _83.masking, 'optionalAccess', _84 => _84.eventMasking])
1868
2173
  });
1869
2174
  const exporter = this.createLogExporter(config, serviceName);
1870
2175
  const processor = config.disableBatch ? new BrizzSimpleLogRecordProcessor(exporter, config) : new BrizzBatchLogRecordProcessor(exporter, config);
1871
2176
  const resourceAttributes = {
1872
2177
  ...config.resourceAttributes,
1873
2178
  "service.name": serviceName,
1874
- [BRIZZ_SDK_VERSION]: _chunkCBEDIRVKcjs.getSDKVersion.call(void 0, ),
2179
+ [BRIZZ_SDK_VERSION]: _chunkVFWTFL7Ecjs.getSDKVersion.call(void 0, ),
1875
2180
  [BRIZZ_SDK_LANGUAGE]: SDK_LANGUAGE
1876
2181
  };
1877
2182
  if (config.environment) {
@@ -2120,7 +2425,7 @@ var BrizzSpanExporter = (_class5 = class {
2120
2425
  const resourceAttrs = {
2121
2426
  ...config.resourceAttributes,
2122
2427
  "service.name": config.appName,
2123
- [BRIZZ_SDK_VERSION]: _chunkCBEDIRVKcjs.getSDKVersion.call(void 0, ),
2428
+ [BRIZZ_SDK_VERSION]: _chunkVFWTFL7Ecjs.getSDKVersion.call(void 0, ),
2124
2429
  [BRIZZ_SDK_LANGUAGE]: SDK_LANGUAGE
2125
2430
  };
2126
2431
  if (config.environment) {
@@ -2247,8 +2552,8 @@ var BrizzSpanExporter = (_class5 = class {
2247
2552
  }
2248
2553
  async forceFlush() {
2249
2554
  await Promise.all([
2250
- _optionalChain([this, 'access', _66 => _66._delegate, 'access', _67 => _67.forceFlush, 'optionalCall', _68 => _68()]),
2251
- ...[...this._delegates.values()].map(async (delegate) => _optionalChain([delegate, 'access', _69 => _69.forceFlush, 'optionalCall', _70 => _70()]))
2555
+ _optionalChain([this, 'access', _85 => _85._delegate, 'access', _86 => _86.forceFlush, 'optionalCall', _87 => _87()]),
2556
+ ...[...this._delegates.values()].map(async (delegate) => _optionalChain([delegate, 'access', _88 => _88.forceFlush, 'optionalCall', _89 => _89()]))
2252
2557
  ]);
2253
2558
  }
2254
2559
  }, _class5);
@@ -2285,7 +2590,7 @@ var BrizzSimpleSpanProcessor = class extends _sdktracebase.SimpleSpanProcessor {
2285
2590
  }
2286
2591
  onEnd(span) {
2287
2592
  restampLangChainSpan(span);
2288
- const maskingConfig = _optionalChain([this, 'access', _71 => _71.config, 'access', _72 => _72.masking, 'optionalAccess', _73 => _73.spanMasking]);
2593
+ const maskingConfig = _optionalChain([this, 'access', _90 => _90.config, 'access', _91 => _91.masking, 'optionalAccess', _92 => _92.spanMasking]);
2289
2594
  if (maskingConfig) {
2290
2595
  maskReadableSpan(span, maskingConfig);
2291
2596
  }
@@ -2304,7 +2609,7 @@ var BrizzBatchSpanProcessor = class extends _sdktracebase.BatchSpanProcessor {
2304
2609
  }
2305
2610
  onEnd(span) {
2306
2611
  restampLangChainSpan(span);
2307
- const maskingConfig = _optionalChain([this, 'access', _74 => _74.config, 'access', _75 => _75.masking, 'optionalAccess', _76 => _76.spanMasking]);
2612
+ const maskingConfig = _optionalChain([this, 'access', _93 => _93.config, 'access', _94 => _94.masking, 'optionalAccess', _95 => _95.spanMasking]);
2308
2613
  if (maskingConfig) {
2309
2614
  maskReadableSpan(span, maskingConfig);
2310
2615
  }
@@ -2391,7 +2696,7 @@ var TracingModule = (_class6 = class _TracingModule {constructor() { _class6.pro
2391
2696
  }
2392
2697
  _chunkWC573FCIcjs.logger.debug("Initializing span processor", {
2393
2698
  disableBatch: config.disableBatch,
2394
- hasMasking: !!_optionalChain([config, 'access', _77 => _77.masking, 'optionalAccess', _78 => _78.spanMasking])
2699
+ hasMasking: !!_optionalChain([config, 'access', _96 => _96.masking, 'optionalAccess', _97 => _97.spanMasking])
2395
2700
  });
2396
2701
  const spanProcessor = config.disableBatch ? new BrizzSimpleSpanProcessor(this.spanExporter, config) : new BrizzBatchSpanProcessor(this.spanExporter, config);
2397
2702
  _chunkWC573FCIcjs.logger.debug("Span processor initialized successfully");
@@ -2611,7 +2916,7 @@ var _Brizz = (_class7 = class __Brizz {constructor() { _class7.prototype.__init1
2611
2916
  */
2612
2917
  setupInstrumentation(options) {
2613
2918
  const registry = InstrumentationRegistry.getInstance();
2614
- _chunkCBEDIRVKcjs.configure.call(void 0, resolveMcpSessionTracking(options.mcpSessionTracking));
2919
+ _chunkVFWTFL7Ecjs.configure.call(void 0, resolveMcpSessionTracking(options.mcpSessionTracking));
2615
2920
  patchInstalledCallbackManager();
2616
2921
  if (options.instrumentModules && Object.keys(options.instrumentModules).length > 0) {
2617
2922
  registry.setManualModules(options.instrumentModules);
@@ -2635,7 +2940,7 @@ var _Brizz = (_class7 = class __Brizz {constructor() { _class7.prototype.__init1
2635
2940
  const resourceAttributes = {
2636
2941
  ...resolvedConfig.resourceAttributes,
2637
2942
  "service.name": resolvedConfig.appName,
2638
- [BRIZZ_SDK_VERSION]: _chunkCBEDIRVKcjs.getSDKVersion.call(void 0, ),
2943
+ [BRIZZ_SDK_VERSION]: _chunkVFWTFL7Ecjs.getSDKVersion.call(void 0, ),
2639
2944
  [BRIZZ_SDK_LANGUAGE]: SDK_LANGUAGE
2640
2945
  };
2641
2946
  if (resolvedConfig.environment) {
@@ -2783,10 +3088,10 @@ var _Brizz = (_class7 = class __Brizz {constructor() { _class7.prototype.__init1
2783
3088
  }
2784
3089
  try {
2785
3090
  await this.shutdownModules();
2786
- await _optionalChain([this, 'access', _79 => _79._tracerProvider, 'optionalAccess', _80 => _80.forceFlush, 'call', _81 => _81()]);
2787
- await _optionalChain([this, 'access', _82 => _82._tracerProvider, 'optionalAccess', _83 => _83.shutdown, 'call', _84 => _84()]);
2788
- await _optionalChain([this, 'access', _85 => _85._meterProvider, 'optionalAccess', _86 => _86.forceFlush, 'call', _87 => _87()]);
2789
- await _optionalChain([this, 'access', _88 => _88._meterProvider, 'optionalAccess', _89 => _89.shutdown, 'call', _90 => _90()]);
3091
+ await _optionalChain([this, 'access', _98 => _98._tracerProvider, 'optionalAccess', _99 => _99.forceFlush, 'call', _100 => _100()]);
3092
+ await _optionalChain([this, 'access', _101 => _101._tracerProvider, 'optionalAccess', _102 => _102.shutdown, 'call', _103 => _103()]);
3093
+ await _optionalChain([this, 'access', _104 => _104._meterProvider, 'optionalAccess', _105 => _105.forceFlush, 'call', _106 => _106()]);
3094
+ await _optionalChain([this, 'access', _107 => _107._meterProvider, 'optionalAccess', _108 => _108.shutdown, 'call', _109 => _109()]);
2790
3095
  this._initialized = false;
2791
3096
  this._tracerProvider = null;
2792
3097
  this._meterProvider = null;