@brizz/sdk 0.1.45 → 0.1.47

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 _chunkEWT4TUB7cjs = require('./chunk-EWT4TUB7.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 = _chunkEWT4TUB7cjs.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-3FOEDOF2.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);
@@ -396,6 +693,7 @@ var SDK_LANGUAGE = "typescript";
396
693
 
397
694
 
398
695
  // src/internal/instrumentation/langchain.ts
696
+ var _module = require('module');
399
697
 
400
698
  var SCOPE_NAME = "@arizeai/openinference-instrumentation-langchain";
401
699
  var PATCHED_MARKER = /* @__PURE__ */ Symbol.for("brizz.langchain.callbackManagerPatched");
@@ -419,7 +717,7 @@ function runMetadataFromContext() {
419
717
  return Object.keys(metadata).length > 0 ? metadata : void 0;
420
718
  }
421
719
  function patchCallbackManagerModule(module2) {
422
- const callbackManager = _optionalChain([module2, 'optionalAccess', _5 => _5.CallbackManager]);
720
+ const callbackManager = _optionalChain([module2, 'optionalAccess', _22 => _22.CallbackManager]);
423
721
  if (callbackManager === null || typeof callbackManager !== "function" && typeof callbackManager !== "object") {
424
722
  return false;
425
723
  }
@@ -454,12 +752,18 @@ function patchInstalledCallbackManager() {
454
752
  } catch (error) {
455
753
  _chunkWC573FCIcjs.logger.debug(`LangChain callback manager not patched: ${String(error)}`);
456
754
  }
755
+ try {
756
+ const requireFromSdk = _module.createRequire.call(void 0, __filename);
757
+ patchCallbackManagerModule(requireFromSdk("@langchain/core/callbacks/manager"));
758
+ } catch (error) {
759
+ _chunkWC573FCIcjs.logger.debug(`LangChain CJS callback manager not patched: ${String(error)}`);
760
+ }
457
761
  })();
458
762
  }
459
763
  function restampLangChainSpan(span) {
460
764
  try {
461
765
  const scope = span.instrumentationScope;
462
- if (_optionalChain([scope, 'optionalAccess', _6 => _6.name]) !== SCOPE_NAME) {
766
+ if (_optionalChain([scope, 'optionalAccess', _23 => _23.name]) !== SCOPE_NAME) {
463
767
  return;
464
768
  }
465
769
  const attrs = span.attributes;
@@ -514,7 +818,7 @@ var InstrumentationRegistry = (_class = class _InstrumentationRegistry {construc
514
818
  * @private
515
819
  */
516
820
  loadManualInstrumentations(instrumentations, exceptionLogger2) {
517
- if (_optionalChain([this, 'access', _7 => _7.manualModules, 'optionalAccess', _8 => _8.openAI])) {
821
+ if (_optionalChain([this, 'access', _24 => _24.manualModules, 'optionalAccess', _25 => _25.openAI])) {
518
822
  try {
519
823
  const openAIInst = new (0, _openinferenceinstrumentationopenai.OpenAIInstrumentation)();
520
824
  openAIInst.manuallyInstrument(this.manualModules.openAI);
@@ -525,18 +829,18 @@ var InstrumentationRegistry = (_class = class _InstrumentationRegistry {construc
525
829
  }
526
830
  }
527
831
  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]) },
832
+ { class: _instrumentationanthropic.AnthropicInstrumentation, name: "Anthropic", module: _optionalChain([this, 'access', _26 => _26.manualModules, 'optionalAccess', _27 => _27.anthropic]) },
833
+ { class: _instrumentationcohere.CohereInstrumentation, name: "Cohere", module: _optionalChain([this, 'access', _28 => _28.manualModules, 'optionalAccess', _29 => _29.cohere]) },
834
+ { class: _instrumentationbedrock.BedrockInstrumentation, name: "Bedrock", module: _optionalChain([this, 'access', _30 => _30.manualModules, 'optionalAccess', _31 => _31.bedrock]) },
835
+ { class: _instrumentationpinecone.PineconeInstrumentation, name: "Pinecone", module: _optionalChain([this, 'access', _32 => _32.manualModules, 'optionalAccess', _33 => _33.pinecone]) },
532
836
  {
533
837
  class: _instrumentationllamaindex.LlamaIndexInstrumentation,
534
838
  name: "LlamaIndex",
535
- module: _optionalChain([this, 'access', _17 => _17.manualModules, 'optionalAccess', _18 => _18.llamaindex])
839
+ module: _optionalChain([this, 'access', _34 => _34.manualModules, 'optionalAccess', _35 => _35.llamaindex])
536
840
  },
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]) }
841
+ { class: _instrumentationchromadb.ChromaDBInstrumentation, name: "ChromaDB", module: _optionalChain([this, 'access', _36 => _36.manualModules, 'optionalAccess', _37 => _37.chromadb]) },
842
+ { class: _instrumentationqdrant.QdrantInstrumentation, name: "Qdrant", module: _optionalChain([this, 'access', _38 => _38.manualModules, 'optionalAccess', _39 => _39.qdrant]) },
843
+ { class: _instrumentationtogether.TogetherInstrumentation, name: "Together", module: _optionalChain([this, 'access', _40 => _40.manualModules, 'optionalAccess', _41 => _41.together]) }
540
844
  ];
541
845
  for (const config of instrumentationConfigs) {
542
846
  if (!config.module) {
@@ -552,7 +856,7 @@ var InstrumentationRegistry = (_class = class _InstrumentationRegistry {construc
552
856
  instrumentations.push(instrumentation);
553
857
  }
554
858
  }
555
- if (_optionalChain([this, 'access', _25 => _25.manualModules, 'optionalAccess', _26 => _26.langchain, 'optionalAccess', _27 => _27.callbackManagerModule])) {
859
+ if (_optionalChain([this, 'access', _42 => _42.manualModules, 'optionalAccess', _43 => _43.langchain, 'optionalAccess', _44 => _44.callbackManagerModule])) {
556
860
  const callbackManagerModule = this.manualModules.langchain.callbackManagerModule;
557
861
  void (async () => {
558
862
  try {
@@ -568,7 +872,15 @@ var InstrumentationRegistry = (_class = class _InstrumentationRegistry {construc
568
872
  }
569
873
  })();
570
874
  }
571
- if (_optionalChain([this, 'access', _28 => _28.manualModules, 'optionalAccess', _29 => _29.google_vertexai])) {
875
+ if (_optionalChain([this, 'access', _45 => _45.manualModules, 'optionalAccess', _46 => _46.langgraph])) {
876
+ try {
877
+ new LangGraphInstrumentation().manuallyInstrument(this.manualModules.langgraph);
878
+ _chunkWC573FCIcjs.logger.debug("Manual instrumentation enabled for LangGraph");
879
+ } catch (error) {
880
+ _chunkWC573FCIcjs.logger.error(`Failed to apply LangGraph instrumentation: ${String(error)}`);
881
+ }
882
+ }
883
+ if (_optionalChain([this, 'access', _47 => _47.manualModules, 'optionalAccess', _48 => _48.google_vertexai])) {
572
884
  const vertexModule = this.manualModules.google_vertexai;
573
885
  void (async () => {
574
886
  try {
@@ -583,7 +895,7 @@ var InstrumentationRegistry = (_class = class _InstrumentationRegistry {construc
583
895
  }
584
896
  })();
585
897
  }
586
- if (_optionalChain([this, 'access', _30 => _30.manualModules, 'optionalAccess', _31 => _31.google_genai])) {
898
+ if (_optionalChain([this, 'access', _49 => _49.manualModules, 'optionalAccess', _50 => _50.google_genai])) {
587
899
  const genaiModule = this.manualModules.google_genai;
588
900
  void (async () => {
589
901
  try {
@@ -598,11 +910,11 @@ var InstrumentationRegistry = (_class = class _InstrumentationRegistry {construc
598
910
  }
599
911
  })();
600
912
  }
601
- if (_optionalChain([this, 'access', _32 => _32.manualModules, 'optionalAccess', _33 => _33.mcp])) {
913
+ if (_optionalChain([this, 'access', _51 => _51.manualModules, 'optionalAccess', _52 => _52.mcp])) {
602
914
  const mcpModules = this.manualModules.mcp;
603
915
  void (async () => {
604
916
  try {
605
- const { MCPInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("./mcp-CCFYA5CI.cjs")));
917
+ const { MCPInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("./mcp-3FOEDOF2.cjs")));
606
918
  const instrumentation = new MCPInstrumentation({ exceptionLogger: exceptionLogger2 });
607
919
  instrumentation.manuallyInstrument(mcpModules);
608
920
  _chunkWC573FCIcjs.logger.debug("Manual instrumentation enabled for MCP");
@@ -678,8 +990,8 @@ function withProperties(properties, fn, thisArg) {
678
990
  function propagatePropertiesImperatively(properties, base = _api.context.active()) {
679
991
  try {
680
992
  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]);
993
+ const mgr = _optionalChain([manager, 'access', _53 => _53._getContextManager, 'optionalCall', _54 => _54()]);
994
+ const store = _optionalChain([mgr, 'optionalAccess', _55 => _55._asyncLocalStorage]);
683
995
  if (!store || typeof store.enterWith !== "function") {
684
996
  return;
685
997
  }
@@ -780,7 +1092,7 @@ function withServiceName(name, fn, thisArg) {
780
1092
  }
781
1093
  function resolveServiceNameFromContext() {
782
1094
  const props = _api.context.active().getValue(_chunk5WBPX342cjs.PROPERTIES_CONTEXT_KEY);
783
- return _optionalChain([props, 'optionalAccess', _37 => _37[_chunk5WBPX342cjs.SERVICE_NAME]]);
1095
+ return _optionalChain([props, 'optionalAccess', _56 => _56[_chunk5WBPX342cjs.SERVICE_NAME]]);
784
1096
  }
785
1097
  function userProperties(user) {
786
1098
  const properties = { [_chunk5WBPX342cjs.USER_ID]: user.id };
@@ -847,7 +1159,7 @@ function withMessageId(id, fn, thisArg) {
847
1159
  }
848
1160
  function inheritedMuteTools() {
849
1161
  const properties = _api.context.active().getValue(_chunk5WBPX342cjs.PROPERTIES_CONTEXT_KEY);
850
- return _optionalChain([properties, 'optionalAccess', _38 => _38[_chunk5WBPX342cjs.MUTE_TOOLS]]);
1162
+ return _optionalChain([properties, 'optionalAccess', _57 => _57[_chunk5WBPX342cjs.MUTE_TOOLS]]);
851
1163
  }
852
1164
  function muteProperties(options) {
853
1165
  const { input = true, output = true, tools = output } = options;
@@ -906,9 +1218,9 @@ var Session = (_class2 = class {
906
1218
  * @param text - Text to append (null becomes a null/"hide marker")
907
1219
  * @param context - Optional per-turn context bag to attach to this turn
908
1220
  */
909
- setInput(text, context6) {
1221
+ setInput(text, context7) {
910
1222
  this.inputs.push(text);
911
- this.inputContexts.push(_nullishCoalesce(context6, () => ( {})));
1223
+ this.inputContexts.push(_nullishCoalesce(context7, () => ( {})));
912
1224
  this.span.setAttribute(_chunk5WBPX342cjs.SESSION_INPUT, JSON.stringify(this.inputs));
913
1225
  this.span.setAttribute(_chunk5WBPX342cjs.SESSION_INPUT_CONTEXT, JSON.stringify(this.inputContexts));
914
1226
  }
@@ -922,9 +1234,9 @@ var Session = (_class2 = class {
922
1234
  * @param text - Text to append (null becomes a null/"hide marker")
923
1235
  * @param context - Optional per-turn context bag to attach to this turn
924
1236
  */
925
- setOutput(text, context6) {
1237
+ setOutput(text, context7) {
926
1238
  this.outputs.push(text);
927
- this.outputContexts.push(_nullishCoalesce(context6, () => ( {})));
1239
+ this.outputContexts.push(_nullishCoalesce(context7, () => ( {})));
928
1240
  this.span.setAttribute(_chunk5WBPX342cjs.SESSION_OUTPUT, JSON.stringify(this.outputs));
929
1241
  this.span.setAttribute(_chunk5WBPX342cjs.SESSION_OUTPUT_CONTEXT, JSON.stringify(this.outputContexts));
930
1242
  }
@@ -1009,7 +1321,7 @@ var Session = (_class2 = class {
1009
1321
  * (free-form category, defaults to `'generic'`)
1010
1322
  */
1011
1323
  addExternalLink(url, options) {
1012
- emitExternalLink(this.sessionId, url, _optionalChain([options, 'optionalAccess', _39 => _39.title]), _optionalChain([options, 'optionalAccess', _40 => _40.linkType]));
1324
+ emitExternalLink(this.sessionId, url, _optionalChain([options, 'optionalAccess', _58 => _58.title]), _optionalChain([options, 'optionalAccess', _59 => _59.linkType]));
1013
1325
  }
1014
1326
  }, _class2);
1015
1327
  var SessionTitle = class {
@@ -1035,11 +1347,11 @@ function resolveSessionIdFromContext() {
1035
1347
  return active.sessionId;
1036
1348
  }
1037
1349
  const props = _api.context.active().getValue(_chunk5WBPX342cjs.PROPERTIES_CONTEXT_KEY);
1038
- return _optionalChain([props, 'optionalAccess', _41 => _41[_chunk5WBPX342cjs.SESSION_ID]]);
1350
+ return _optionalChain([props, 'optionalAccess', _60 => _60[_chunk5WBPX342cjs.SESSION_ID]]);
1039
1351
  }
1040
1352
  function resolveMessageIdFromContext() {
1041
1353
  const props = _api.context.active().getValue(_chunk5WBPX342cjs.PROPERTIES_CONTEXT_KEY);
1042
- return _optionalChain([props, 'optionalAccess', _42 => _42[_chunk5WBPX342cjs.MESSAGE_ID]]);
1354
+ return _optionalChain([props, 'optionalAccess', _61 => _61[_chunk5WBPX342cjs.MESSAGE_ID]]);
1043
1355
  }
1044
1356
  function emitExternalLink(sessionId, url, title, linkType) {
1045
1357
  try {
@@ -1053,30 +1365,30 @@ function emitExternalLink(sessionId, url, title, linkType) {
1053
1365
  }
1054
1366
  }
1055
1367
  function addExternalLink(url, options) {
1056
- const sessionId = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _43 => _43.sessionId]), () => ( resolveSessionIdFromContext()));
1368
+ const sessionId = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _62 => _62.sessionId]), () => ( resolveSessionIdFromContext()));
1057
1369
  if (!sessionId) {
1058
1370
  _chunkWC573FCIcjs.logger.warn(
1059
1371
  "addExternalLink called without a resolvable session id; link dropped. Pass options.sessionId or call inside a startSession/callWithSessionId scope."
1060
1372
  );
1061
1373
  return;
1062
1374
  }
1063
- emitExternalLink(sessionId, url, _optionalChain([options, 'optionalAccess', _44 => _44.title]), _optionalChain([options, 'optionalAccess', _45 => _45.linkType]));
1375
+ emitExternalLink(sessionId, url, _optionalChain([options, 'optionalAccess', _63 => _63.title]), _optionalChain([options, 'optionalAccess', _64 => _64.linkType]));
1064
1376
  }
1065
1377
  function recordFeedback(type, options) {
1066
1378
  const eventAttributes = { [_chunk5WBPX342cjs.FEEDBACK_TYPE]: type };
1067
- if (_optionalChain([options, 'optionalAccess', _46 => _46.score]) !== void 0) {
1379
+ if (_optionalChain([options, 'optionalAccess', _65 => _65.score]) !== void 0) {
1068
1380
  eventAttributes[_chunk5WBPX342cjs.FEEDBACK_SCORE] = options.score;
1069
1381
  }
1070
- if (_optionalChain([options, 'optionalAccess', _47 => _47.reason]) !== void 0) {
1382
+ if (_optionalChain([options, 'optionalAccess', _66 => _66.reason]) !== void 0) {
1071
1383
  eventAttributes[_chunk5WBPX342cjs.FEEDBACK_REASON] = options.reason;
1072
1384
  }
1073
- if (_optionalChain([options, 'optionalAccess', _48 => _48.comment]) !== void 0) {
1385
+ if (_optionalChain([options, 'optionalAccess', _67 => _67.comment]) !== void 0) {
1074
1386
  eventAttributes[_chunk5WBPX342cjs.FEEDBACK_COMMENT] = options.comment;
1075
1387
  }
1076
- if (_optionalChain([options, 'optionalAccess', _49 => _49.source]) !== void 0) {
1388
+ if (_optionalChain([options, 'optionalAccess', _68 => _68.source]) !== void 0) {
1077
1389
  eventAttributes[_chunk5WBPX342cjs.FEEDBACK_SOURCE] = options.source;
1078
1390
  }
1079
- if (_optionalChain([options, 'optionalAccess', _50 => _50.attributes])) {
1391
+ if (_optionalChain([options, 'optionalAccess', _69 => _69.attributes])) {
1080
1392
  for (const [key, value] of Object.entries(options.attributes)) {
1081
1393
  const k = `${_chunk5WBPX342cjs.FEEDBACK_ATTR_PREFIX}${key}`;
1082
1394
  if (eventAttributes[k] === void 0) {
@@ -1084,8 +1396,8 @@ function recordFeedback(type, options) {
1084
1396
  }
1085
1397
  }
1086
1398
  }
1087
- const messageId = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _51 => _51.messageId]), () => ( resolveMessageIdFromContext()));
1088
- const sessionId = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _52 => _52.sessionId]), () => ( resolveSessionIdFromContext()));
1399
+ const messageId = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _70 => _70.messageId]), () => ( resolveMessageIdFromContext()));
1400
+ const sessionId = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _71 => _71.sessionId]), () => ( resolveSessionIdFromContext()));
1089
1401
  if (messageId === void 0 && sessionId === void 0) {
1090
1402
  _chunkWC573FCIcjs.logger.warn(
1091
1403
  "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 +1428,7 @@ function recordMetric(options) {
1116
1428
  try {
1117
1429
  recordMetricImpl(options);
1118
1430
  } catch (error) {
1119
- _chunkWC573FCIcjs.logger.warn(`recordMetric(${JSON.stringify(_optionalChain([options, 'optionalAccess', _53 => _53.name]))}) failed; metric dropped.`, error);
1431
+ _chunkWC573FCIcjs.logger.warn(`recordMetric(${JSON.stringify(_optionalChain([options, 'optionalAccess', _72 => _72.name]))}) failed; metric dropped.`, error);
1120
1432
  }
1121
1433
  }
1122
1434
  function recordMetricImpl(options) {
@@ -1231,7 +1543,7 @@ function recordMetricImpl(options) {
1231
1543
  }
1232
1544
  }
1233
1545
  function startSession(sessionId, callback, extraProperties, options) {
1234
- const isTitle = _optionalChain([options, 'optionalAccess', _54 => _54.mode]) === "title";
1546
+ const isTitle = _optionalChain([options, 'optionalAccess', _73 => _73.mode]) === "title";
1235
1547
  const spanName = isTitle ? _chunk5WBPX342cjs.SESSION_TITLE_SPAN_NAME : _chunk5WBPX342cjs.SESSION_SPAN_NAME;
1236
1548
  const tracer = _api.trace.getTracer("@brizz/sdk");
1237
1549
  return tracer.startActiveSpan(spanName, (span) => {
@@ -1280,7 +1592,7 @@ function startSession(sessionId, callback, extraProperties, options) {
1280
1592
  });
1281
1593
  }
1282
1594
  function startSessionTitle(callback, options) {
1283
- const resolvedSessionId = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _55 => _55.sessionId]), () => ( _optionalChain([getActiveSession, 'call', _56 => _56(), 'optionalAccess', _57 => _57.sessionId])));
1595
+ const resolvedSessionId = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _74 => _74.sessionId]), () => ( _optionalChain([getActiveSession, 'call', _75 => _75(), 'optionalAccess', _76 => _76.sessionId])));
1284
1596
  const tracer = _api.trace.getTracer("@brizz/sdk");
1285
1597
  return tracer.startActiveSpan(_chunk5WBPX342cjs.SESSION_TITLE_SPAN_NAME, (span) => {
1286
1598
  if (resolvedSessionId) {
@@ -1752,7 +2064,7 @@ var BrizzSimpleLogRecordProcessor = class extends _sdklogs.SimpleLogRecordProces
1752
2064
  this.config = config;
1753
2065
  }
1754
2066
  onEmit(logRecord) {
1755
- const maskingConfig = _optionalChain([this, 'access', _58 => _58.config, 'access', _59 => _59.masking, 'optionalAccess', _60 => _60.eventMasking]);
2067
+ const maskingConfig = _optionalChain([this, 'access', _77 => _77.config, 'access', _78 => _78.masking, 'optionalAccess', _79 => _79.eventMasking]);
1756
2068
  if (maskingConfig) {
1757
2069
  maskLog(logRecord, maskingConfig);
1758
2070
  }
@@ -1772,7 +2084,7 @@ var BrizzBatchLogRecordProcessor = class extends _sdklogs.BatchLogRecordProcesso
1772
2084
  this.config = config;
1773
2085
  }
1774
2086
  onEmit(logRecord) {
1775
- const maskingConfig = _optionalChain([this, 'access', _61 => _61.config, 'access', _62 => _62.masking, 'optionalAccess', _63 => _63.eventMasking]);
2087
+ const maskingConfig = _optionalChain([this, 'access', _80 => _80.config, 'access', _81 => _81.masking, 'optionalAccess', _82 => _82.eventMasking]);
1776
2088
  if (maskingConfig) {
1777
2089
  maskLog(logRecord, maskingConfig);
1778
2090
  }
@@ -1864,14 +2176,14 @@ var LoggingModule = (_class3 = class _LoggingModule {constructor() { _class3.pro
1864
2176
  _chunkWC573FCIcjs.logger.debug("Creating logger provider", {
1865
2177
  serviceName,
1866
2178
  disableBatch: config.disableBatch,
1867
- hasMasking: !!_optionalChain([config, 'access', _64 => _64.masking, 'optionalAccess', _65 => _65.eventMasking])
2179
+ hasMasking: !!_optionalChain([config, 'access', _83 => _83.masking, 'optionalAccess', _84 => _84.eventMasking])
1868
2180
  });
1869
2181
  const exporter = this.createLogExporter(config, serviceName);
1870
2182
  const processor = config.disableBatch ? new BrizzSimpleLogRecordProcessor(exporter, config) : new BrizzBatchLogRecordProcessor(exporter, config);
1871
2183
  const resourceAttributes = {
1872
2184
  ...config.resourceAttributes,
1873
2185
  "service.name": serviceName,
1874
- [BRIZZ_SDK_VERSION]: _chunkCBEDIRVKcjs.getSDKVersion.call(void 0, ),
2186
+ [BRIZZ_SDK_VERSION]: _chunkEWT4TUB7cjs.getSDKVersion.call(void 0, ),
1875
2187
  [BRIZZ_SDK_LANGUAGE]: SDK_LANGUAGE
1876
2188
  };
1877
2189
  if (config.environment) {
@@ -2120,7 +2432,7 @@ var BrizzSpanExporter = (_class5 = class {
2120
2432
  const resourceAttrs = {
2121
2433
  ...config.resourceAttributes,
2122
2434
  "service.name": config.appName,
2123
- [BRIZZ_SDK_VERSION]: _chunkCBEDIRVKcjs.getSDKVersion.call(void 0, ),
2435
+ [BRIZZ_SDK_VERSION]: _chunkEWT4TUB7cjs.getSDKVersion.call(void 0, ),
2124
2436
  [BRIZZ_SDK_LANGUAGE]: SDK_LANGUAGE
2125
2437
  };
2126
2438
  if (config.environment) {
@@ -2247,8 +2559,8 @@ var BrizzSpanExporter = (_class5 = class {
2247
2559
  }
2248
2560
  async forceFlush() {
2249
2561
  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()]))
2562
+ _optionalChain([this, 'access', _85 => _85._delegate, 'access', _86 => _86.forceFlush, 'optionalCall', _87 => _87()]),
2563
+ ...[...this._delegates.values()].map(async (delegate) => _optionalChain([delegate, 'access', _88 => _88.forceFlush, 'optionalCall', _89 => _89()]))
2252
2564
  ]);
2253
2565
  }
2254
2566
  }, _class5);
@@ -2285,7 +2597,7 @@ var BrizzSimpleSpanProcessor = class extends _sdktracebase.SimpleSpanProcessor {
2285
2597
  }
2286
2598
  onEnd(span) {
2287
2599
  restampLangChainSpan(span);
2288
- const maskingConfig = _optionalChain([this, 'access', _71 => _71.config, 'access', _72 => _72.masking, 'optionalAccess', _73 => _73.spanMasking]);
2600
+ const maskingConfig = _optionalChain([this, 'access', _90 => _90.config, 'access', _91 => _91.masking, 'optionalAccess', _92 => _92.spanMasking]);
2289
2601
  if (maskingConfig) {
2290
2602
  maskReadableSpan(span, maskingConfig);
2291
2603
  }
@@ -2304,7 +2616,7 @@ var BrizzBatchSpanProcessor = class extends _sdktracebase.BatchSpanProcessor {
2304
2616
  }
2305
2617
  onEnd(span) {
2306
2618
  restampLangChainSpan(span);
2307
- const maskingConfig = _optionalChain([this, 'access', _74 => _74.config, 'access', _75 => _75.masking, 'optionalAccess', _76 => _76.spanMasking]);
2619
+ const maskingConfig = _optionalChain([this, 'access', _93 => _93.config, 'access', _94 => _94.masking, 'optionalAccess', _95 => _95.spanMasking]);
2308
2620
  if (maskingConfig) {
2309
2621
  maskReadableSpan(span, maskingConfig);
2310
2622
  }
@@ -2391,7 +2703,7 @@ var TracingModule = (_class6 = class _TracingModule {constructor() { _class6.pro
2391
2703
  }
2392
2704
  _chunkWC573FCIcjs.logger.debug("Initializing span processor", {
2393
2705
  disableBatch: config.disableBatch,
2394
- hasMasking: !!_optionalChain([config, 'access', _77 => _77.masking, 'optionalAccess', _78 => _78.spanMasking])
2706
+ hasMasking: !!_optionalChain([config, 'access', _96 => _96.masking, 'optionalAccess', _97 => _97.spanMasking])
2395
2707
  });
2396
2708
  const spanProcessor = config.disableBatch ? new BrizzSimpleSpanProcessor(this.spanExporter, config) : new BrizzBatchSpanProcessor(this.spanExporter, config);
2397
2709
  _chunkWC573FCIcjs.logger.debug("Span processor initialized successfully");
@@ -2611,7 +2923,7 @@ var _Brizz = (_class7 = class __Brizz {constructor() { _class7.prototype.__init1
2611
2923
  */
2612
2924
  setupInstrumentation(options) {
2613
2925
  const registry = InstrumentationRegistry.getInstance();
2614
- _chunkCBEDIRVKcjs.configure.call(void 0, resolveMcpSessionTracking(options.mcpSessionTracking));
2926
+ _chunkEWT4TUB7cjs.configure.call(void 0, resolveMcpSessionTracking(options.mcpSessionTracking));
2615
2927
  patchInstalledCallbackManager();
2616
2928
  if (options.instrumentModules && Object.keys(options.instrumentModules).length > 0) {
2617
2929
  registry.setManualModules(options.instrumentModules);
@@ -2635,7 +2947,7 @@ var _Brizz = (_class7 = class __Brizz {constructor() { _class7.prototype.__init1
2635
2947
  const resourceAttributes = {
2636
2948
  ...resolvedConfig.resourceAttributes,
2637
2949
  "service.name": resolvedConfig.appName,
2638
- [BRIZZ_SDK_VERSION]: _chunkCBEDIRVKcjs.getSDKVersion.call(void 0, ),
2950
+ [BRIZZ_SDK_VERSION]: _chunkEWT4TUB7cjs.getSDKVersion.call(void 0, ),
2639
2951
  [BRIZZ_SDK_LANGUAGE]: SDK_LANGUAGE
2640
2952
  };
2641
2953
  if (resolvedConfig.environment) {
@@ -2783,10 +3095,10 @@ var _Brizz = (_class7 = class __Brizz {constructor() { _class7.prototype.__init1
2783
3095
  }
2784
3096
  try {
2785
3097
  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()]);
3098
+ await _optionalChain([this, 'access', _98 => _98._tracerProvider, 'optionalAccess', _99 => _99.forceFlush, 'call', _100 => _100()]);
3099
+ await _optionalChain([this, 'access', _101 => _101._tracerProvider, 'optionalAccess', _102 => _102.shutdown, 'call', _103 => _103()]);
3100
+ await _optionalChain([this, 'access', _104 => _104._meterProvider, 'optionalAccess', _105 => _105.forceFlush, 'call', _106 => _106()]);
3101
+ await _optionalChain([this, 'access', _107 => _107._meterProvider, 'optionalAccess', _108 => _108.shutdown, 'call', _109 => _109()]);
2790
3102
  this._initialized = false;
2791
3103
  this._tracerProvider = null;
2792
3104
  this._meterProvider = null;