@brizz/sdk 0.2.0 → 0.2.2

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.
Files changed (49) hide show
  1. package/CHANGELOG.md +436 -0
  2. package/LICENSE +194 -20
  3. package/README.md +36 -1
  4. package/dist/{chunk-WC573FCI.cjs → chunk-C5OT6GAQ.cjs} +10 -2
  5. package/dist/{chunk-5HCG3JKU.js → chunk-CNEZA3WB.js} +5 -5
  6. package/dist/{chunk-Y4HNUX3Q.js → chunk-CZDPIJTO.js} +8 -0
  7. package/dist/{chunk-B5IY6O4N.js → chunk-DIOULRY4.js} +3 -2
  8. package/dist/{chunk-EZCNPWKM.js → chunk-GITAPIVL.js} +9 -9
  9. package/dist/{chunk-NF52RMLW.cjs → chunk-IWSFMCHH.cjs} +5 -1
  10. package/dist/{chunk-GISL4K6Z.js → chunk-JMX23OHO.js} +4 -0
  11. package/dist/{chunk-RD4XCYKT.cjs → chunk-PUOXH4CD.cjs} +6 -5
  12. package/dist/{chunk-CNVK5RA3.cjs → chunk-STMZ73NM.cjs} +13 -13
  13. package/dist/{chunk-4QNEI7VZ.cjs → chunk-UF4GMVEY.cjs} +142 -142
  14. package/dist/eve.cjs +2 -3
  15. package/dist/eve.js +1 -2
  16. package/dist/google-genai-KDEYFHTK.cjs +12 -0
  17. package/dist/{google-genai-3ERJNC7Q.js → google-genai-ZKKWSBVY.js} +4 -3
  18. package/dist/google-genai.cjs +3 -4
  19. package/dist/google-genai.js +2 -3
  20. package/dist/index.cjs +629 -306
  21. package/dist/index.js +410 -87
  22. package/dist/{mcp-5ERVMLSA.cjs → mcp-E5TPIVFI.cjs} +39 -40
  23. package/dist/{mcp-EJAJTGIC.js → mcp-SZSGMNBB.js} +5 -6
  24. package/dist/session.cjs +4 -5
  25. package/dist/session.js +3 -4
  26. package/dist/types/cjs/internal/instrumentation/auto-init.d.ts +0 -7
  27. package/dist/types/cjs/internal/instrumentation/google-genai.d.ts +1 -0
  28. package/dist/types/cjs/internal/instrumentation/registry.d.ts +2 -0
  29. package/dist/types/cjs/internal/instrumentation/vercel-ai/index.d.ts +28 -0
  30. package/dist/types/cjs/internal/instrumentation/vercel-ai/model-call-end.d.ts +1 -0
  31. package/dist/types/cjs/internal/masking/utils.d.ts +1 -1
  32. package/dist/types/cjs/internal/sdk.d.ts +1 -0
  33. package/dist/types/cjs/internal/semantic-conventions.d.ts +2 -0
  34. package/dist/types/esm/internal/instrumentation/auto-init.d.ts +0 -7
  35. package/dist/types/esm/internal/instrumentation/google-genai.d.ts +1 -0
  36. package/dist/types/esm/internal/instrumentation/registry.d.ts +2 -0
  37. package/dist/types/esm/internal/instrumentation/vercel-ai/index.d.ts +28 -0
  38. package/dist/types/esm/internal/instrumentation/vercel-ai/model-call-end.d.ts +1 -0
  39. package/dist/types/esm/internal/masking/utils.d.ts +1 -1
  40. package/dist/types/esm/internal/sdk.d.ts +1 -0
  41. package/dist/types/esm/internal/semantic-conventions.d.ts +2 -0
  42. package/package.json +36 -29
  43. package/dist/chunk-3RG5ZIWI.js +0 -10
  44. package/dist/chunk-6QXPHZEO.cjs +0 -130
  45. package/dist/chunk-GABRGNAU.js +0 -130
  46. package/dist/chunk-OBGZSXTJ.cjs +0 -10
  47. package/dist/google-genai-GVCKSJMR.cjs +0 -11
  48. package/dist/interrupt-36U5562Z.cjs +0 -12
  49. package/dist/interrupt-6BSXUK3O.js +0 -12
package/dist/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2; var _class3; var _class4; var _class5; var _class6;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } async function _asyncNullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return await rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2; var _class3; var _class4; var _class5; var _class6;
2
2
 
3
3
 
4
4
  var _chunkUNLNNKZ7cjs = require('./chunk-UNLNNKZ7.cjs');
@@ -39,11 +39,11 @@ var _chunkUNLNNKZ7cjs = require('./chunk-UNLNNKZ7.cjs');
39
39
 
40
40
 
41
41
 
42
- var _chunk4QNEI7VZcjs = require('./chunk-4QNEI7VZ.cjs');
42
+ var _chunkUF4GMVEYcjs = require('./chunk-UF4GMVEY.cjs');
43
43
 
44
44
 
45
45
 
46
- var _chunkCNVK5RA3cjs = require('./chunk-CNVK5RA3.cjs');
46
+ var _chunkSTMZ73NMcjs = require('./chunk-STMZ73NM.cjs');
47
47
 
48
48
 
49
49
 
@@ -51,7 +51,6 @@ var _chunkCNVK5RA3cjs = require('./chunk-CNVK5RA3.cjs');
51
51
 
52
52
 
53
53
 
54
- var _chunkDC2MFO65cjs = require('./chunk-DC2MFO65.cjs');
55
54
 
56
55
 
57
56
 
@@ -59,10 +58,8 @@ var _chunkDC2MFO65cjs = require('./chunk-DC2MFO65.cjs');
59
58
 
60
59
 
61
60
 
62
- var _chunkWC573FCIcjs = require('./chunk-WC573FCI.cjs');
63
61
 
64
62
 
65
- var _chunk6QXPHZEOcjs = require('./chunk-6QXPHZEO.cjs');
66
63
 
67
64
 
68
65
 
@@ -73,6 +70,7 @@ var _chunk6QXPHZEOcjs = require('./chunk-6QXPHZEO.cjs');
73
70
 
74
71
 
75
72
 
73
+ var _chunkIWSFMCHHcjs = require('./chunk-IWSFMCHH.cjs');
76
74
 
77
75
 
78
76
 
@@ -80,16 +78,16 @@ var _chunk6QXPHZEOcjs = require('./chunk-6QXPHZEO.cjs');
80
78
 
81
79
 
82
80
 
81
+ var _chunkDC2MFO65cjs = require('./chunk-DC2MFO65.cjs');
83
82
 
84
83
 
85
84
 
86
85
 
87
86
 
88
87
 
89
- var _chunkNF52RMLWcjs = require('./chunk-NF52RMLW.cjs');
90
88
 
91
89
 
92
- var _chunkOBGZSXTJcjs = require('./chunk-OBGZSXTJ.cjs');
90
+ var _chunkC5OT6GAQcjs = require('./chunk-C5OT6GAQ.cjs');
93
91
 
94
92
  // src/internal/instrumentation/auto-init.ts
95
93
  var _instrumentation = require('@opentelemetry/instrumentation');
@@ -112,7 +110,7 @@ var _api = require('@opentelemetry/api');
112
110
 
113
111
  // src/internal/instrumentation/langgraph/attributes.ts
114
112
  var INSTRUMENTATION_NAME = "@brizz/sdk/langgraph";
115
- var INSTRUMENTATION_VERSION = _chunkCNVK5RA3cjs.getSDKVersion.call(void 0, );
113
+ var INSTRUMENTATION_VERSION = _chunkSTMZ73NMcjs.getSDKVersion.call(void 0, );
116
114
  var MODULE_NAME = "@langchain/langgraph";
117
115
  var SUPPORTED_VERSIONS = [">=0.2.0 <2"];
118
116
  function isSupportedVersion(version) {
@@ -212,11 +210,11 @@ var LangGraphInstrumentation = class extends _instrumentation.InstrumentationBas
212
210
  applyPatch(moduleExports) {
213
211
  const proto = resolvePregelPrototype(moduleExports);
214
212
  if (!proto) {
215
- _chunkWC573FCIcjs.logger.debug("Brizz LangGraph: module does not expose a Pregel prototype \u2014 skipping patch");
213
+ _chunkC5OT6GAQcjs.logger.debug("Brizz LangGraph: module does not expose a Pregel prototype \u2014 skipping patch");
216
214
  return;
217
215
  }
218
216
  if (patchPregelStream(proto, () => this.tracer)) {
219
- _chunkWC573FCIcjs.logger.debug("Brizz LangGraph: patched Pregel.stream for checkpoint spans");
217
+ _chunkC5OT6GAQcjs.logger.debug("Brizz LangGraph: patched Pregel.stream for checkpoint spans");
220
218
  }
221
219
  }
222
220
  };
@@ -227,18 +225,18 @@ function patchInstalledLangGraph() {
227
225
  requireFromSdk = _module.createRequire.call(void 0, __filename);
228
226
  version = requireFromSdk(`${MODULE_NAME}/package.json`).version;
229
227
  } catch (error) {
230
- _chunkWC573FCIcjs.logger.debug(`LangGraph not resolved, not patched: ${String(error)}`);
228
+ _chunkC5OT6GAQcjs.logger.debug(`LangGraph not resolved, not patched: ${String(error)}`);
231
229
  return;
232
230
  }
233
231
  if (!isSupportedVersion(version)) {
234
- _chunkWC573FCIcjs.logger.debug(`LangGraph ${version} is outside ${SUPPORTED_VERSIONS.join(" ")}, not patched`);
232
+ _chunkC5OT6GAQcjs.logger.debug(`LangGraph ${version} is outside ${SUPPORTED_VERSIONS.join(" ")}, not patched`);
235
233
  return;
236
234
  }
237
235
  let instrumentation;
238
236
  try {
239
237
  instrumentation = new LangGraphInstrumentation({ enabled: false });
240
238
  } catch (error) {
241
- _chunkWC573FCIcjs.logger.debug(`LangGraph instrumentation not constructed: ${String(error)}`);
239
+ _chunkC5OT6GAQcjs.logger.debug(`LangGraph instrumentation not constructed: ${String(error)}`);
242
240
  return;
243
241
  }
244
242
  try {
@@ -247,13 +245,13 @@ function patchInstalledLangGraph() {
247
245
  instrumentation.manuallyInstrument(loaded.exports);
248
246
  }
249
247
  } catch (error) {
250
- _chunkWC573FCIcjs.logger.debug(`LangGraph CJS build not patched: ${String(error)}`);
248
+ _chunkC5OT6GAQcjs.logger.debug(`LangGraph CJS build not patched: ${String(error)}`);
251
249
  }
252
250
  void (async () => {
253
251
  try {
254
252
  instrumentation.manuallyInstrument(await Promise.resolve().then(() => _interopRequireWildcard(require("@langchain/langgraph"))));
255
253
  } catch (error) {
256
- _chunkWC573FCIcjs.logger.debug(`LangGraph not patched: ${String(error)}`);
254
+ _chunkC5OT6GAQcjs.logger.debug(`LangGraph not patched: ${String(error)}`);
257
255
  }
258
256
  })();
259
257
  }
@@ -291,7 +289,7 @@ function patchSaver(checkpointer) {
291
289
  patchedSavers.add(proto);
292
290
  const originalPut = proto.put;
293
291
  if (typeof originalPut !== "function") {
294
- _chunkWC573FCIcjs.logger.debug("Brizz LangGraph: checkpointer exposes no put \u2014 checkpoint ids unavailable");
292
+ _chunkC5OT6GAQcjs.logger.debug("Brizz LangGraph: checkpointer exposes no put \u2014 checkpoint ids unavailable");
295
293
  return;
296
294
  }
297
295
  const patchedPut = function brizzPut(config, checkpoint, ...rest) {
@@ -318,7 +316,7 @@ function recordCheckpoint(config, checkpoint) {
318
316
  setIfKnown(span, ATTR_CHECKPOINT_THREAD_ID, readThreadId(config));
319
317
  setIfKnown(span, ATTR_CHECKPOINT_NS, readCheckpointNs(config));
320
318
  } catch (error) {
321
- _chunkWC573FCIcjs.logger.debug(`Brizz LangGraph: could not record a checkpoint write: ${String(error)}`);
319
+ _chunkC5OT6GAQcjs.logger.debug(`Brizz LangGraph: could not record a checkpoint write: ${String(error)}`);
322
320
  }
323
321
  }
324
322
  function setIfKnown(span, key, value) {
@@ -342,7 +340,7 @@ function beginRun(graph, options, getTracer) {
342
340
  runContext: _api.trace.setSpan(_api.context.active(), span).setValue(CHECKPOINT_SPAN_KEY, span)
343
341
  };
344
342
  } catch (error) {
345
- _chunkWC573FCIcjs.logger.debug(`Brizz LangGraph: could not start checkpoint span: ${String(error)}`);
343
+ _chunkC5OT6GAQcjs.logger.debug(`Brizz LangGraph: could not start checkpoint span: ${String(error)}`);
346
344
  return void 0;
347
345
  }
348
346
  }
@@ -366,7 +364,7 @@ function endRun(run, error) {
366
364
  run.span.setStatus({ code: _api.SpanStatusCode.ERROR });
367
365
  }
368
366
  } catch (spanError) {
369
- _chunkWC573FCIcjs.logger.debug(`Brizz LangGraph: could not finish checkpoint span: ${String(spanError)}`);
367
+ _chunkC5OT6GAQcjs.logger.debug(`Brizz LangGraph: could not finish checkpoint span: ${String(spanError)}`);
370
368
  } finally {
371
369
  run.span.end();
372
370
  }
@@ -464,7 +462,7 @@ function toJson(value) {
464
462
  try {
465
463
  return JSON.stringify(value);
466
464
  } catch (error) {
467
- _chunkWC573FCIcjs.logger.debug(`Brizz: value is not JSON-serializable: ${String(error)}`);
465
+ _chunkC5OT6GAQcjs.logger.debug(`Brizz: value is not JSON-serializable: ${String(error)}`);
468
466
  return void 0;
469
467
  }
470
468
  }
@@ -483,7 +481,7 @@ var ATTR_ANSWERS = "typesafe.answers";
483
481
  var PATCHED_FLAG2 = /* @__PURE__ */ Symbol.for("brizz.typesafe.patched");
484
482
  var TypeSafeInstrumentation = class extends _instrumentation.InstrumentationBase {
485
483
  constructor(config = {}) {
486
- super(INSTRUMENTATION_NAME2, _chunkCNVK5RA3cjs.getSDKVersion.call(void 0, ), config);
484
+ super(INSTRUMENTATION_NAME2, _chunkSTMZ73NMcjs.getSDKVersion.call(void 0, ), config);
487
485
  this.setTracerProvider(_chunkDC2MFO65cjs.brizzTracerProvider);
488
486
  }
489
487
  init() {
@@ -508,11 +506,11 @@ var TypeSafeInstrumentation = class extends _instrumentation.InstrumentationBase
508
506
  manuallyInstrument(moduleExports) {
509
507
  const client = _optionalChain([moduleExports, 'optionalAccess', _21 => _21.TypeSafeClient]);
510
508
  if (typeof client !== "function" || !client.prototype) {
511
- _chunkWC573FCIcjs.logger.debug("Brizz TypeSafe: module does not expose TypeSafeClient \u2014 skipping patch");
509
+ _chunkC5OT6GAQcjs.logger.debug("Brizz TypeSafe: module does not expose TypeSafeClient \u2014 skipping patch");
512
510
  return;
513
511
  }
514
512
  if (patchSystemOne(client.prototype, () => this.tracer)) {
515
- _chunkWC573FCIcjs.logger.debug("Brizz TypeSafe: patched TypeSafeClient.systemOne");
513
+ _chunkC5OT6GAQcjs.logger.debug("Brizz TypeSafe: patched TypeSafeClient.systemOne");
516
514
  }
517
515
  }
518
516
  };
@@ -523,18 +521,18 @@ function patchInstalledTypeSafe() {
523
521
  requireFromSdk = _module.createRequire.call(void 0, __filename);
524
522
  version = requireFromSdk(`${MODULE_NAME2}/package.json`).version;
525
523
  } catch (error) {
526
- _chunkWC573FCIcjs.logger.debug(`TypeSafe not resolved, not patched: ${String(error)}`);
524
+ _chunkC5OT6GAQcjs.logger.debug(`TypeSafe not resolved, not patched: ${String(error)}`);
527
525
  return;
528
526
  }
529
527
  if (!isSupportedVersion2(version)) {
530
- _chunkWC573FCIcjs.logger.debug(`TypeSafe ${version} is outside ${SUPPORTED_VERSIONS2.join(" ")}, not patched`);
528
+ _chunkC5OT6GAQcjs.logger.debug(`TypeSafe ${version} is outside ${SUPPORTED_VERSIONS2.join(" ")}, not patched`);
531
529
  return;
532
530
  }
533
531
  let instrumentation;
534
532
  try {
535
533
  instrumentation = new TypeSafeInstrumentation({ enabled: false });
536
534
  } catch (error) {
537
- _chunkWC573FCIcjs.logger.debug(`TypeSafe instrumentation not constructed: ${String(error)}`);
535
+ _chunkC5OT6GAQcjs.logger.debug(`TypeSafe instrumentation not constructed: ${String(error)}`);
538
536
  return;
539
537
  }
540
538
  try {
@@ -543,13 +541,13 @@ function patchInstalledTypeSafe() {
543
541
  instrumentation.manuallyInstrument(loaded.exports);
544
542
  }
545
543
  } catch (error) {
546
- _chunkWC573FCIcjs.logger.debug(`TypeSafe CJS build not patched: ${String(error)}`);
544
+ _chunkC5OT6GAQcjs.logger.debug(`TypeSafe CJS build not patched: ${String(error)}`);
547
545
  }
548
546
  void (async () => {
549
547
  try {
550
548
  instrumentation.manuallyInstrument(await Promise.resolve().then(() => _interopRequireWildcard(require("@typesafe-ai/sdk"))));
551
549
  } catch (error) {
552
- _chunkWC573FCIcjs.logger.debug(`TypeSafe not patched: ${String(error)}`);
550
+ _chunkC5OT6GAQcjs.logger.debug(`TypeSafe not patched: ${String(error)}`);
553
551
  }
554
552
  })();
555
553
  }
@@ -610,7 +608,7 @@ function observe(pending, span) {
610
608
  return pending;
611
609
  }
612
610
  } catch (error) {
613
- _chunkWC573FCIcjs.logger.debug(`Brizz TypeSafe: could not observe the call: ${String(error)}`);
611
+ _chunkC5OT6GAQcjs.logger.debug(`Brizz TypeSafe: could not observe the call: ${String(error)}`);
614
612
  }
615
613
  endSpan(span);
616
614
  return pending;
@@ -619,21 +617,21 @@ function startSpan(getTracer, request) {
619
617
  try {
620
618
  const model = typeof _optionalChain([request, 'optionalAccess', _25 => _25.model]) === "string" && request.model !== "" ? request.model : void 0;
621
619
  const attributes = {
622
- [_chunkNF52RMLWcjs.GEN_AI_OPERATION_NAME]: _chunkNF52RMLWcjs.GEN_AI_OPERATION_CLASSIFY,
623
- [_chunkNF52RMLWcjs.GEN_AI_PROVIDER_NAME]: PROVIDER_NAME,
624
- [_chunkNF52RMLWcjs.GEN_AI_INPUT_MESSAGES]: JSON.stringify([
620
+ [_chunkIWSFMCHHcjs.GEN_AI_OPERATION_NAME]: _chunkIWSFMCHHcjs.GEN_AI_OPERATION_CLASSIFY,
621
+ [_chunkIWSFMCHHcjs.GEN_AI_PROVIDER_NAME]: PROVIDER_NAME,
622
+ [_chunkIWSFMCHHcjs.GEN_AI_INPUT_MESSAGES]: JSON.stringify([
625
623
  { role: "user", parts: [{ type: "text", content: text(_optionalChain([request, 'optionalAccess', _26 => _26.state])) }] }
626
624
  ])
627
625
  };
628
626
  if (model) {
629
- attributes[_chunkNF52RMLWcjs.GEN_AI_REQUEST_MODEL] = model;
627
+ attributes[_chunkIWSFMCHHcjs.GEN_AI_REQUEST_MODEL] = model;
630
628
  }
631
629
  if (_optionalChain([request, 'optionalAccess', _27 => _27.questions]) !== void 0) {
632
630
  attributes[ATTR_QUESTIONS] = JSON.stringify(request.questions);
633
631
  }
634
632
  return getTracer().startSpan(SPAN_NAME, { kind: _api.SpanKind.CLIENT, attributes });
635
633
  } catch (error) {
636
- _chunkWC573FCIcjs.logger.debug(`Brizz TypeSafe: could not start span: ${String(error)}`);
634
+ _chunkC5OT6GAQcjs.logger.debug(`Brizz TypeSafe: could not start span: ${String(error)}`);
637
635
  return void 0;
638
636
  }
639
637
  }
@@ -641,19 +639,19 @@ function recordResult(span, result) {
641
639
  try {
642
640
  const { model, usage, answers } = _nullishCoalesce(result, () => ( {}));
643
641
  if (typeof model === "string" && model) {
644
- span.setAttribute(_chunkNF52RMLWcjs.GEN_AI_RESPONSE_MODEL, model);
642
+ span.setAttribute(_chunkIWSFMCHHcjs.GEN_AI_RESPONSE_MODEL, model);
645
643
  }
646
644
  if (typeof _optionalChain([usage, 'optionalAccess', _28 => _28.input_tokens]) === "number") {
647
- span.setAttribute(_chunkNF52RMLWcjs.GEN_AI_USAGE_INPUT_TOKENS, usage.input_tokens);
645
+ span.setAttribute(_chunkIWSFMCHHcjs.GEN_AI_USAGE_INPUT_TOKENS, usage.input_tokens);
648
646
  }
649
647
  if (typeof _optionalChain([usage, 'optionalAccess', _29 => _29.output_tokens]) === "number") {
650
- span.setAttribute(_chunkNF52RMLWcjs.GEN_AI_USAGE_OUTPUT_TOKENS, usage.output_tokens);
648
+ span.setAttribute(_chunkIWSFMCHHcjs.GEN_AI_USAGE_OUTPUT_TOKENS, usage.output_tokens);
651
649
  }
652
650
  if (answers !== void 0) {
653
651
  span.setAttribute(ATTR_ANSWERS, JSON.stringify(answers));
654
652
  }
655
653
  } catch (error) {
656
- _chunkWC573FCIcjs.logger.debug(`Brizz TypeSafe: could not record the answers: ${String(error)}`);
654
+ _chunkC5OT6GAQcjs.logger.debug(`Brizz TypeSafe: could not record the answers: ${String(error)}`);
657
655
  }
658
656
  }
659
657
  function endSpan(span, error) {
@@ -663,22 +661,22 @@ function endSpan(span, error) {
663
661
  if (error !== void 0) {
664
662
  span.recordException(error instanceof Error ? error : new Error(String(error)));
665
663
  span.setStatus({ code: _api.SpanStatusCode.ERROR, message: String(error) });
666
- span.setAttribute(_chunkNF52RMLWcjs.ERROR_TYPE, errorType(error));
664
+ span.setAttribute(_chunkIWSFMCHHcjs.ERROR_TYPE, errorType(error));
667
665
  }
668
666
  span.end();
669
667
  }
670
668
 
671
669
  // src/internal/instrumentation/auto-init.ts
672
670
  var exceptionLogger = (error) => {
673
- _chunkWC573FCIcjs.logger.error(`Exception in instrumentation: ${String(error)}`);
671
+ _chunkC5OT6GAQcjs.logger.error(`Exception in instrumentation: ${String(error)}`);
674
672
  };
675
673
  function loadGenAIInstrumentations() {
676
674
  const instrumentations = [];
677
675
  try {
678
676
  instrumentations.push(new BrizzOpenAIInstrumentation());
679
- _chunkWC573FCIcjs.logger.debug("Auto-loaded OpenAI instrumentation");
677
+ _chunkC5OT6GAQcjs.logger.debug("Auto-loaded OpenAI instrumentation");
680
678
  } catch (error) {
681
- _chunkWC573FCIcjs.logger.error(`Failed to auto-load OpenAI instrumentation: ${String(error)}`);
679
+ _chunkC5OT6GAQcjs.logger.error(`Failed to auto-load OpenAI instrumentation: ${String(error)}`);
682
680
  }
683
681
  const genAIInstrumentationClasses = [
684
682
  { class: _instrumentationanthropic.AnthropicInstrumentation, name: "Anthropic" },
@@ -694,28 +692,28 @@ function loadGenAIInstrumentations() {
694
692
  try {
695
693
  const instrumentation = new config.class({ exceptionLogger });
696
694
  instrumentations.push(instrumentation);
697
- _chunkWC573FCIcjs.logger.debug(`Auto-loaded ${config.name} instrumentation`);
695
+ _chunkC5OT6GAQcjs.logger.debug(`Auto-loaded ${config.name} instrumentation`);
698
696
  } catch (error) {
699
- _chunkWC573FCIcjs.logger.error(`Failed to auto-load ${config.name} instrumentation: ${String(error)}`);
697
+ _chunkC5OT6GAQcjs.logger.error(`Failed to auto-load ${config.name} instrumentation: ${String(error)}`);
700
698
  }
701
699
  }
702
700
  try {
703
701
  _instrumentation.registerInstrumentations.call(void 0, { instrumentations, tracerProvider: _chunkDC2MFO65cjs.brizzTracerProvider });
704
- _chunkWC573FCIcjs.logger.info(`Auto-registered ${instrumentations.length} GenAI instrumentations`);
702
+ _chunkC5OT6GAQcjs.logger.info(`Auto-registered ${instrumentations.length} GenAI instrumentations`);
705
703
  } catch (error) {
706
- _chunkWC573FCIcjs.logger.error(`Failed to register GenAI instrumentations: ${String(error)}`);
704
+ _chunkC5OT6GAQcjs.logger.error(`Failed to register GenAI instrumentations: ${String(error)}`);
707
705
  }
708
706
  return instrumentations;
709
707
  }
710
708
  function loadMCPInstrumentation() {
711
709
  void (async () => {
712
710
  try {
713
- const { MCPInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("./mcp-5ERVMLSA.cjs")));
711
+ const { MCPInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("./mcp-E5TPIVFI.cjs")));
714
712
  const mcp = new MCPInstrumentation({ exceptionLogger });
715
713
  _instrumentation.registerInstrumentations.call(void 0, { instrumentations: [mcp], tracerProvider: _chunkDC2MFO65cjs.brizzTracerProvider });
716
- _chunkWC573FCIcjs.logger.debug("Auto-loaded MCP instrumentation");
714
+ _chunkC5OT6GAQcjs.logger.debug("Auto-loaded MCP instrumentation");
717
715
  } catch (error) {
718
- _chunkWC573FCIcjs.logger.debug(
716
+ _chunkC5OT6GAQcjs.logger.debug(
719
717
  `MCP instrumentation not loaded (install @modelcontextprotocol/sdk and @arizeai/openinference-instrumentation-mcp if you want MCP support): ${String(error)}`
720
718
  );
721
719
  }
@@ -727,9 +725,9 @@ function loadLangGraphInstrumentation() {
727
725
  instrumentations: [new LangGraphInstrumentation()],
728
726
  tracerProvider: _chunkDC2MFO65cjs.brizzTracerProvider
729
727
  });
730
- _chunkWC573FCIcjs.logger.debug("Auto-loaded LangGraph instrumentation");
728
+ _chunkC5OT6GAQcjs.logger.debug("Auto-loaded LangGraph instrumentation");
731
729
  } catch (error) {
732
- _chunkWC573FCIcjs.logger.debug(`LangGraph instrumentation not loaded: ${String(error)}`);
730
+ _chunkC5OT6GAQcjs.logger.debug(`LangGraph instrumentation not loaded: ${String(error)}`);
733
731
  }
734
732
  }
735
733
  function loadTypeSafeInstrumentation() {
@@ -738,9 +736,9 @@ function loadTypeSafeInstrumentation() {
738
736
  instrumentations: [new TypeSafeInstrumentation()],
739
737
  tracerProvider: _chunkDC2MFO65cjs.brizzTracerProvider
740
738
  });
741
- _chunkWC573FCIcjs.logger.debug("Auto-loaded TypeSafe instrumentation");
739
+ _chunkC5OT6GAQcjs.logger.debug("Auto-loaded TypeSafe instrumentation");
742
740
  } catch (error) {
743
- _chunkWC573FCIcjs.logger.debug(`TypeSafe instrumentation not loaded: ${String(error)}`);
741
+ _chunkC5OT6GAQcjs.logger.debug(`TypeSafe instrumentation not loaded: ${String(error)}`);
744
742
  }
745
743
  }
746
744
  function loadVertexAIInstrumentation() {
@@ -752,9 +750,9 @@ function loadVertexAIInstrumentation() {
752
750
  instrumentations: [vertexAI],
753
751
  tracerProvider: _chunkDC2MFO65cjs.brizzTracerProvider
754
752
  });
755
- _chunkWC573FCIcjs.logger.debug("Auto-loaded Vertex AI instrumentation");
753
+ _chunkC5OT6GAQcjs.logger.debug("Auto-loaded Vertex AI instrumentation");
756
754
  } catch (error) {
757
- _chunkWC573FCIcjs.logger.debug(
755
+ _chunkC5OT6GAQcjs.logger.debug(
758
756
  `Vertex AI instrumentation not loaded (install @traceloop/instrumentation-vertexai if you want Vertex AI support): ${String(error)}`
759
757
  );
760
758
  }
@@ -763,67 +761,20 @@ function loadVertexAIInstrumentation() {
763
761
  function loadGoogleGenAIInstrumentation() {
764
762
  void (async () => {
765
763
  try {
766
- const { GoogleGenAIInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("./google-genai-GVCKSJMR.cjs")));
764
+ const { GoogleGenAIInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("./google-genai-KDEYFHTK.cjs")));
767
765
  const googleGenAI = new GoogleGenAIInstrumentation({ exceptionLogger });
768
766
  _instrumentation.registerInstrumentations.call(void 0, {
769
767
  instrumentations: [googleGenAI],
770
768
  tracerProvider: _chunkDC2MFO65cjs.brizzTracerProvider
771
769
  });
772
- _chunkWC573FCIcjs.logger.debug("Auto-loaded Google GenAI instrumentation");
770
+ _chunkC5OT6GAQcjs.logger.debug("Auto-loaded Google GenAI instrumentation");
773
771
  } catch (error) {
774
- _chunkWC573FCIcjs.logger.debug(
772
+ _chunkC5OT6GAQcjs.logger.debug(
775
773
  `Google GenAI instrumentation not loaded (install @traceloop/instrumentation-google-generativeai if you want Gemini support): ${String(error)}`
776
774
  );
777
775
  }
778
776
  })();
779
777
  }
780
- function selectTelemetryRegister(ai) {
781
- const register = _nullishCoalesce(ai.registerTelemetry, () => ( ai.registerTelemetryIntegration));
782
- return typeof register === "function" ? register : void 0;
783
- }
784
- function loadVercelAITelemetry() {
785
- void (async () => {
786
- try {
787
- const ai = await Promise.resolve().then(() => _interopRequireWildcard(require("ai")));
788
- const register = selectTelemetryRegister(ai);
789
- if (!register) {
790
- _chunkWC573FCIcjs.logger.debug(
791
- "AI SDK present but lacks a telemetry-registration hook (needs ai@>=6); skipping"
792
- );
793
- return;
794
- }
795
- const isV7 = typeof ai.registerTelemetry === "function";
796
- const integrations = [];
797
- const { createInterruptIntegration } = await Promise.resolve().then(() => _interopRequireWildcard(require("./interrupt-36U5562Z.cjs")));
798
- integrations.push(createInterruptIntegration());
799
- let otelCollectorLoaded = false;
800
- try {
801
- const otel = await Promise.resolve().then(() => _interopRequireWildcard(require("@ai-sdk/otel")));
802
- if (typeof otel.LegacyOpenTelemetry === "function") {
803
- integrations.push(
804
- new otel.LegacyOpenTelemetry({ tracer: _chunkDC2MFO65cjs.brizzTracerProvider.getTracer("ai") })
805
- );
806
- otelCollectorLoaded = true;
807
- }
808
- } catch (e) {
809
- }
810
- if (!otelCollectorLoaded) {
811
- const message = "AI SDK present but @ai-sdk/otel is missing or unusable; install it (npm install @ai-sdk/otel) to capture AI SDK spans on ai@>=7";
812
- if (isV7) {
813
- _chunkWC573FCIcjs.logger.warn(message);
814
- } else {
815
- _chunkWC573FCIcjs.logger.debug(message);
816
- }
817
- }
818
- register(...integrations);
819
- _chunkWC573FCIcjs.logger.debug("Auto-loaded Vercel AI telemetry");
820
- } catch (error) {
821
- _chunkWC573FCIcjs.logger.debug(
822
- `Vercel AI telemetry not loaded (install ai@>=6 to capture AI SDK telemetry): ${String(error)}`
823
- );
824
- }
825
- })();
826
- }
827
778
  function autoInitializeInstrumentations() {
828
779
  try {
829
780
  const genAIInstrumentations = loadGenAIInstrumentations();
@@ -832,13 +783,12 @@ function autoInitializeInstrumentations() {
832
783
  loadTypeSafeInstrumentation();
833
784
  loadVertexAIInstrumentation();
834
785
  loadGoogleGenAIInstrumentation();
835
- loadVercelAITelemetry();
836
- _chunkWC573FCIcjs.logger.info(
786
+ _chunkC5OT6GAQcjs.logger.info(
837
787
  `Auto-initialization complete: ${genAIInstrumentations.length} GenAI instrumentations`
838
788
  );
839
789
  return true;
840
790
  } catch (error) {
841
- _chunkWC573FCIcjs.logger.error(`Auto-initialization failed: ${String(error)}`);
791
+ _chunkC5OT6GAQcjs.logger.error(`Auto-initialization failed: ${String(error)}`);
842
792
  return false;
843
793
  }
844
794
  }
@@ -869,20 +819,20 @@ function parseBoolEnv(name) {
869
819
  if (value === "true" || value === "false") {
870
820
  return value === "true";
871
821
  }
872
- _chunkWC573FCIcjs.logger.warn(`Brizz: ignoring ${name}=${raw}; expected true or false.`);
822
+ _chunkC5OT6GAQcjs.logger.warn(`Brizz: ignoring ${name}=${raw}; expected true or false.`);
873
823
  return void 0;
874
824
  }
875
825
  function resolveConfig(options) {
876
- const envLogLevel = process.env["BRIZZ_LOG_LEVEL"] || _optionalChain([options, 'access', _30 => _30.logLevel, 'optionalAccess', _31 => _31.toString, 'call', _32 => _32()]) || _chunkWC573FCIcjs.DEFAULT_LOG_LEVEL.toString();
826
+ const envLogLevel = process.env["BRIZZ_LOG_LEVEL"] || _optionalChain([options, 'access', _30 => _30.logLevel, 'optionalAccess', _31 => _31.toString, 'call', _32 => _32()]) || _chunkC5OT6GAQcjs.DEFAULT_LOG_LEVEL.toString();
877
827
  let resolvedLogLevel;
878
828
  if (envLogLevel) {
879
- resolvedLogLevel = _chunkWC573FCIcjs.parseLogLevel.call(void 0, envLogLevel);
829
+ resolvedLogLevel = _chunkC5OT6GAQcjs.parseLogLevel.call(void 0, envLogLevel);
880
830
  } else if (typeof options.logLevel === "string") {
881
- resolvedLogLevel = _chunkWC573FCIcjs.parseLogLevel.call(void 0, options.logLevel);
831
+ resolvedLogLevel = _chunkC5OT6GAQcjs.parseLogLevel.call(void 0, options.logLevel);
882
832
  } else {
883
- resolvedLogLevel = options.logLevel || _chunkWC573FCIcjs.DEFAULT_LOG_LEVEL;
833
+ resolvedLogLevel = options.logLevel || _chunkC5OT6GAQcjs.DEFAULT_LOG_LEVEL;
884
834
  }
885
- _chunkWC573FCIcjs.setLogLevel.call(void 0, resolvedLogLevel);
835
+ _chunkC5OT6GAQcjs.setLogLevel.call(void 0, resolvedLogLevel);
886
836
  let maskingStatus;
887
837
  if (options.masking === true) {
888
838
  maskingStatus = "enabled";
@@ -893,7 +843,7 @@ function resolveConfig(options) {
893
843
  } else {
894
844
  maskingStatus = "default-disabled";
895
845
  }
896
- _chunkWC573FCIcjs.logger.debug("Starting configuration resolution", {
846
+ _chunkC5OT6GAQcjs.logger.debug("Starting configuration resolution", {
897
847
  appName: options.appName,
898
848
  baseUrl: options.baseUrl,
899
849
  hasApiKey: !!options.apiKey,
@@ -948,7 +898,7 @@ function resolveConfig(options) {
948
898
  (name) => process.env[name] !== void 0
949
899
  );
950
900
  if (envConflicts.length > 0) {
951
- _chunkWC573FCIcjs.logger.warn(
901
+ _chunkC5OT6GAQcjs.logger.warn(
952
902
  `Ignoring ${envConflicts.join(", ")} \u2014 dsn / BRIZZ_DSN takes precedence.`
953
903
  );
954
904
  }
@@ -968,11 +918,11 @@ function resolveConfig(options) {
968
918
  try {
969
919
  const envHeaders = JSON.parse(process.env["BRIZZ_HEADERS"]);
970
920
  Object.assign(resolvedConfig.headers, envHeaders);
971
- _chunkWC573FCIcjs.logger.debug("Added headers from environment variable", {
921
+ _chunkC5OT6GAQcjs.logger.debug("Added headers from environment variable", {
972
922
  headers: Object.keys(envHeaders)
973
923
  });
974
924
  } catch (error) {
975
- _chunkWC573FCIcjs.logger.error("Failed to parse BRIZZ_HEADERS environment variable", { error });
925
+ _chunkC5OT6GAQcjs.logger.error("Failed to parse BRIZZ_HEADERS environment variable", { error });
976
926
  throw new Error("Invalid JSON in BRIZZ_HEADERS environment variable", { cause: error });
977
927
  }
978
928
  }
@@ -988,7 +938,7 @@ function resolveConfig(options) {
988
938
  resolvedConfig.headers[_chunkUNLNNKZ7cjs.SERVICE_NAME_HEADER] = parsedDSN.service;
989
939
  }
990
940
  }
991
- _chunkWC573FCIcjs.logger.debug("Configuration resolved with environment variables", {
941
+ _chunkC5OT6GAQcjs.logger.debug("Configuration resolved with environment variables", {
992
942
  appName: resolvedConfig.appName,
993
943
  baseUrl: resolvedConfig.baseUrl,
994
944
  hasApiKey: !!resolvedConfig.apiKey,
@@ -1029,23 +979,23 @@ var PATCHED_MARKER = /* @__PURE__ */ Symbol.for("brizz.langchain.callbackManager
1029
979
  var TRACER_PATCHED_MARKER = /* @__PURE__ */ Symbol.for("brizz.langchain.tracerPatched");
1030
980
  var runContexts = /* @__PURE__ */ new WeakMap();
1031
981
  var OMITTED_KEYS = /* @__PURE__ */ new Set([
1032
- _chunkNF52RMLWcjs.USER_EMAIL,
1033
- _chunkNF52RMLWcjs.USER_NAME,
1034
- _chunkNF52RMLWcjs.ORGANIZATION_NAME,
1035
- _chunkNF52RMLWcjs.ORGANIZATION_DOMAIN
982
+ _chunkIWSFMCHHcjs.USER_EMAIL,
983
+ _chunkIWSFMCHHcjs.USER_NAME,
984
+ _chunkIWSFMCHHcjs.ORGANIZATION_NAME,
985
+ _chunkIWSFMCHHcjs.ORGANIZATION_DOMAIN
1036
986
  ]);
1037
987
  var TOOL_CALL_ID_METADATA_KEY = "brizz_tool_call_id";
1038
988
  var TOOL_ID = "tool.id";
1039
989
  var TOOL_CALL_ID_ARG = 7;
1040
990
  function runMetadataFromContext() {
1041
- const bag = _api.context.active().getValue(_chunkNF52RMLWcjs.PROPERTIES_CONTEXT_KEY);
991
+ const bag = _api.context.active().getValue(_chunkIWSFMCHHcjs.PROPERTIES_CONTEXT_KEY);
1042
992
  if (!bag) {
1043
993
  return void 0;
1044
994
  }
1045
995
  const metadata = {};
1046
996
  for (const [name, value] of Object.entries(bag)) {
1047
997
  if (!OMITTED_KEYS.has(name)) {
1048
- metadata[`${_chunkNF52RMLWcjs.BRIZZ}.${name}`] = String(value);
998
+ metadata[`${_chunkIWSFMCHHcjs.BRIZZ}.${name}`] = String(value);
1049
999
  }
1050
1000
  }
1051
1001
  return Object.keys(metadata).length > 0 ? metadata : void 0;
@@ -1072,12 +1022,12 @@ function patchCallbackManagerModule(module2) {
1072
1022
  if (manager && metadata) {
1073
1023
  manager.addMetadata(metadata);
1074
1024
  }
1075
- } catch (e2) {
1025
+ } catch (e) {
1076
1026
  }
1077
1027
  _optionalChain([manager, 'optionalAccess', _34 => _34.handlers, 'optionalAccess', _35 => _35.forEach, 'call', _36 => _36((handler) => {
1078
1028
  try {
1079
1029
  patchTracer(handler);
1080
- } catch (e3) {
1030
+ } catch (e2) {
1081
1031
  }
1082
1032
  })]);
1083
1033
  return manager;
@@ -1132,7 +1082,7 @@ function patchToolStart(prototype) {
1132
1082
  delete rest[TOOL_CALL_ID_METADATA_KEY];
1133
1083
  this.metadata = rest;
1134
1084
  }
1135
- } catch (e4) {
1085
+ } catch (e3) {
1136
1086
  }
1137
1087
  return handleToolStart.apply(this, args);
1138
1088
  };
@@ -1142,13 +1092,13 @@ function patchInstalledCallbackManager() {
1142
1092
  try {
1143
1093
  patchCallbackManagerModule(await Promise.resolve().then(() => _interopRequireWildcard(require("@langchain/core/callbacks/manager"))));
1144
1094
  } catch (error) {
1145
- _chunkWC573FCIcjs.logger.debug(`LangChain callback manager not patched: ${String(error)}`);
1095
+ _chunkC5OT6GAQcjs.logger.debug(`LangChain callback manager not patched: ${String(error)}`);
1146
1096
  }
1147
1097
  try {
1148
1098
  const requireFromSdk = _module.createRequire.call(void 0, __filename);
1149
1099
  patchCallbackManagerModule(requireFromSdk("@langchain/core/callbacks/manager"));
1150
1100
  } catch (error) {
1151
- _chunkWC573FCIcjs.logger.debug(`LangChain CJS callback manager not patched: ${String(error)}`);
1101
+ _chunkC5OT6GAQcjs.logger.debug(`LangChain CJS callback manager not patched: ${String(error)}`);
1152
1102
  }
1153
1103
  })();
1154
1104
  }
@@ -1160,7 +1110,7 @@ function restampLangChainSpan(span) {
1160
1110
  }
1161
1111
  const attrs = span.attributes;
1162
1112
  const metadata = attrs["metadata"];
1163
- if (typeof metadata !== "string" || !metadata.includes(`"${_chunkNF52RMLWcjs.BRIZZ}.`) && !metadata.includes(`"${TOOL_CALL_ID_METADATA_KEY}"`)) {
1113
+ if (typeof metadata !== "string" || !metadata.includes(`"${_chunkIWSFMCHHcjs.BRIZZ}.`) && !metadata.includes(`"${TOOL_CALL_ID_METADATA_KEY}"`)) {
1164
1114
  return;
1165
1115
  }
1166
1116
  const parsed = JSON.parse(metadata);
@@ -1169,7 +1119,7 @@ function restampLangChainSpan(span) {
1169
1119
  }
1170
1120
  const entries = parsed;
1171
1121
  for (const [key, value] of Object.entries(entries)) {
1172
- if (key.startsWith(`${_chunkNF52RMLWcjs.BRIZZ}.`) && value !== null && value !== void 0) {
1122
+ if (key.startsWith(`${_chunkIWSFMCHHcjs.BRIZZ}.`) && value !== null && value !== void 0) {
1173
1123
  attrs[key] = String(value);
1174
1124
  }
1175
1125
  }
@@ -1178,7 +1128,7 @@ function restampLangChainSpan(span) {
1178
1128
  attrs[TOOL_ID] = toolCallId;
1179
1129
  }
1180
1130
  } catch (error) {
1181
- _chunkWC573FCIcjs.logger.debug("Skipped LangChain span re-stamp", { err: error });
1131
+ _chunkC5OT6GAQcjs.logger.debug("Skipped LangChain span re-stamp", { err: error });
1182
1132
  }
1183
1133
  }
1184
1134
 
@@ -1199,16 +1149,16 @@ var InstrumentationRegistry = (_class = class _InstrumentationRegistry {construc
1199
1149
  try {
1200
1150
  const inst = _chunkDC2MFO65cjs.bindToBrizz.call(void 0,
1201
1151
  new InstrumentationClass({
1202
- exceptionLogger: exceptionLogger2 || ((error) => _chunkWC573FCIcjs.logger.error(`Exception in instrumentation: ${String(error)}`))
1152
+ exceptionLogger: exceptionLogger2 || ((error) => _chunkC5OT6GAQcjs.logger.error(`Exception in instrumentation: ${String(error)}`))
1203
1153
  })
1204
1154
  );
1205
1155
  if (manualModule) {
1206
1156
  inst.manuallyInstrument(manualModule);
1207
- _chunkWC573FCIcjs.logger.debug(`Manual instrumentation enabled for ${name}`);
1157
+ _chunkC5OT6GAQcjs.logger.debug(`Manual instrumentation enabled for ${name}`);
1208
1158
  }
1209
1159
  return inst;
1210
1160
  } catch (error) {
1211
- _chunkWC573FCIcjs.logger.error(`Failed to load ${name} instrumentation: ${String(error)}`);
1161
+ _chunkC5OT6GAQcjs.logger.error(`Failed to load ${name} instrumentation: ${String(error)}`);
1212
1162
  return null;
1213
1163
  }
1214
1164
  }
@@ -1222,9 +1172,9 @@ var InstrumentationRegistry = (_class = class _InstrumentationRegistry {construc
1222
1172
  const openAIInst = new BrizzOpenAIInstrumentation();
1223
1173
  openAIInst.manuallyInstrument(this.manualModules.openAI);
1224
1174
  instrumentations.push(openAIInst);
1225
- _chunkWC573FCIcjs.logger.debug("Manual instrumentation enabled for OpenAI");
1175
+ _chunkC5OT6GAQcjs.logger.debug("Manual instrumentation enabled for OpenAI");
1226
1176
  } catch (error) {
1227
- _chunkWC573FCIcjs.logger.error(`Failed to load OpenAI instrumentation: ${String(error)}`);
1177
+ _chunkC5OT6GAQcjs.logger.error(`Failed to load OpenAI instrumentation: ${String(error)}`);
1228
1178
  }
1229
1179
  }
1230
1180
  const instrumentationConfigs = [
@@ -1263,9 +1213,9 @@ var InstrumentationRegistry = (_class = class _InstrumentationRegistry {construc
1263
1213
  const lcInst = new LangChainInstrumentation({ tracerProvider: _chunkDC2MFO65cjs.brizzTracerProvider });
1264
1214
  lcInst.manuallyInstrument(callbackManagerModule);
1265
1215
  patchCallbackManagerModule(callbackManagerModule);
1266
- _chunkWC573FCIcjs.logger.debug("Manual instrumentation enabled for LangChain");
1216
+ _chunkC5OT6GAQcjs.logger.debug("Manual instrumentation enabled for LangChain");
1267
1217
  } catch (error) {
1268
- _chunkWC573FCIcjs.logger.error(
1218
+ _chunkC5OT6GAQcjs.logger.error(
1269
1219
  `Failed to load LangChain instrumentation. Ensure @langchain/core is installed: ${String(error)}`
1270
1220
  );
1271
1221
  }
@@ -1274,17 +1224,17 @@ var InstrumentationRegistry = (_class = class _InstrumentationRegistry {construc
1274
1224
  if (_optionalChain([this, 'access', _60 => _60.manualModules, 'optionalAccess', _61 => _61.langgraph])) {
1275
1225
  try {
1276
1226
  new LangGraphInstrumentation().manuallyInstrument(this.manualModules.langgraph);
1277
- _chunkWC573FCIcjs.logger.debug("Manual instrumentation enabled for LangGraph");
1227
+ _chunkC5OT6GAQcjs.logger.debug("Manual instrumentation enabled for LangGraph");
1278
1228
  } catch (error) {
1279
- _chunkWC573FCIcjs.logger.error(`Failed to apply LangGraph instrumentation: ${String(error)}`);
1229
+ _chunkC5OT6GAQcjs.logger.error(`Failed to apply LangGraph instrumentation: ${String(error)}`);
1280
1230
  }
1281
1231
  }
1282
1232
  if (_optionalChain([this, 'access', _62 => _62.manualModules, 'optionalAccess', _63 => _63.typesafe])) {
1283
1233
  try {
1284
1234
  new TypeSafeInstrumentation().manuallyInstrument(this.manualModules.typesafe);
1285
- _chunkWC573FCIcjs.logger.debug("Manual instrumentation enabled for TypeSafe");
1235
+ _chunkC5OT6GAQcjs.logger.debug("Manual instrumentation enabled for TypeSafe");
1286
1236
  } catch (error) {
1287
- _chunkWC573FCIcjs.logger.error(`Failed to apply TypeSafe instrumentation: ${String(error)}`);
1237
+ _chunkC5OT6GAQcjs.logger.error(`Failed to apply TypeSafe instrumentation: ${String(error)}`);
1288
1238
  }
1289
1239
  }
1290
1240
  if (_optionalChain([this, 'access', _64 => _64.manualModules, 'optionalAccess', _65 => _65.google_vertexai])) {
@@ -1294,9 +1244,9 @@ var InstrumentationRegistry = (_class = class _InstrumentationRegistry {construc
1294
1244
  const { VertexAIInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("@traceloop/instrumentation-vertexai")));
1295
1245
  const vertexInst = _chunkDC2MFO65cjs.bindToBrizz.call(void 0, new VertexAIInstrumentation({ exceptionLogger: exceptionLogger2 }));
1296
1246
  vertexInst.manuallyInstrument(vertexModule);
1297
- _chunkWC573FCIcjs.logger.debug("Manual instrumentation enabled for Vertex AI");
1247
+ _chunkC5OT6GAQcjs.logger.debug("Manual instrumentation enabled for Vertex AI");
1298
1248
  } catch (error) {
1299
- _chunkWC573FCIcjs.logger.error(
1249
+ _chunkC5OT6GAQcjs.logger.error(
1300
1250
  `Failed to load Vertex AI instrumentation. Ensure @traceloop/instrumentation-vertexai is installed: ${String(error)}`
1301
1251
  );
1302
1252
  }
@@ -1306,12 +1256,12 @@ var InstrumentationRegistry = (_class = class _InstrumentationRegistry {construc
1306
1256
  const genaiModule = this.manualModules.google_genai;
1307
1257
  void (async () => {
1308
1258
  try {
1309
- const { GoogleGenAIInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("./google-genai-GVCKSJMR.cjs")));
1259
+ const { GoogleGenAIInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("./google-genai-KDEYFHTK.cjs")));
1310
1260
  const genaiInst = new GoogleGenAIInstrumentation({ exceptionLogger: exceptionLogger2 });
1311
1261
  genaiInst.manuallyInstrument(genaiModule);
1312
- _chunkWC573FCIcjs.logger.debug("Manual instrumentation enabled for Google GenAI");
1262
+ _chunkC5OT6GAQcjs.logger.debug("Manual instrumentation enabled for Google GenAI");
1313
1263
  } catch (error) {
1314
- _chunkWC573FCIcjs.logger.error(
1264
+ _chunkC5OT6GAQcjs.logger.error(
1315
1265
  `Failed to apply Google GenAI instrumentation. Ensure @traceloop/instrumentation-google-generativeai is installed; on a read-only ESM module namespace use instrumentGoogleGenAI from @brizz/sdk/google-genai instead: ${String(error)}`
1316
1266
  );
1317
1267
  }
@@ -1321,12 +1271,12 @@ var InstrumentationRegistry = (_class = class _InstrumentationRegistry {construc
1321
1271
  const mcpModules = this.manualModules.mcp;
1322
1272
  void (async () => {
1323
1273
  try {
1324
- const { MCPInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("./mcp-5ERVMLSA.cjs")));
1274
+ const { MCPInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("./mcp-E5TPIVFI.cjs")));
1325
1275
  const instrumentation = new MCPInstrumentation({ exceptionLogger: exceptionLogger2 });
1326
1276
  instrumentation.manuallyInstrument(mcpModules);
1327
- _chunkWC573FCIcjs.logger.debug("Manual instrumentation enabled for MCP");
1277
+ _chunkC5OT6GAQcjs.logger.debug("Manual instrumentation enabled for MCP");
1328
1278
  } catch (error) {
1329
- _chunkWC573FCIcjs.logger.error(`Failed to apply MCP instrumentation: ${String(error)}`);
1279
+ _chunkC5OT6GAQcjs.logger.error(`Failed to apply MCP instrumentation: ${String(error)}`);
1330
1280
  }
1331
1281
  })();
1332
1282
  }
@@ -1336,7 +1286,7 @@ var InstrumentationRegistry = (_class = class _InstrumentationRegistry {construc
1336
1286
  */
1337
1287
  setManualModules(modules) {
1338
1288
  this.manualModules = modules;
1339
- _chunkWC573FCIcjs.logger.info("Manual instrumentation modules configured for Next.js/Webpack compatibility");
1289
+ _chunkC5OT6GAQcjs.logger.info("Manual instrumentation modules configured for Next.js/Webpack compatibility");
1340
1290
  }
1341
1291
  /**
1342
1292
  * Get manual instrumentations only.
@@ -1344,19 +1294,197 @@ var InstrumentationRegistry = (_class = class _InstrumentationRegistry {construc
1344
1294
  */
1345
1295
  getManualInstrumentations() {
1346
1296
  if (!this.manualModules || Object.keys(this.manualModules).length === 0) {
1347
- _chunkWC573FCIcjs.logger.debug("No manual instrumentation modules configured");
1297
+ _chunkC5OT6GAQcjs.logger.debug("No manual instrumentation modules configured");
1348
1298
  return [];
1349
1299
  }
1350
1300
  const instrumentations = [];
1351
1301
  const exceptionLogger2 = (error) => {
1352
- _chunkWC573FCIcjs.logger.error(`Exception in manual instrumentation: ${String(error)}`);
1302
+ _chunkC5OT6GAQcjs.logger.error(`Exception in manual instrumentation: ${String(error)}`);
1353
1303
  };
1354
1304
  this.loadManualInstrumentations(instrumentations, exceptionLogger2);
1355
- _chunkWC573FCIcjs.logger.info(`Loaded ${instrumentations.length} manual instrumentations`);
1305
+ _chunkC5OT6GAQcjs.logger.info(`Loaded ${instrumentations.length} manual instrumentations`);
1356
1306
  return instrumentations;
1357
1307
  }
1358
1308
  }, _class);
1359
1309
 
1310
+ // src/internal/instrumentation/vercel-ai/interrupt.ts
1311
+
1312
+ var INNER_OPERATION_IDS = /* @__PURE__ */ new Set([
1313
+ "ai.generateText.doGenerate",
1314
+ "ai.streamText.doStream"
1315
+ ]);
1316
+ function isLegacyModelCallSpan(span) {
1317
+ if (INNER_OPERATION_IDS.has(span.name)) {
1318
+ return true;
1319
+ }
1320
+ const opId = span.attributes["ai.operationId"];
1321
+ return typeof opId === "string" && INNER_OPERATION_IDS.has(opId);
1322
+ }
1323
+ function isGenAIModelCallSpan(span) {
1324
+ return _optionalChain([span, 'access', _70 => _70.instrumentationScope, 'optionalAccess', _71 => _71.name]) === _chunkIWSFMCHHcjs.AI_SDK_OTEL_SCOPE && span.attributes["gen_ai.operation.name"] === "chat";
1325
+ }
1326
+ var MAX_PENDING_ENTRIES = 1024;
1327
+ var pendingByParentSpanId = /* @__PURE__ */ new Map();
1328
+ var needsApprovalToolNames = /* @__PURE__ */ new Set();
1329
+ var versionState = { sawActiveSpan: false };
1330
+ function setPending(parentSpanId, value) {
1331
+ pendingByParentSpanId.set(parentSpanId, value);
1332
+ evictOldest(pendingByParentSpanId);
1333
+ }
1334
+ function extractInterruptTools(tools) {
1335
+ if (!tools || typeof tools !== "object") {
1336
+ return [];
1337
+ }
1338
+ return Object.entries(tools).filter(
1339
+ ([, t]) => !!t && typeof t === "object" && t.needsApproval
1340
+ ).map(([name]) => name);
1341
+ }
1342
+ function parsePromptToolNames(raw) {
1343
+ if (!Array.isArray(raw)) {
1344
+ return null;
1345
+ }
1346
+ const names = [];
1347
+ for (const element of raw) {
1348
+ if (typeof element !== "string") {
1349
+ continue;
1350
+ }
1351
+ try {
1352
+ const parsed = JSON.parse(element);
1353
+ if (parsed && typeof parsed.name === "string") {
1354
+ names.push(parsed.name);
1355
+ }
1356
+ } catch (e4) {
1357
+ }
1358
+ }
1359
+ return names.length > 0 ? names : null;
1360
+ }
1361
+ var verdictsByToolCallId = /* @__PURE__ */ new Map();
1362
+ function recordVerdicts(messages) {
1363
+ if (!Array.isArray(messages)) {
1364
+ return;
1365
+ }
1366
+ const parts = messages.flatMap((message) => {
1367
+ const content = _optionalChain([message, 'optionalAccess', _72 => _72.content]);
1368
+ return Array.isArray(content) ? content : [];
1369
+ });
1370
+ const askedOf = /* @__PURE__ */ new Map();
1371
+ for (const part of parts) {
1372
+ if (_optionalChain([part, 'optionalAccess', _73 => _73.type]) === "tool-approval-request" && part.isAutomatic !== true) {
1373
+ askedOf.set(part.approvalId, part.toolCallId);
1374
+ }
1375
+ }
1376
+ for (const part of parts) {
1377
+ const toolCallId = _optionalChain([part, 'optionalAccess', _74 => _74.type]) === "tool-approval-response" && askedOf.get(part.approvalId);
1378
+ if (typeof toolCallId === "string" && typeof part.approved === "boolean") {
1379
+ verdictsByToolCallId.set(toolCallId, part.approved);
1380
+ evictOldest(verdictsByToolCallId);
1381
+ }
1382
+ }
1383
+ }
1384
+ function verdictsForRequest(inputMessages) {
1385
+ if (typeof inputMessages !== "string" || verdictsByToolCallId.size === 0) {
1386
+ return void 0;
1387
+ }
1388
+ let messages;
1389
+ try {
1390
+ messages = JSON.parse(inputMessages);
1391
+ } catch (e5) {
1392
+ return void 0;
1393
+ }
1394
+ if (!Array.isArray(messages)) {
1395
+ return void 0;
1396
+ }
1397
+ const verdicts = {};
1398
+ for (const message of [...messages].reverse()) {
1399
+ const { role, parts } = _nullishCoalesce(message, () => ( {}));
1400
+ if (role === "assistant" || role === "system") {
1401
+ break;
1402
+ }
1403
+ for (const part of Array.isArray(parts) ? parts : []) {
1404
+ const approved = _optionalChain([part, 'optionalAccess', _75 => _75.type]) === "tool_call_response" && typeof part.id === "string" ? verdictsByToolCallId.get(part.id) : void 0;
1405
+ if (approved !== void 0) {
1406
+ verdicts[part.id] = approved;
1407
+ }
1408
+ }
1409
+ }
1410
+ return Object.keys(verdicts).length > 0 ? JSON.stringify(verdicts) : void 0;
1411
+ }
1412
+ function evictOldest(map) {
1413
+ while (map.size > MAX_PENDING_ENTRIES) {
1414
+ const oldest = map.keys().next().value;
1415
+ if (oldest === void 0) {
1416
+ break;
1417
+ }
1418
+ map.delete(oldest);
1419
+ }
1420
+ }
1421
+ function createInterruptIntegration() {
1422
+ const onStart = (event) => {
1423
+ recordVerdicts(event.messages);
1424
+ for (const name of extractInterruptTools(event.tools)) {
1425
+ needsApprovalToolNames.add(name);
1426
+ }
1427
+ };
1428
+ const onStepStart = (event) => {
1429
+ const span = _api.trace.getActiveSpan();
1430
+ if (span) {
1431
+ versionState.sawActiveSpan = true;
1432
+ }
1433
+ const names = extractInterruptTools(event.tools);
1434
+ if (names.length === 0) {
1435
+ return;
1436
+ }
1437
+ for (const name of names) {
1438
+ needsApprovalToolNames.add(name);
1439
+ }
1440
+ if (!span) {
1441
+ return;
1442
+ }
1443
+ const value = JSON.stringify(names);
1444
+ span.setAttribute(_chunkIWSFMCHHcjs.INTERRUPT_TOOLS, value);
1445
+ setPending(span.spanContext().spanId, value);
1446
+ };
1447
+ return {
1448
+ onStart,
1449
+ onStepStart
1450
+ };
1451
+ }
1452
+ var InterruptPropagator = class {
1453
+ onStart(span, _parentContext) {
1454
+ if (isGenAIModelCallSpan(span)) {
1455
+ const verdicts = verdictsForRequest(span.attributes["gen_ai.input.messages"]);
1456
+ if (verdicts) {
1457
+ span.setAttribute(_chunkIWSFMCHHcjs.APPROVALS, verdicts);
1458
+ }
1459
+ return;
1460
+ }
1461
+ if (!isLegacyModelCallSpan(span)) {
1462
+ return;
1463
+ }
1464
+ const parentSpanId = _optionalChain([span, 'access', _76 => _76.parentSpanContext, 'optionalAccess', _77 => _77.spanId]);
1465
+ const stashed = parentSpanId && pendingByParentSpanId.get(parentSpanId);
1466
+ if (stashed) {
1467
+ span.setAttribute(_chunkIWSFMCHHcjs.INTERRUPT_TOOLS, stashed);
1468
+ pendingByParentSpanId.delete(parentSpanId);
1469
+ return;
1470
+ }
1471
+ if (versionState.sawActiveSpan || needsApprovalToolNames.size === 0) {
1472
+ return;
1473
+ }
1474
+ const scoped = parsePromptToolNames(span.attributes["ai.prompt.tools"]);
1475
+ const names = scoped === null ? [...needsApprovalToolNames] : scoped.filter((n) => needsApprovalToolNames.has(n));
1476
+ if (names.length > 0) {
1477
+ span.setAttribute(_chunkIWSFMCHHcjs.INTERRUPT_TOOLS, JSON.stringify(names));
1478
+ }
1479
+ }
1480
+ onEnd() {
1481
+ }
1482
+ async shutdown() {
1483
+ }
1484
+ async forceFlush() {
1485
+ }
1486
+ };
1487
+
1360
1488
  // src/internal/log/logging.ts
1361
1489
 
1362
1490
  var _exporterlogsotlphttp = require('@opentelemetry/exporter-logs-otlp-http');
@@ -1619,7 +1747,7 @@ function compilePatternEntries(patternEntries) {
1619
1747
  try {
1620
1748
  patternGroups.push(getGroupedPattern(patternEntry));
1621
1749
  } catch (error) {
1622
- _chunkWC573FCIcjs.logger.warn(`Invalid pattern '${patternEntry.name}': ${patternEntry.pattern}`, error);
1750
+ _chunkC5OT6GAQcjs.logger.warn(`Invalid pattern '${patternEntry.name}': ${patternEntry.pattern}`, error);
1623
1751
  continue;
1624
1752
  }
1625
1753
  }
@@ -1629,23 +1757,26 @@ function compilePatternEntries(patternEntries) {
1629
1757
  try {
1630
1758
  return new RegExp(patternGroups.join("|"));
1631
1759
  } catch (error) {
1632
- _chunkWC573FCIcjs.logger.warn("Failed to compile pattern entries into regex", error);
1760
+ _chunkC5OT6GAQcjs.logger.warn("Failed to compile pattern entries into regex", error);
1633
1761
  return null;
1634
1762
  }
1635
1763
  }
1636
1764
  var compiledPatternCache = /* @__PURE__ */ new WeakMap();
1637
1765
  function getCompiledPatternsForRule(rule) {
1638
1766
  const key = rule.patterns;
1639
- if (compiledPatternCache.has(key)) {
1640
- return _nullishCoalesce(compiledPatternCache.get(key), () => ( null));
1767
+ const cached = compiledPatternCache.get(key);
1768
+ if (cached) {
1769
+ return cached;
1641
1770
  }
1642
- const compiled = compilePatternEntries(convertPatternsToPatternEntries(rule.patterns));
1771
+ const entries = convertPatternsToPatternEntries(rule.patterns);
1772
+ const pattern = compilePatternEntries(entries);
1773
+ const compiled = { pattern, custom: pattern && compileCustomEntries(entries) };
1643
1774
  compiledPatternCache.set(key, compiled);
1644
1775
  return compiled;
1645
1776
  }
1646
1777
  function getCompiledAttributeNamePattern(rule) {
1647
1778
  if (!rule.attributePattern) {
1648
- _chunkWC573FCIcjs.logger.debug("No attribute pattern provided, using default .*");
1779
+ _chunkC5OT6GAQcjs.logger.debug("No attribute pattern provided, using default .*");
1649
1780
  return /.*/;
1650
1781
  }
1651
1782
  let compiledPatternString = rule.attributePattern;
@@ -1656,12 +1787,12 @@ function getCompiledAttributeNamePattern(rule) {
1656
1787
  }
1657
1788
  function shouldContinueExecution(startTime, iterations, timeoutMs) {
1658
1789
  if (Date.now() - startTime > timeoutMs) {
1659
- _chunkWC573FCIcjs.logger.warn("Regex execution timed out - potential ReDoS pattern detected");
1790
+ _chunkC5OT6GAQcjs.logger.warn("Regex execution timed out - potential ReDoS pattern detected");
1660
1791
  return false;
1661
1792
  }
1662
1793
  const maxIterations = 1e3;
1663
1794
  if (iterations > maxIterations) {
1664
- _chunkWC573FCIcjs.logger.warn("Regex execution exceeded maximum iterations - potential ReDoS pattern detected");
1795
+ _chunkC5OT6GAQcjs.logger.warn("Regex execution exceeded maximum iterations - potential ReDoS pattern detected");
1665
1796
  return false;
1666
1797
  }
1667
1798
  return true;
@@ -1689,11 +1820,40 @@ function executeRegexWithTimeout(pattern, value, timeoutMs = 100) {
1689
1820
  }
1690
1821
  return matches;
1691
1822
  }
1692
- function maskStringByPattern(value, pattern, mode = "full") {
1823
+ var BUILTIN_ENTRIES = new Set(DEFAULT_PII_PATTERNS);
1824
+ function compileCustomEntries(patternEntries) {
1825
+ const groups = patternEntries.filter((entry) => !BUILTIN_ENTRIES.has(entry)).flatMap((entry) => {
1826
+ try {
1827
+ return [getGroupedPattern(entry)];
1828
+ } catch (e6) {
1829
+ return [];
1830
+ }
1831
+ });
1832
+ return groups.length > 0 ? new RegExp(groups.join("|")) : null;
1833
+ }
1834
+ function isDecimalPart(value, match) {
1835
+ const start = match.index;
1836
+ const end = start + match[0].length;
1837
+ if (!/^[0-9]+$/.test(match[0])) {
1838
+ return false;
1839
+ }
1840
+ const afterPoint = value.charAt(start - 1) === "." && /^[0-9]$/.test(value.charAt(start - 2));
1841
+ const beforePoint = value.charAt(end) === "." && /^[0-9]$/.test(value.charAt(end + 1));
1842
+ return afterPoint || beforePoint;
1843
+ }
1844
+ function overlapsAny(match, others) {
1845
+ const end = match.index + match[0].length;
1846
+ return others.some((other) => other.index < end && match.index < other.index + other[0].length);
1847
+ }
1848
+ function maskStringByPattern(value, pattern, mode = "full", custom = pattern) {
1693
1849
  const matches = [];
1694
1850
  try {
1695
1851
  const regexMatches = executeRegexWithTimeout(pattern, value);
1852
+ const customMatches = custom && regexMatches.some((match) => isDecimalPart(value, match)) ? executeRegexWithTimeout(custom, value) : [];
1696
1853
  for (const match of regexMatches) {
1854
+ if (isDecimalPart(value, match) && !overlapsAny(match, customMatches)) {
1855
+ continue;
1856
+ }
1697
1857
  matches.push({
1698
1858
  start: match.index,
1699
1859
  end: match.index + match[0].length,
@@ -1702,7 +1862,7 @@ function maskStringByPattern(value, pattern, mode = "full") {
1702
1862
  });
1703
1863
  }
1704
1864
  } catch (error) {
1705
- _chunkWC573FCIcjs.logger.warn("Regex execution failed, skipping masking", error);
1865
+ _chunkC5OT6GAQcjs.logger.warn("Regex execution failed, skipping masking", error);
1706
1866
  return value;
1707
1867
  }
1708
1868
  for (const matchInfo of matches.toReversed()) {
@@ -1721,7 +1881,7 @@ function maskStringByPattern(value, pattern, mode = "full") {
1721
1881
  }
1722
1882
  }
1723
1883
  }
1724
- _chunkWC573FCIcjs.logger.info(`Masking detected: pattern '${patternName}' found match in value`);
1884
+ _chunkC5OT6GAQcjs.logger.info(`Masking detected: pattern '${patternName}' found match in value`);
1725
1885
  const masked = mode === "partial" ? matchInfo.text.at(0) + "*****" : "*****";
1726
1886
  value = value.slice(0, matchInfo.start) + masked + value.slice(matchInfo.end);
1727
1887
  }
@@ -1730,18 +1890,18 @@ function maskStringByPattern(value, pattern, mode = "full") {
1730
1890
  function maskStringByPatternBasedRule(value, rule) {
1731
1891
  const patternEntries = convertPatternsToPatternEntries(rule.patterns);
1732
1892
  if (patternEntries.length === 0) {
1733
- _chunkWC573FCIcjs.logger.warn("No patterns provided for masking rule, returning original value");
1893
+ _chunkC5OT6GAQcjs.logger.warn("No patterns provided for masking rule, returning original value");
1734
1894
  return value;
1735
1895
  }
1736
1896
  const mode = rule.mode;
1737
1897
  if (!patternEntries || patternEntries.length === 0) {
1738
1898
  return mode === "partial" && value ? value.at(0) + "*****" : "*****";
1739
1899
  }
1740
- const compiledPatterns = getCompiledPatternsForRule(rule);
1741
- if (!compiledPatterns) {
1900
+ const { pattern, custom } = getCompiledPatternsForRule(rule);
1901
+ if (!pattern) {
1742
1902
  return value;
1743
1903
  }
1744
- return maskStringByPattern(value, compiledPatterns, mode);
1904
+ return maskStringByPattern(value, pattern, mode, custom);
1745
1905
  }
1746
1906
  function maskValue(value, rule) {
1747
1907
  if (typeof value === "string") {
@@ -1776,7 +1936,7 @@ function maskAttributes(attributes, rules, outputOriginalValue = false) {
1776
1936
  const value = maskedAttributes[attribute];
1777
1937
  if (value !== null && value !== void 0) {
1778
1938
  if (outputOriginalValue) {
1779
- _chunkWC573FCIcjs.logger.debug(`Masking attribute '${attribute}' with original value`, { value });
1939
+ _chunkC5OT6GAQcjs.logger.debug(`Masking attribute '${attribute}' with original value`, { value });
1780
1940
  }
1781
1941
  maskedAttributes[attribute] = maskValue(value, rule);
1782
1942
  }
@@ -1800,14 +1960,14 @@ var BrizzSimpleLogRecordProcessor = class extends _sdklogs.SimpleLogRecordProces
1800
1960
  this.config = config;
1801
1961
  }
1802
1962
  onEmit(logRecord) {
1803
- const maskingConfig = _optionalChain([this, 'access', _70 => _70.config, 'access', _71 => _71.masking, 'optionalAccess', _72 => _72.eventMasking]);
1963
+ const maskingConfig = _optionalChain([this, 'access', _78 => _78.config, 'access', _79 => _79.masking, 'optionalAccess', _80 => _80.eventMasking]);
1804
1964
  if (maskingConfig) {
1805
1965
  maskLog(logRecord, maskingConfig);
1806
1966
  }
1807
- const associationProperties = _api.context.active().getValue(_chunkNF52RMLWcjs.PROPERTIES_CONTEXT_KEY);
1967
+ const associationProperties = _api.context.active().getValue(_chunkIWSFMCHHcjs.PROPERTIES_CONTEXT_KEY);
1808
1968
  if (associationProperties) {
1809
1969
  for (const [key, value] of Object.entries(associationProperties)) {
1810
- logRecord.setAttribute(`${_chunkNF52RMLWcjs.BRIZZ}.${key}`, value);
1970
+ logRecord.setAttribute(`${_chunkIWSFMCHHcjs.BRIZZ}.${key}`, value);
1811
1971
  }
1812
1972
  }
1813
1973
  super.onEmit(logRecord);
@@ -1820,14 +1980,14 @@ var BrizzBatchLogRecordProcessor = class extends _sdklogs.BatchLogRecordProcesso
1820
1980
  this.config = config;
1821
1981
  }
1822
1982
  onEmit(logRecord) {
1823
- const maskingConfig = _optionalChain([this, 'access', _73 => _73.config, 'access', _74 => _74.masking, 'optionalAccess', _75 => _75.eventMasking]);
1983
+ const maskingConfig = _optionalChain([this, 'access', _81 => _81.config, 'access', _82 => _82.masking, 'optionalAccess', _83 => _83.eventMasking]);
1824
1984
  if (maskingConfig) {
1825
1985
  maskLog(logRecord, maskingConfig);
1826
1986
  }
1827
- const associationProperties = _api.context.active().getValue(_chunkNF52RMLWcjs.PROPERTIES_CONTEXT_KEY);
1987
+ const associationProperties = _api.context.active().getValue(_chunkIWSFMCHHcjs.PROPERTIES_CONTEXT_KEY);
1828
1988
  if (associationProperties) {
1829
1989
  for (const [key, value] of Object.entries(associationProperties)) {
1830
- logRecord.setAttribute(`${_chunkNF52RMLWcjs.BRIZZ}.${key}`, value);
1990
+ logRecord.setAttribute(`${_chunkIWSFMCHHcjs.BRIZZ}.${key}`, value);
1831
1991
  }
1832
1992
  }
1833
1993
  super.onEmit(logRecord);
@@ -1854,7 +2014,7 @@ function maskLog(logRecord, config) {
1854
2014
  newAttributes[key] = value;
1855
2015
  }
1856
2016
  for (const [key, value] of Object.entries(logRecord.attributes)) {
1857
- if (key.startsWith(_chunkNF52RMLWcjs.INTERNAL_EVENT_PREFIX)) {
2017
+ if (key.startsWith(_chunkIWSFMCHHcjs.INTERNAL_EVENT_PREFIX)) {
1858
2018
  newAttributes[key] = value;
1859
2019
  }
1860
2020
  }
@@ -1870,7 +2030,7 @@ function maskLog(logRecord, config) {
1870
2030
  }
1871
2031
  return logRecord;
1872
2032
  } catch (error) {
1873
- _chunkWC573FCIcjs.logger.error("Error masking log record:", error);
2033
+ _chunkC5OT6GAQcjs.logger.error("Error masking log record:", error);
1874
2034
  return logRecord;
1875
2035
  }
1876
2036
  }
@@ -1896,7 +2056,7 @@ var LoggingModule = (_class2 = class _LoggingModule {constructor() { _class2.pro
1896
2056
  */
1897
2057
  createLogExporter(config, serviceName) {
1898
2058
  if (config.customLogExporter) {
1899
- _chunkWC573FCIcjs.logger.debug("Using custom log exporter");
2059
+ _chunkC5OT6GAQcjs.logger.debug("Using custom log exporter");
1900
2060
  if (serviceName === config.appName) {
1901
2061
  return config.customLogExporter;
1902
2062
  }
@@ -1909,7 +2069,7 @@ var LoggingModule = (_class2 = class _LoggingModule {constructor() { _class2.pro
1909
2069
  };
1910
2070
  }
1911
2071
  const logsUrl = config.baseUrl.replace(/\/$/, "") + "/v1/logs";
1912
- _chunkWC573FCIcjs.logger.debug("Initializing default OTLP log exporter", { url: logsUrl, serviceName });
2072
+ _chunkC5OT6GAQcjs.logger.debug("Initializing default OTLP log exporter", { url: logsUrl, serviceName });
1913
2073
  const headers = serviceName === config.appName ? { ...config.headers } : { ...config.headers, [_chunkUNLNNKZ7cjs.SERVICE_NAME_HEADER]: serviceName };
1914
2074
  return new (0, _exporterlogsotlphttp.OTLPLogExporter)({ url: logsUrl, headers });
1915
2075
  }
@@ -1918,17 +2078,17 @@ var LoggingModule = (_class2 = class _LoggingModule {constructor() { _class2.pro
1918
2078
  * exporter and masking-aware processor.
1919
2079
  */
1920
2080
  createLoggerProvider(config, serviceName) {
1921
- _chunkWC573FCIcjs.logger.debug("Creating logger provider", {
2081
+ _chunkC5OT6GAQcjs.logger.debug("Creating logger provider", {
1922
2082
  serviceName,
1923
2083
  disableBatch: config.disableBatch,
1924
- hasMasking: !!_optionalChain([config, 'access', _76 => _76.masking, 'optionalAccess', _77 => _77.eventMasking])
2084
+ hasMasking: !!_optionalChain([config, 'access', _84 => _84.masking, 'optionalAccess', _85 => _85.eventMasking])
1925
2085
  });
1926
2086
  const exporter = this.createLogExporter(config, serviceName);
1927
2087
  const processor = config.disableBatch ? new BrizzSimpleLogRecordProcessor(exporter, config) : new BrizzBatchLogRecordProcessor(exporter, config);
1928
2088
  const resourceAttributes = {
1929
2089
  ...config.resourceAttributes,
1930
2090
  "service.name": serviceName,
1931
- [BRIZZ_SDK_VERSION]: _chunkCNVK5RA3cjs.getSDKVersion.call(void 0, ),
2091
+ [BRIZZ_SDK_VERSION]: _chunkSTMZ73NMcjs.getSDKVersion.call(void 0, ),
1932
2092
  [BRIZZ_SDK_LANGUAGE]: SDK_LANGUAGE
1933
2093
  };
1934
2094
  if (config.environment) {
@@ -1947,7 +2107,7 @@ var LoggingModule = (_class2 = class _LoggingModule {constructor() { _class2.pro
1947
2107
  * `callWithServiceName`, else the configured appName.
1948
2108
  */
1949
2109
  activeLoggerProvider() {
1950
- const serviceName = _chunk4QNEI7VZcjs.resolveServiceNameFromContext.call(void 0, );
2110
+ const serviceName = _chunkUF4GMVEYcjs.resolveServiceNameFromContext.call(void 0, );
1951
2111
  if (!serviceName || !this.config || serviceName === this.config.appName) {
1952
2112
  return this.loggerProvider;
1953
2113
  }
@@ -1962,22 +2122,22 @@ var LoggingModule = (_class2 = class _LoggingModule {constructor() { _class2.pro
1962
2122
  * Initialize the logging module with the provided configuration
1963
2123
  */
1964
2124
  setup(config) {
1965
- _chunkWC573FCIcjs.logger.info("Setting up logging module");
2125
+ _chunkC5OT6GAQcjs.logger.info("Setting up logging module");
1966
2126
  this.config = config;
1967
2127
  if (this.loggerProvider) {
1968
- _chunkWC573FCIcjs.logger.debug("Logger provider already initialized, skipping re-initialization");
2128
+ _chunkC5OT6GAQcjs.logger.debug("Logger provider already initialized, skipping re-initialization");
1969
2129
  } else {
1970
2130
  this.loggerProvider = this.createLoggerProvider(config, config.appName);
1971
2131
  }
1972
2132
  _LoggingModule.instance = this;
1973
- _chunk4QNEI7VZcjs.setEventSink.call(void 0, this);
1974
- _chunkWC573FCIcjs.logger.info("Logging module setup completed");
2133
+ _chunkUF4GMVEYcjs.setEventSink.call(void 0, this);
2134
+ _chunkC5OT6GAQcjs.logger.info("Logging module setup completed");
1975
2135
  }
1976
2136
  /**
1977
2137
  * Emit a custom event to the telemetry pipeline
1978
2138
  */
1979
2139
  emitEvent(name, attributes, body, severityNumber = _api.SeverityNumber.INFO) {
1980
- _chunkWC573FCIcjs.logger.debug("Attempting to emit event", {
2140
+ _chunkC5OT6GAQcjs.logger.debug("Attempting to emit event", {
1981
2141
  name,
1982
2142
  hasAttributes: !!attributes,
1983
2143
  attributesCount: attributes ? Object.keys(attributes).length : 0,
@@ -1986,17 +2146,17 @@ var LoggingModule = (_class2 = class _LoggingModule {constructor() { _class2.pro
1986
2146
  });
1987
2147
  const provider = this.activeLoggerProvider();
1988
2148
  if (!provider) {
1989
- _chunkWC573FCIcjs.logger.error("Cannot emit event: Logger provider not initialized");
2149
+ _chunkC5OT6GAQcjs.logger.error("Cannot emit event: Logger provider not initialized");
1990
2150
  throw new Error("Logging module not initialized");
1991
2151
  }
1992
2152
  const logAttributes = { "event.name": name };
1993
2153
  if (attributes) {
1994
2154
  Object.assign(logAttributes, attributes);
1995
- _chunkWC573FCIcjs.logger.debug("Combined log attributes", { attributes: Object.keys(logAttributes) });
2155
+ _chunkC5OT6GAQcjs.logger.debug("Combined log attributes", { attributes: Object.keys(logAttributes) });
1996
2156
  }
1997
- _chunkWC573FCIcjs.logger.debug("Getting logger instance for brizz_events");
2157
+ _chunkC5OT6GAQcjs.logger.debug("Getting logger instance for brizz_events");
1998
2158
  const eventLogger = provider.getLogger("brizz.events");
1999
- _chunkWC573FCIcjs.logger.debug("Emitting log record with eventName", { eventName: name });
2159
+ _chunkC5OT6GAQcjs.logger.debug("Emitting log record with eventName", { eventName: name });
2000
2160
  try {
2001
2161
  eventLogger.emit({
2002
2162
  eventName: name,
@@ -2004,10 +2164,10 @@ var LoggingModule = (_class2 = class _LoggingModule {constructor() { _class2.pro
2004
2164
  severityNumber,
2005
2165
  body
2006
2166
  });
2007
- _chunkWC573FCIcjs.logger.debug("Event successfully emitted", { eventName: name });
2167
+ _chunkC5OT6GAQcjs.logger.debug("Event successfully emitted", { eventName: name });
2008
2168
  } catch (error) {
2009
- _chunkWC573FCIcjs.logger.error(`Failed to emit event '${name}'`, { error, eventName: name });
2010
- _chunkWC573FCIcjs.logger.error("Log record that failed", {
2169
+ _chunkC5OT6GAQcjs.logger.error(`Failed to emit event '${name}'`, { error, eventName: name });
2170
+ _chunkC5OT6GAQcjs.logger.error("Log record that failed", {
2011
2171
  eventName: name,
2012
2172
  hasAttributes: logAttributes,
2013
2173
  severityNumber,
@@ -2030,14 +2190,14 @@ var LoggingModule = (_class2 = class _LoggingModule {constructor() { _class2.pro
2030
2190
  }
2031
2191
  async forceFlush() {
2032
2192
  await Promise.all(
2033
- [...this.scopedProviders.values(), this.loggerProvider].map(async (p) => _optionalChain([p, 'optionalAccess', _78 => _78.forceFlush, 'call', _79 => _79()]))
2193
+ [...this.scopedProviders.values(), this.loggerProvider].map(async (p) => _optionalChain([p, 'optionalAccess', _86 => _86.forceFlush, 'call', _87 => _87()]))
2034
2194
  );
2035
2195
  }
2036
2196
  /**
2037
2197
  * Shutdown the logging module
2038
2198
  */
2039
2199
  async shutdown() {
2040
- _chunkWC573FCIcjs.logger.debug("Shutting down logging module");
2200
+ _chunkC5OT6GAQcjs.logger.debug("Shutting down logging module");
2041
2201
  await Promise.all([...this.scopedProviders.values()].map(async (p) => p.shutdown()));
2042
2202
  this.scopedProviders.clear();
2043
2203
  if (this.loggerProvider) {
@@ -2048,8 +2208,8 @@ var LoggingModule = (_class2 = class _LoggingModule {constructor() { _class2.pro
2048
2208
  if (_LoggingModule.instance === this) {
2049
2209
  _LoggingModule.instance = null;
2050
2210
  }
2051
- _chunk4QNEI7VZcjs.clearEventSink.call(void 0, this);
2052
- _chunkWC573FCIcjs.logger.debug("Logging module shutdown completed");
2211
+ _chunkUF4GMVEYcjs.clearEventSink.call(void 0, this);
2212
+ _chunkC5OT6GAQcjs.logger.debug("Logging module shutdown completed");
2053
2213
  }
2054
2214
  }, _class2.__initStatic(), _class2);
2055
2215
 
@@ -2071,32 +2231,32 @@ var MetricsModule = (_class3 = class _MetricsModule {constructor() { _class3.pro
2071
2231
  */
2072
2232
  initMetricsExporter(config) {
2073
2233
  if (this.metricsExporter) {
2074
- _chunkWC573FCIcjs.logger.debug("Metrics exporter already initialized, skipping re-initialization");
2234
+ _chunkC5OT6GAQcjs.logger.debug("Metrics exporter already initialized, skipping re-initialization");
2075
2235
  return;
2076
2236
  }
2077
2237
  const metricsUrl = config.baseUrl.replace(/\/$/, "") + "/v1/metrics";
2078
- _chunkWC573FCIcjs.logger.debug("Initializing metrics exporter", { url: metricsUrl });
2238
+ _chunkC5OT6GAQcjs.logger.debug("Initializing metrics exporter", { url: metricsUrl });
2079
2239
  this.metricsExporter = new (0, _exportermetricsotlphttp.OTLPMetricExporter)({
2080
2240
  url: metricsUrl,
2081
2241
  headers: config.headers
2082
2242
  });
2083
- _chunkWC573FCIcjs.logger.debug("Metrics exporter initialized successfully");
2243
+ _chunkC5OT6GAQcjs.logger.debug("Metrics exporter initialized successfully");
2084
2244
  }
2085
2245
  /**
2086
2246
  * Initialize the metrics reader
2087
2247
  */
2088
2248
  initMetricsReader(config) {
2089
2249
  if (this.metricsReader) {
2090
- _chunkWC573FCIcjs.logger.debug("Metrics reader already initialized, skipping re-initialization");
2250
+ _chunkC5OT6GAQcjs.logger.debug("Metrics reader already initialized, skipping re-initialization");
2091
2251
  return;
2092
2252
  }
2093
2253
  if (config.customMetricReader) {
2094
- _chunkWC573FCIcjs.logger.debug("Using custom metric reader");
2254
+ _chunkC5OT6GAQcjs.logger.debug("Using custom metric reader");
2095
2255
  this.metricsReader = config.customMetricReader;
2096
- _chunkWC573FCIcjs.logger.debug("Custom metric reader initialized successfully");
2256
+ _chunkC5OT6GAQcjs.logger.debug("Custom metric reader initialized successfully");
2097
2257
  return;
2098
2258
  }
2099
- _chunkWC573FCIcjs.logger.debug(
2259
+ _chunkC5OT6GAQcjs.logger.debug(
2100
2260
  "Using default metrics flow - creating OTLP exporter and PeriodicExportingMetricReader"
2101
2261
  );
2102
2262
  this.initMetricsExporter(config);
@@ -2106,16 +2266,16 @@ var MetricsModule = (_class3 = class _MetricsModule {constructor() { _class3.pro
2106
2266
  this.metricsReader = new (0, _sdkmetrics.PeriodicExportingMetricReader)({
2107
2267
  exporter: this.metricsExporter
2108
2268
  });
2109
- _chunkWC573FCIcjs.logger.debug("Default metrics reader initialized successfully");
2269
+ _chunkC5OT6GAQcjs.logger.debug("Default metrics reader initialized successfully");
2110
2270
  }
2111
2271
  /**
2112
2272
  * Initialize the metrics module with the provided configuration
2113
2273
  */
2114
2274
  setup(config) {
2115
- _chunkWC573FCIcjs.logger.info("Setting up metrics module");
2275
+ _chunkC5OT6GAQcjs.logger.info("Setting up metrics module");
2116
2276
  this.initMetricsReader(config);
2117
2277
  _MetricsModule.instance = this;
2118
- _chunkWC573FCIcjs.logger.info("Metrics module setup completed");
2278
+ _chunkC5OT6GAQcjs.logger.info("Metrics module setup completed");
2119
2279
  }
2120
2280
  /**
2121
2281
  * Get the metrics exporter
@@ -2136,19 +2296,19 @@ var MetricsModule = (_class3 = class _MetricsModule {constructor() { _class3.pro
2136
2296
  return this.metricsReader;
2137
2297
  }
2138
2298
  async forceFlush() {
2139
- await _optionalChain([this, 'access', _80 => _80.metricsReader, 'optionalAccess', _81 => _81.forceFlush, 'call', _82 => _82()]);
2299
+ await _optionalChain([this, 'access', _88 => _88.metricsReader, 'optionalAccess', _89 => _89.forceFlush, 'call', _90 => _90()]);
2140
2300
  }
2141
2301
  /**
2142
2302
  * Shutdown the metrics module
2143
2303
  */
2144
2304
  shutdown() {
2145
- _chunkWC573FCIcjs.logger.debug("Shutting down metrics module");
2305
+ _chunkC5OT6GAQcjs.logger.debug("Shutting down metrics module");
2146
2306
  this.metricsReader = null;
2147
2307
  this.metricsExporter = null;
2148
2308
  if (_MetricsModule.instance === this) {
2149
2309
  _MetricsModule.instance = null;
2150
2310
  }
2151
- _chunkWC573FCIcjs.logger.debug("Metrics module shutdown completed");
2311
+ _chunkC5OT6GAQcjs.logger.debug("Metrics module shutdown completed");
2152
2312
  }
2153
2313
  }, _class3.__initStatic2(), _class3);
2154
2314
  function getMetricsExporter() {
@@ -2158,6 +2318,165 @@ function getMetricsReader() {
2158
2318
  return MetricsModule.getInstance().getMetricsReader();
2159
2319
  }
2160
2320
 
2321
+ // src/internal/instrumentation/vercel-ai/model-call-end.ts
2322
+ var NO_USAGE = {
2323
+ inputTokens: void 0,
2324
+ inputTokenDetails: {
2325
+ noCacheTokens: void 0,
2326
+ cacheReadTokens: void 0,
2327
+ cacheWriteTokens: void 0
2328
+ },
2329
+ outputTokens: void 0,
2330
+ outputTokenDetails: { textTokens: void 0, reasoningTokens: void 0 },
2331
+ totalTokens: void 0
2332
+ };
2333
+ function endUnreportedModelCalls(collector) {
2334
+ const hooks = collector;
2335
+ if (!hasModelCallHooks(hooks)) {
2336
+ _chunkC5OT6GAQcjs.logger.debug("@ai-sdk/otel lacks the model-call hooks; failed streamed calls stay untraced");
2337
+ return collector;
2338
+ }
2339
+ const { onStepEnd, onLanguageModelCallStart, onLanguageModelCallEnd } = hooks;
2340
+ hooks.onStepEnd = (event) => {
2341
+ if (!event.durableContext) {
2342
+ onLanguageModelCallEnd.call(hooks, modelCallEndOf(event));
2343
+ }
2344
+ return onStepEnd.call(hooks, event);
2345
+ };
2346
+ hooks.onLanguageModelCallStart = (event) => {
2347
+ if (!event.durableContext) {
2348
+ onLanguageModelCallEnd.call(hooks, failedAttemptBefore(event));
2349
+ }
2350
+ return onLanguageModelCallStart.call(hooks, event);
2351
+ };
2352
+ return collector;
2353
+ }
2354
+ function hasModelCallHooks(hooks) {
2355
+ return typeof hooks.onStepEnd === "function" && typeof hooks.onLanguageModelCallStart === "function" && typeof hooks.onLanguageModelCallEnd === "function";
2356
+ }
2357
+ function modelCallEndOf(step) {
2358
+ return {
2359
+ callId: step.callId,
2360
+ provider: step.model.provider,
2361
+ modelId: step.response.modelId,
2362
+ finishReason: step.finishReason,
2363
+ usage: step.usage,
2364
+ content: step.content,
2365
+ responseId: step.response.id,
2366
+ providerMetadata: step.providerMetadata,
2367
+ request: { url: step.request.url },
2368
+ performance: { ...step.performance, timeToFirstOutputMs: void 0 },
2369
+ timestamp: step.timestamp
2370
+ };
2371
+ }
2372
+ function failedAttemptBefore(retry) {
2373
+ return {
2374
+ callId: retry.callId,
2375
+ provider: retry.provider,
2376
+ modelId: retry.modelId,
2377
+ finishReason: "error",
2378
+ usage: NO_USAGE,
2379
+ content: [],
2380
+ responseId: "",
2381
+ performance: {
2382
+ responseTimeMs: 0,
2383
+ effectiveOutputTokensPerSecond: 0,
2384
+ outputTokensPerSecond: void 0,
2385
+ inputTokensPerSecond: void 0,
2386
+ effectiveTotalTokensPerSecond: 0,
2387
+ timeToFirstOutputMs: void 0
2388
+ },
2389
+ timestamp: retry.timestamp
2390
+ };
2391
+ }
2392
+
2393
+ // src/internal/instrumentation/vercel-ai/index.ts
2394
+ var importInstalled = {
2395
+ ai: () => Promise.resolve().then(() => _interopRequireWildcard(require("ai"))).catch(() => void 0),
2396
+ otel: () => Promise.resolve().then(() => _interopRequireWildcard(require("@ai-sdk/otel"))).catch(() => void 0)
2397
+ };
2398
+ var registration = { done: false };
2399
+ function registerAISdkTelemetry({ collector, modules }, load = importInstalled) {
2400
+ if (registration.done) {
2401
+ return;
2402
+ }
2403
+ const ai = _optionalChain([modules, 'optionalAccess', _91 => _91.ai]);
2404
+ const otel = _optionalChain([modules, 'optionalAccess', _92 => _92.aiOtel]);
2405
+ if (ai && (otel || !collector || typeof ai.registerTelemetry !== "function")) {
2406
+ registerIntegrations(ai, otel, collector);
2407
+ return;
2408
+ }
2409
+ if (ai) {
2410
+ _chunkC5OT6GAQcjs.logger.debug(
2411
+ "instrumentModules has ai but not aiOtel; pass aiOtel too to trace a call made right after Brizz.initialize()"
2412
+ );
2413
+ }
2414
+ return registerInstalled(collector, load, ai, otel);
2415
+ }
2416
+ async function registerInstalled(collector, load, suppliedAi, suppliedOtel) {
2417
+ try {
2418
+ const ai = await _asyncNullishCoalesce(suppliedAi, async () => ( await load.ai()));
2419
+ const otel = collector && typeof _optionalChain([ai, 'optionalAccess', _93 => _93.registerTelemetry]) === "function" ? await _asyncNullishCoalesce(suppliedOtel, async () => ( await load.otel())) : void 0;
2420
+ registerIntegrations(ai, otel, collector);
2421
+ } catch (error) {
2422
+ _chunkC5OT6GAQcjs.logger.debug(`Vercel AI telemetry not registered: ${String(error)}`);
2423
+ }
2424
+ }
2425
+ function registerIntegrations(ai, otel, collector) {
2426
+ try {
2427
+ if (registration.done) {
2428
+ return;
2429
+ }
2430
+ if (!ai) {
2431
+ _chunkC5OT6GAQcjs.logger.debug("AI SDK not installed; install ai@>=6 to capture AI SDK telemetry");
2432
+ return;
2433
+ }
2434
+ const register = _nullishCoalesce(callable(ai.registerTelemetry), () => ( callable(ai.registerTelemetryIntegration)));
2435
+ if (!register) {
2436
+ _chunkC5OT6GAQcjs.logger.debug(
2437
+ "AI SDK present but lacks a telemetry-registration hook (needs ai@>=6); skipping"
2438
+ );
2439
+ return;
2440
+ }
2441
+ const integrations = [createInterruptIntegration()];
2442
+ if (register === ai.registerTelemetry && collector) {
2443
+ const openTelemetry = createCollector(_optionalChain([otel, 'optionalAccess', _94 => _94.OpenTelemetry]));
2444
+ if (openTelemetry) {
2445
+ integrations.push(openTelemetry);
2446
+ } else {
2447
+ _chunkC5OT6GAQcjs.logger.warn(
2448
+ "AI SDK present but @ai-sdk/otel is missing or unusable; install it (npm install @ai-sdk/otel) to capture AI SDK spans on ai@>=7"
2449
+ );
2450
+ }
2451
+ }
2452
+ register(...integrations);
2453
+ registration.done = true;
2454
+ } catch (error) {
2455
+ _chunkC5OT6GAQcjs.logger.debug(`Vercel AI telemetry not registered: ${String(error)}`);
2456
+ }
2457
+ }
2458
+ function createCollector(OpenTelemetry) {
2459
+ if (typeof OpenTelemetry !== "function") {
2460
+ return void 0;
2461
+ }
2462
+ try {
2463
+ return endUnreportedModelCalls(
2464
+ new OpenTelemetry({
2465
+ tracer: _chunkDC2MFO65cjs.brizzTracerProvider.getTracer(_chunkIWSFMCHHcjs.AI_SDK_OTEL_SCOPE),
2466
+ // Records the model's tool-choice decisions (`ai.decision.*`).
2467
+ experimental_decision: true,
2468
+ // Carries the price the Vercel AI Gateway billed.
2469
+ providerMetadata: true
2470
+ })
2471
+ );
2472
+ } catch (e7) {
2473
+ return void 0;
2474
+ }
2475
+ }
2476
+ function callable(hook) {
2477
+ return typeof hook === "function" ? hook : void 0;
2478
+ }
2479
+
2161
2480
  // src/internal/trace/tracing.ts
2162
2481
  var _exportertraceotlpproto = require('@opentelemetry/exporter-trace-otlp-proto');
2163
2482
 
@@ -2179,7 +2498,7 @@ var BrizzSpanExporter = (_class4 = class {
2179
2498
  const resourceAttrs = {
2180
2499
  ...config.resourceAttributes,
2181
2500
  "service.name": config.appName,
2182
- [BRIZZ_SDK_VERSION]: _chunkCNVK5RA3cjs.getSDKVersion.call(void 0, ),
2501
+ [BRIZZ_SDK_VERSION]: _chunkSTMZ73NMcjs.getSDKVersion.call(void 0, ),
2183
2502
  [BRIZZ_SDK_LANGUAGE]: SDK_LANGUAGE
2184
2503
  };
2185
2504
  if (config.environment) {
@@ -2193,7 +2512,7 @@ var BrizzSpanExporter = (_class4 = class {
2193
2512
  }
2194
2513
  /** The service a span reports under: its scoped override, else the configured appName. */
2195
2514
  _serviceNameOf(span) {
2196
- const value = span.attributes[_chunkNF52RMLWcjs.SERVICE_NAME_ATTRIBUTE];
2515
+ const value = span.attributes[_chunkIWSFMCHHcjs.SERVICE_NAME_ATTRIBUTE];
2197
2516
  return typeof value === "string" && value !== "" ? value : this._defaultServiceName;
2198
2517
  }
2199
2518
  _resourceFor(serviceName) {
@@ -2249,7 +2568,7 @@ var BrizzSpanExporter = (_class4 = class {
2249
2568
  try {
2250
2569
  return Promise.resolve(filter(span));
2251
2570
  } catch (error) {
2252
- _chunkWC573FCIcjs.logger.warn("beforeSendSpan threw; span will be kept", { error });
2571
+ _chunkC5OT6GAQcjs.logger.warn("beforeSendSpan threw; span will be kept", { error });
2253
2572
  return Promise.resolve(true);
2254
2573
  }
2255
2574
  });
@@ -2269,7 +2588,7 @@ var BrizzSpanExporter = (_class4 = class {
2269
2588
  this._exportGroups(filtered, resultCallback);
2270
2589
  return;
2271
2590
  }).catch((error) => {
2272
- _chunkWC573FCIcjs.logger.warn("beforeSendSpan rejected; all spans will be kept", { error });
2591
+ _chunkC5OT6GAQcjs.logger.warn("beforeSendSpan rejected; all spans will be kept", { error });
2273
2592
  this._exportGroups(groups, resultCallback);
2274
2593
  });
2275
2594
  }
@@ -2306,8 +2625,8 @@ var BrizzSpanExporter = (_class4 = class {
2306
2625
  }
2307
2626
  async forceFlush() {
2308
2627
  await Promise.all([
2309
- _optionalChain([this, 'access', _83 => _83._delegate, 'access', _84 => _84.forceFlush, 'optionalCall', _85 => _85()]),
2310
- ...[...this._delegates.values()].map(async (delegate) => _optionalChain([delegate, 'access', _86 => _86.forceFlush, 'optionalCall', _87 => _87()]))
2628
+ _optionalChain([this, 'access', _95 => _95._delegate, 'access', _96 => _96.forceFlush, 'optionalCall', _97 => _97()]),
2629
+ ...[...this._delegates.values()].map(async (delegate) => _optionalChain([delegate, 'access', _98 => _98.forceFlush, 'optionalCall', _99 => _99()]))
2311
2630
  ]);
2312
2631
  }
2313
2632
  }, _class4);
@@ -2319,10 +2638,10 @@ var BrizzSpanExporter = (_class4 = class {
2319
2638
 
2320
2639
 
2321
2640
  function applyContextAttributes(span) {
2322
- const sessionProperties = _api.context.active().getValue(_chunkNF52RMLWcjs.PROPERTIES_CONTEXT_KEY);
2641
+ const sessionProperties = _api.context.active().getValue(_chunkIWSFMCHHcjs.PROPERTIES_CONTEXT_KEY);
2323
2642
  if (sessionProperties) {
2324
2643
  for (const [key, value] of Object.entries(sessionProperties)) {
2325
- span.setAttribute(`${_chunkNF52RMLWcjs.BRIZZ}.${key}`, value);
2644
+ span.setAttribute(`${_chunkIWSFMCHHcjs.BRIZZ}.${key}`, value);
2326
2645
  }
2327
2646
  }
2328
2647
  }
@@ -2365,7 +2684,7 @@ var BrizzSimpleSpanProcessor = class extends _sdktrace.SimpleSpanProcessor {
2365
2684
  }
2366
2685
  onEnd(span) {
2367
2686
  restampLangChainSpan(span);
2368
- const maskingConfig = _optionalChain([this, 'access', _88 => _88.config, 'access', _89 => _89.masking, 'optionalAccess', _90 => _90.spanMasking]);
2687
+ const maskingConfig = _optionalChain([this, 'access', _100 => _100.config, 'access', _101 => _101.masking, 'optionalAccess', _102 => _102.spanMasking]);
2369
2688
  if (maskingConfig) {
2370
2689
  maskReadableSpan(span, maskingConfig);
2371
2690
  }
@@ -2384,7 +2703,7 @@ var BrizzBatchSpanProcessor = class extends _sdktrace.BatchSpanProcessor {
2384
2703
  }
2385
2704
  onEnd(span) {
2386
2705
  restampLangChainSpan(span);
2387
- const maskingConfig = _optionalChain([this, 'access', _91 => _91.config, 'access', _92 => _92.masking, 'optionalAccess', _93 => _93.spanMasking]);
2706
+ const maskingConfig = _optionalChain([this, 'access', _103 => _103.config, 'access', _104 => _104.masking, 'optionalAccess', _105 => _105.spanMasking]);
2388
2707
  if (maskingConfig) {
2389
2708
  maskReadableSpan(span, maskingConfig);
2390
2709
  }
@@ -2401,7 +2720,7 @@ function maskReadableSpan(span, config) {
2401
2720
  for (const [k, v] of Object.entries(attrs)) {
2402
2721
  masked[k] = v;
2403
2722
  }
2404
- if (_optionalChain([config, 'access', _94 => _94.rules, 'optionalAccess', _95 => _95.length])) {
2723
+ if (_optionalChain([config, 'access', _106 => _106.rules, 'optionalAccess', _107 => _107.length])) {
2405
2724
  masked = maskAttributes(masked, config.rules);
2406
2725
  }
2407
2726
  if (!config.disableDefaultRules) {
@@ -2415,7 +2734,7 @@ function maskReadableSpan(span, config) {
2415
2734
  }
2416
2735
  }
2417
2736
  } catch (error) {
2418
- _chunkWC573FCIcjs.logger.error("Error masking span", { err: error });
2737
+ _chunkC5OT6GAQcjs.logger.error("Error masking span", { err: error });
2419
2738
  }
2420
2739
  }
2421
2740
 
@@ -2435,17 +2754,17 @@ var TracingModule = (_class5 = class _TracingModule {constructor() { _class5.pro
2435
2754
  */
2436
2755
  initSpanExporter(config) {
2437
2756
  if (this.spanExporter) {
2438
- _chunkWC573FCIcjs.logger.debug("Span exporter already initialized, skipping re-initialization");
2757
+ _chunkC5OT6GAQcjs.logger.debug("Span exporter already initialized, skipping re-initialization");
2439
2758
  return;
2440
2759
  }
2441
2760
  if (config.customSpanExporter) {
2442
- _chunkWC573FCIcjs.logger.debug("Using custom span exporter");
2761
+ _chunkC5OT6GAQcjs.logger.debug("Using custom span exporter");
2443
2762
  this.spanExporter = new BrizzSpanExporter(config.customSpanExporter, config);
2444
- _chunkWC573FCIcjs.logger.debug("Custom span exporter initialized successfully");
2763
+ _chunkC5OT6GAQcjs.logger.debug("Custom span exporter initialized successfully");
2445
2764
  return;
2446
2765
  }
2447
2766
  const tracesUrl = config.baseUrl.replace(/\/$/, "") + "/v1/traces";
2448
- _chunkWC573FCIcjs.logger.debug("Initializing default OTLP span exporter", { url: tracesUrl });
2767
+ _chunkC5OT6GAQcjs.logger.debug("Initializing default OTLP span exporter", { url: tracesUrl });
2449
2768
  const otlpExporter = new (0, _exportertraceotlpproto.OTLPTraceExporter)({
2450
2769
  url: tracesUrl,
2451
2770
  headers: config.headers
@@ -2458,34 +2777,34 @@ var TracingModule = (_class5 = class _TracingModule {constructor() { _class5.pro
2458
2777
  headers: { ...config.headers, [_chunkUNLNNKZ7cjs.SERVICE_NAME_HEADER]: serviceName }
2459
2778
  })
2460
2779
  );
2461
- _chunkWC573FCIcjs.logger.debug("OTLP span exporter initialized successfully");
2780
+ _chunkC5OT6GAQcjs.logger.debug("OTLP span exporter initialized successfully");
2462
2781
  }
2463
2782
  /**
2464
2783
  * Initialize the span processor with masking support
2465
2784
  */
2466
2785
  initSpanProcessor(config) {
2467
2786
  if (this.spanProcessor) {
2468
- _chunkWC573FCIcjs.logger.debug("Span processor already initialized, skipping re-initialization");
2787
+ _chunkC5OT6GAQcjs.logger.debug("Span processor already initialized, skipping re-initialization");
2469
2788
  return;
2470
2789
  }
2471
2790
  if (!this.spanExporter) {
2472
2791
  throw new Error("Span exporter must be initialized before processor");
2473
2792
  }
2474
- _chunkWC573FCIcjs.logger.debug("Initializing span processor", {
2793
+ _chunkC5OT6GAQcjs.logger.debug("Initializing span processor", {
2475
2794
  disableBatch: config.disableBatch,
2476
- hasMasking: !!_optionalChain([config, 'access', _96 => _96.masking, 'optionalAccess', _97 => _97.spanMasking])
2795
+ hasMasking: !!_optionalChain([config, 'access', _108 => _108.masking, 'optionalAccess', _109 => _109.spanMasking])
2477
2796
  });
2478
2797
  const spanProcessor = config.disableBatch ? new BrizzSimpleSpanProcessor(this.spanExporter, config) : new BrizzBatchSpanProcessor(this.spanExporter, config);
2479
- _chunkWC573FCIcjs.logger.debug("Span processor initialized successfully");
2798
+ _chunkC5OT6GAQcjs.logger.debug("Span processor initialized successfully");
2480
2799
  this.spanProcessor = spanProcessor;
2481
2800
  }
2482
2801
  /**
2483
2802
  * Initialize the tracing module with the provided configuration
2484
2803
  */
2485
2804
  setup(config) {
2486
- _chunkWC573FCIcjs.logger.info("Setting up tracing module");
2805
+ _chunkC5OT6GAQcjs.logger.info("Setting up tracing module");
2487
2806
  if (config.disableSpanExporter) {
2488
- _chunkWC573FCIcjs.logger.info(
2807
+ _chunkC5OT6GAQcjs.logger.info(
2489
2808
  "Span exporter disabled via disableSpanExporter; skipping exporter and processor setup"
2490
2809
  );
2491
2810
  this.spanExporter = null;
@@ -2496,7 +2815,7 @@ var TracingModule = (_class5 = class _TracingModule {constructor() { _class5.pro
2496
2815
  this.initSpanExporter(config);
2497
2816
  this.initSpanProcessor(config);
2498
2817
  _TracingModule.instance = this;
2499
- _chunkWC573FCIcjs.logger.info("Tracing module setup completed");
2818
+ _chunkC5OT6GAQcjs.logger.info("Tracing module setup completed");
2500
2819
  }
2501
2820
  /**
2502
2821
  * Get the span exporter
@@ -2517,10 +2836,10 @@ var TracingModule = (_class5 = class _TracingModule {constructor() { _class5.pro
2517
2836
  return this.spanProcessor;
2518
2837
  }
2519
2838
  async forceFlush() {
2520
- await _optionalChain([this, 'access', _98 => _98.spanProcessor, 'optionalAccess', _99 => _99.forceFlush, 'call', _100 => _100()]);
2839
+ await _optionalChain([this, 'access', _110 => _110.spanProcessor, 'optionalAccess', _111 => _111.forceFlush, 'call', _112 => _112()]);
2521
2840
  }
2522
2841
  async shutdown() {
2523
- _chunkWC573FCIcjs.logger.debug("Shutting down tracing module");
2842
+ _chunkC5OT6GAQcjs.logger.debug("Shutting down tracing module");
2524
2843
  if (this.spanProcessor) {
2525
2844
  await this.spanProcessor.shutdown();
2526
2845
  this.spanProcessor = null;
@@ -2530,7 +2849,7 @@ var TracingModule = (_class5 = class _TracingModule {constructor() { _class5.pro
2530
2849
  this.spanExporter = null;
2531
2850
  }
2532
2851
  _TracingModule.instance = null;
2533
- _chunkWC573FCIcjs.logger.debug("Tracing module shutdown completed");
2852
+ _chunkC5OT6GAQcjs.logger.debug("Tracing module shutdown completed");
2534
2853
  }
2535
2854
  }, _class5.__initStatic3(), _class5);
2536
2855
  function getSpanExporter() {
@@ -2543,7 +2862,7 @@ function getSpanProcessor() {
2543
2862
  // src/internal/trace/decision-call.ts
2544
2863
 
2545
2864
 
2546
- var tracer = _chunkDC2MFO65cjs.brizzTracerProvider.getTracer("@brizz/sdk/decision-call", _chunkCNVK5RA3cjs.getSDKVersion.call(void 0, ));
2865
+ var tracer = _chunkDC2MFO65cjs.brizzTracerProvider.getTracer("@brizz/sdk/decision-call", _chunkSTMZ73NMcjs.getSDKVersion.call(void 0, ));
2547
2866
  function decisionCall(options, callback) {
2548
2867
  const span = startDecisionSpan(options);
2549
2868
  if (!span) {
@@ -2580,18 +2899,18 @@ function recordDecisionCall(record) {
2580
2899
  }
2581
2900
  span.end(record.endTime);
2582
2901
  } catch (error) {
2583
- _chunkWC573FCIcjs.logger.debug(`Brizz decision call: could not record the call: ${String(error)}`);
2902
+ _chunkC5OT6GAQcjs.logger.debug(`Brizz decision call: could not record the call: ${String(error)}`);
2584
2903
  }
2585
2904
  }
2586
2905
  function startDecisionSpan(options, startTime) {
2587
2906
  try {
2588
2907
  const requestModel = options.requestModel || options.model;
2589
2908
  const attributes = {
2590
- [_chunkNF52RMLWcjs.GEN_AI_OPERATION_NAME]: _chunkNF52RMLWcjs.GEN_AI_OPERATION_CLASSIFY,
2591
- [_chunkNF52RMLWcjs.GEN_AI_PROVIDER_NAME]: options.provider,
2592
- [_chunkNF52RMLWcjs.GEN_AI_REQUEST_MODEL]: requestModel,
2593
- [_chunkNF52RMLWcjs.GEN_AI_RESPONSE_MODEL]: options.model,
2594
- [_chunkNF52RMLWcjs.GEN_AI_OUTPUT_TYPE]: "json"
2909
+ [_chunkIWSFMCHHcjs.GEN_AI_OPERATION_NAME]: _chunkIWSFMCHHcjs.GEN_AI_OPERATION_CLASSIFY,
2910
+ [_chunkIWSFMCHHcjs.GEN_AI_PROVIDER_NAME]: options.provider,
2911
+ [_chunkIWSFMCHHcjs.GEN_AI_REQUEST_MODEL]: requestModel,
2912
+ [_chunkIWSFMCHHcjs.GEN_AI_RESPONSE_MODEL]: options.model,
2913
+ [_chunkIWSFMCHHcjs.GEN_AI_OUTPUT_TYPE]: "json"
2595
2914
  };
2596
2915
  const inputMessages = toJson([
2597
2916
  {
@@ -2603,25 +2922,25 @@ function startDecisionSpan(options, startTime) {
2603
2922
  }
2604
2923
  ]);
2605
2924
  if (inputMessages !== void 0) {
2606
- attributes[_chunkNF52RMLWcjs.GEN_AI_INPUT_MESSAGES] = inputMessages;
2925
+ attributes[_chunkIWSFMCHHcjs.GEN_AI_INPUT_MESSAGES] = inputMessages;
2607
2926
  }
2608
2927
  const sessionId = currentSessionId();
2609
2928
  if (sessionId) {
2610
- attributes[_chunkNF52RMLWcjs.GEN_AI_CONVERSATION_ID] = sessionId;
2929
+ attributes[_chunkIWSFMCHHcjs.GEN_AI_CONVERSATION_ID] = sessionId;
2611
2930
  }
2612
- return tracer.startSpan(`${_chunkNF52RMLWcjs.GEN_AI_OPERATION_CLASSIFY} ${requestModel}`, {
2931
+ return tracer.startSpan(`${_chunkIWSFMCHHcjs.GEN_AI_OPERATION_CLASSIFY} ${requestModel}`, {
2613
2932
  kind: _api.SpanKind.CLIENT,
2614
2933
  attributes,
2615
2934
  startTime
2616
2935
  });
2617
2936
  } catch (error) {
2618
- _chunkWC573FCIcjs.logger.debug(`Brizz decision call: could not start span: ${String(error)}`);
2937
+ _chunkC5OT6GAQcjs.logger.debug(`Brizz decision call: could not start span: ${String(error)}`);
2619
2938
  return void 0;
2620
2939
  }
2621
2940
  }
2622
2941
  function currentSessionId() {
2623
- const properties = _api.context.active().getValue(_chunkNF52RMLWcjs.PROPERTIES_CONTEXT_KEY);
2624
- return _optionalChain([properties, 'optionalAccess', _101 => _101[_chunkNF52RMLWcjs.SESSION_ID]]);
2942
+ const properties = _api.context.active().getValue(_chunkIWSFMCHHcjs.PROPERTIES_CONTEXT_KEY);
2943
+ return _optionalChain([properties, 'optionalAccess', _113 => _113[_chunkIWSFMCHHcjs.SESSION_ID]]);
2625
2944
  }
2626
2945
  function describeResultOn(span, provider) {
2627
2946
  const set = (key, value) => {
@@ -2631,13 +2950,13 @@ function describeResultOn(span, provider) {
2631
2950
  try {
2632
2951
  span.setAttribute(key, value);
2633
2952
  } catch (error) {
2634
- _chunkWC573FCIcjs.logger.debug(`Brizz decision call: could not set ${key}: ${String(error)}`);
2953
+ _chunkC5OT6GAQcjs.logger.debug(`Brizz decision call: could not set ${key}: ${String(error)}`);
2635
2954
  }
2636
2955
  };
2637
2956
  return {
2638
2957
  setAnswers(answers) {
2639
2958
  set(
2640
- _chunkNF52RMLWcjs.GEN_AI_OUTPUT_MESSAGES,
2959
+ _chunkIWSFMCHHcjs.GEN_AI_OUTPUT_MESSAGES,
2641
2960
  toJson([
2642
2961
  {
2643
2962
  role: "assistant",
@@ -2648,16 +2967,16 @@ function describeResultOn(span, provider) {
2648
2967
  );
2649
2968
  },
2650
2969
  setUsage(usage) {
2651
- set(_chunkNF52RMLWcjs.GEN_AI_USAGE_INPUT_TOKENS, finiteNumber(_optionalChain([usage, 'optionalAccess', _102 => _102.inputTokens])));
2652
- set(_chunkNF52RMLWcjs.GEN_AI_USAGE_OUTPUT_TOKENS, finiteNumber(_optionalChain([usage, 'optionalAccess', _103 => _103.outputTokens])));
2970
+ set(_chunkIWSFMCHHcjs.GEN_AI_USAGE_INPUT_TOKENS, finiteNumber(_optionalChain([usage, 'optionalAccess', _114 => _114.inputTokens])));
2971
+ set(_chunkIWSFMCHHcjs.GEN_AI_USAGE_OUTPUT_TOKENS, finiteNumber(_optionalChain([usage, 'optionalAccess', _115 => _115.outputTokens])));
2653
2972
  },
2654
2973
  setCost(costUsd) {
2655
- set(_chunkNF52RMLWcjs.GEN_AI_USAGE_COST_USD, finiteNumber(costUsd));
2974
+ set(_chunkIWSFMCHHcjs.GEN_AI_USAGE_COST_USD, finiteNumber(costUsd));
2656
2975
  }
2657
2976
  };
2658
2977
  }
2659
2978
  function endWhenSettled(span, result) {
2660
- if (typeof _optionalChain([result, 'optionalAccess', _104 => _104.then]) !== "function") {
2979
+ if (typeof _optionalChain([result, 'optionalAccess', _116 => _116.then]) !== "function") {
2661
2980
  span.end();
2662
2981
  return result;
2663
2982
  }
@@ -2679,9 +2998,9 @@ function endWithError(span, error) {
2679
2998
  code: _api.SpanStatusCode.ERROR,
2680
2999
  message: error instanceof Error ? error.message : String(error)
2681
3000
  });
2682
- span.setAttribute(_chunkNF52RMLWcjs.ERROR_TYPE, errorType(error));
3001
+ span.setAttribute(_chunkIWSFMCHHcjs.ERROR_TYPE, errorType(error));
2683
3002
  } catch (describeError) {
2684
- _chunkWC573FCIcjs.logger.debug(`Brizz decision call: could not record the error: ${String(describeError)}`);
3003
+ _chunkC5OT6GAQcjs.logger.debug(`Brizz decision call: could not record the error: ${String(describeError)}`);
2685
3004
  }
2686
3005
  span.end();
2687
3006
  }
@@ -2723,7 +3042,7 @@ var _Brizz = (_class6 = class __Brizz {constructor() { _class6.prototype.__init1
2723
3042
  */
2724
3043
  setupInstrumentation(options) {
2725
3044
  const registry = InstrumentationRegistry.getInstance();
2726
- _chunkCNVK5RA3cjs.configure.call(void 0, resolveMcpSessionTracking(options.mcpSessionTracking));
3045
+ _chunkSTMZ73NMcjs.configure.call(void 0, resolveMcpSessionTracking(options.mcpSessionTracking));
2727
3046
  patchInstalledCallbackManager();
2728
3047
  patchInstalledLangGraph();
2729
3048
  patchInstalledTypeSafe();
@@ -2742,7 +3061,7 @@ var _Brizz = (_class6 = class __Brizz {constructor() { _class6.prototype.__init1
2742
3061
  if (options.disableNodeSdk) {
2743
3062
  _chunkDC2MFO65cjs.setPrivateTracerProvider.call(void 0, null);
2744
3063
  if (!resolvedConfig.setGlobalTracerProvider) {
2745
- _chunkWC573FCIcjs.logger.warn(
3064
+ _chunkC5OT6GAQcjs.logger.warn(
2746
3065
  "Brizz: setGlobalTracerProvider: false has no effect with disableNodeSdk: true. Brizz creates no TracerProvider, so spans follow the provider you register with getSpanProcessor()."
2747
3066
  );
2748
3067
  }
@@ -2752,13 +3071,13 @@ var _Brizz = (_class6 = class __Brizz {constructor() { _class6.prototype.__init1
2752
3071
  tracerProvider: _chunkDC2MFO65cjs.brizzTracerProvider
2753
3072
  });
2754
3073
  }
2755
- _chunkWC573FCIcjs.logger.info("NodeSDK disabled - only telemetry modules initialized");
3074
+ _chunkC5OT6GAQcjs.logger.info("NodeSDK disabled - only telemetry modules initialized");
2756
3075
  return;
2757
3076
  }
2758
3077
  const resourceAttributes = {
2759
3078
  ...resolvedConfig.resourceAttributes,
2760
3079
  "service.name": resolvedConfig.appName,
2761
- [BRIZZ_SDK_VERSION]: _chunkCNVK5RA3cjs.getSDKVersion.call(void 0, ),
3080
+ [BRIZZ_SDK_VERSION]: _chunkSTMZ73NMcjs.getSDKVersion.call(void 0, ),
2762
3081
  [BRIZZ_SDK_LANGUAGE]: SDK_LANGUAGE
2763
3082
  };
2764
3083
  if (resolvedConfig.environment) {
@@ -2768,7 +3087,7 @@ var _Brizz = (_class6 = class __Brizz {constructor() { _class6.prototype.__init1
2768
3087
  resourceAttributes["service.version"] = resolvedConfig.appVersion;
2769
3088
  }
2770
3089
  const resource = _resources2.defaultResource.call(void 0, ).merge(_resources2.detectResources.call(void 0, { detectors: [_resources2.envDetector, _resources2.hostDetector, _resources2.processDetector] })).merge(_resources2.resourceFromAttributes.call(void 0, resourceAttributes));
2771
- const spanProcessors = resolvedConfig.disableSpanExporter ? [] : [new (0, _chunk6QXPHZEOcjs.InterruptPropagator)(), getSpanProcessor()];
3090
+ const spanProcessors = resolvedConfig.disableSpanExporter ? [] : [new InterruptPropagator(), getSpanProcessor()];
2772
3091
  if (resolvedConfig.setGlobalTracerProvider) {
2773
3092
  this._tracerProvider = new (0, _sdktrace.TracerProvider)({ resource, spanProcessors });
2774
3093
  this.registerGlobalTracerProvider(this._tracerProvider);
@@ -2779,12 +3098,12 @@ var _Brizz = (_class6 = class __Brizz {constructor() { _class6.prototype.__init1
2779
3098
  sampler: new (0, _sdktrace.AlwaysOnSampler)()
2780
3099
  });
2781
3100
  if (_chunkDC2MFO65cjs.ensureContextManager.call(void 0, ) === "failed") {
2782
- _chunkWC573FCIcjs.logger.warn(
3101
+ _chunkC5OT6GAQcjs.logger.warn(
2783
3102
  "Brizz: no OpenTelemetry context manager is active and Brizz could not install one; span parenting and session/user propagation will not work."
2784
3103
  );
2785
3104
  }
2786
3105
  _chunkDC2MFO65cjs.setPrivateTracerProvider.call(void 0, this._tracerProvider);
2787
- _chunkWC573FCIcjs.logger.info(
3106
+ _chunkC5OT6GAQcjs.logger.info(
2788
3107
  "Brizz: using a private TracerProvider; Brizz spans are exported to Brizz only and the global TracerProvider is left untouched."
2789
3108
  );
2790
3109
  }
@@ -2796,11 +3115,11 @@ var _Brizz = (_class6 = class __Brizz {constructor() { _class6.prototype.__init1
2796
3115
  instrumentations: manualInstrumentations,
2797
3116
  tracerProvider: _chunkDC2MFO65cjs.brizzTracerProvider
2798
3117
  });
2799
- _chunkWC573FCIcjs.logger.info(
3118
+ _chunkC5OT6GAQcjs.logger.info(
2800
3119
  `Telemetry providers started with ${manualInstrumentations.length} manual instrumentations`
2801
3120
  );
2802
3121
  } else {
2803
- _chunkWC573FCIcjs.logger.info(
3122
+ _chunkC5OT6GAQcjs.logger.info(
2804
3123
  "Telemetry providers started - using auto-instrumentations loaded at import time"
2805
3124
  );
2806
3125
  }
@@ -2819,10 +3138,10 @@ var _Brizz = (_class6 = class __Brizz {constructor() { _class6.prototype.__init1
2819
3138
  return;
2820
3139
  }
2821
3140
  if (Reflect.get(registered, BRIZZ_OWNED) === true) {
2822
- _chunkWC573FCIcjs.logger.debug("A TracerProvider from an earlier Brizz.initialize() is still registered");
3141
+ _chunkC5OT6GAQcjs.logger.debug("A TracerProvider from an earlier Brizz.initialize() is still registered");
2823
3142
  return;
2824
3143
  }
2825
- _chunkWC573FCIcjs.logger.warn(
3144
+ _chunkC5OT6GAQcjs.logger.warn(
2826
3145
  "Brizz: another OpenTelemetry TracerProvider is already registered globally, so Brizz could not register its own. Spans from Brizz instrumentations will go to that provider, not to Brizz. Pass setGlobalTracerProvider: false to Brizz.initialize() (or set BRIZZ_SET_GLOBAL_TRACER_PROVIDER=false) to send them to Brizz on a separate provider."
2827
3146
  );
2828
3147
  }
@@ -2836,17 +3155,17 @@ var _Brizz = (_class6 = class __Brizz {constructor() { _class6.prototype.__init1
2836
3155
  * @private
2837
3156
  */
2838
3157
  initializeModules(config) {
2839
- _chunkWC573FCIcjs.logger.info("Initializing telemetry modules");
2840
- _chunkWC573FCIcjs.logger.debug("Initializing tracing module");
3158
+ _chunkC5OT6GAQcjs.logger.info("Initializing telemetry modules");
3159
+ _chunkC5OT6GAQcjs.logger.debug("Initializing tracing module");
2841
3160
  const tracingModule = new TracingModule();
2842
3161
  tracingModule.setup(config);
2843
- _chunkWC573FCIcjs.logger.debug("Initializing metrics module");
3162
+ _chunkC5OT6GAQcjs.logger.debug("Initializing metrics module");
2844
3163
  const metricsModule = new MetricsModule();
2845
3164
  metricsModule.setup(config);
2846
- _chunkWC573FCIcjs.logger.debug("Initializing logging module");
3165
+ _chunkC5OT6GAQcjs.logger.debug("Initializing logging module");
2847
3166
  const loggingModule = new LoggingModule();
2848
3167
  loggingModule.setup(config);
2849
- _chunkWC573FCIcjs.logger.info("All telemetry modules initialized successfully");
3168
+ _chunkC5OT6GAQcjs.logger.info("All telemetry modules initialized successfully");
2850
3169
  }
2851
3170
  /**
2852
3171
  * Detect the current module system (ESM or CJS) using reliable indicators
@@ -2855,7 +3174,7 @@ var _Brizz = (_class6 = class __Brizz {constructor() { _class6.prototype.__init1
2855
3174
  * @private
2856
3175
  */
2857
3176
  detectModuleSystem() {
2858
- const inCJS = typeof module !== "undefined" && typeof exports !== "undefined" && typeof _chunkOBGZSXTJcjs.__require === "function" && typeof __filename === "string" && typeof __dirname === "string" && this === (typeof exports !== "undefined" ? exports : void 0);
3177
+ const inCJS = typeof module !== "undefined" && typeof exports !== "undefined" && typeof _chunkC5OT6GAQcjs.__require === "function" && typeof __filename === "string" && typeof __dirname === "string" && this === (typeof exports !== "undefined" ? exports : void 0);
2859
3178
  return inCJS ? "CJS" : "ESM";
2860
3179
  }
2861
3180
  /**
@@ -2863,29 +3182,29 @@ var _Brizz = (_class6 = class __Brizz {constructor() { _class6.prototype.__init1
2863
3182
  * @private
2864
3183
  */
2865
3184
  async shutdownModules() {
2866
- _chunkWC573FCIcjs.logger.info("Shutting down telemetry modules");
3185
+ _chunkC5OT6GAQcjs.logger.info("Shutting down telemetry modules");
2867
3186
  try {
2868
3187
  try {
2869
3188
  const tracingModule = TracingModule.getInstance();
2870
3189
  await tracingModule.shutdown();
2871
- } catch (e5) {
2872
- _chunkWC573FCIcjs.logger.debug("Tracing module already shut down or not initialized");
3190
+ } catch (e8) {
3191
+ _chunkC5OT6GAQcjs.logger.debug("Tracing module already shut down or not initialized");
2873
3192
  }
2874
3193
  try {
2875
3194
  const metricsModule = MetricsModule.getInstance();
2876
3195
  metricsModule.shutdown();
2877
- } catch (e6) {
2878
- _chunkWC573FCIcjs.logger.debug("Metrics module already shut down or not initialized");
3196
+ } catch (e9) {
3197
+ _chunkC5OT6GAQcjs.logger.debug("Metrics module already shut down or not initialized");
2879
3198
  }
2880
3199
  try {
2881
3200
  const loggingModule = LoggingModule.getInstance();
2882
3201
  await loggingModule.shutdown();
2883
- } catch (e7) {
2884
- _chunkWC573FCIcjs.logger.debug("Logging module already shut down or not initialized");
3202
+ } catch (e10) {
3203
+ _chunkC5OT6GAQcjs.logger.debug("Logging module already shut down or not initialized");
2885
3204
  }
2886
- _chunkWC573FCIcjs.logger.info("All telemetry modules shut down successfully");
3205
+ _chunkC5OT6GAQcjs.logger.info("All telemetry modules shut down successfully");
2887
3206
  } catch (error) {
2888
- _chunkWC573FCIcjs.logger.error("Error shutting down modules", { error });
3207
+ _chunkC5OT6GAQcjs.logger.error("Error shutting down modules", { error });
2889
3208
  throw error;
2890
3209
  }
2891
3210
  }
@@ -2906,21 +3225,25 @@ var _Brizz = (_class6 = class __Brizz {constructor() { _class6.prototype.__init1
2906
3225
  */
2907
3226
  initialize(options) {
2908
3227
  if (this._initialized) {
2909
- _chunkWC573FCIcjs.logger.warn("Brizz SDK already initialized");
3228
+ _chunkC5OT6GAQcjs.logger.warn("Brizz SDK already initialized");
2910
3229
  return;
2911
3230
  }
2912
- _chunkWC573FCIcjs.logger.info("Starting Brizz SDK initialization");
3231
+ _chunkC5OT6GAQcjs.logger.info("Starting Brizz SDK initialization");
2913
3232
  try {
2914
3233
  const resolvedConfig = resolveConfig(options);
2915
3234
  this.initializeModules(resolvedConfig);
2916
3235
  this.setupInstrumentation(options);
2917
3236
  this.createAndStartProviders(options, resolvedConfig);
3237
+ void registerAISdkTelemetry({
3238
+ collector: !options.disableAiSdkCollector,
3239
+ modules: options.instrumentModules
3240
+ });
2918
3241
  this._initialized = true;
2919
- _chunkWC573FCIcjs.logger.info("Brizz SDK initialization completed successfully", {
3242
+ _chunkC5OT6GAQcjs.logger.info("Brizz SDK initialization completed successfully", {
2920
3243
  moduleSystem: this.detectModuleSystem()
2921
3244
  });
2922
3245
  } catch (error) {
2923
- _chunkWC573FCIcjs.logger.error("Failed to initialize Brizz SDK", { error });
3246
+ _chunkC5OT6GAQcjs.logger.error("Failed to initialize Brizz SDK", { error });
2924
3247
  throw new Error(`Failed to initialize SDK: ${String(error)}`, { cause: error });
2925
3248
  }
2926
3249
  }
@@ -2943,7 +3266,7 @@ var _Brizz = (_class6 = class __Brizz {constructor() { _class6.prototype.__init1
2943
3266
  */
2944
3267
  async flush(timeoutMillis = 5e3) {
2945
3268
  if (!this._initialized) {
2946
- _chunkWC573FCIcjs.logger.debug("Brizz.flush called before Brizz.initialize; nothing to flush");
3269
+ _chunkC5OT6GAQcjs.logger.debug("Brizz.flush called before Brizz.initialize; nothing to flush");
2947
3270
  return false;
2948
3271
  }
2949
3272
  const settle = async (name, flush) => {
@@ -2951,7 +3274,7 @@ var _Brizz = (_class6 = class __Brizz {constructor() { _class6.prototype.__init1
2951
3274
  await flush();
2952
3275
  return true;
2953
3276
  } catch (error) {
2954
- _chunkWC573FCIcjs.logger.debug(`Brizz.flush: flushing ${name} failed: ${String(error)}`);
3277
+ _chunkC5OT6GAQcjs.logger.debug(`Brizz.flush: flushing ${name} failed: ${String(error)}`);
2955
3278
  return false;
2956
3279
  }
2957
3280
  };
@@ -2970,7 +3293,7 @@ var _Brizz = (_class6 = class __Brizz {constructor() { _class6.prototype.__init1
2970
3293
  try {
2971
3294
  const result = await Promise.race([work, timedOut]);
2972
3295
  if (result === "timeout") {
2973
- _chunkWC573FCIcjs.logger.warn(
3296
+ _chunkC5OT6GAQcjs.logger.warn(
2974
3297
  `Brizz.flush did not finish within ${timeoutMillis}ms; telemetry still queued will be sent with the next batch.`
2975
3298
  );
2976
3299
  return false;
@@ -2997,25 +3320,25 @@ var _Brizz = (_class6 = class __Brizz {constructor() { _class6.prototype.__init1
2997
3320
  */
2998
3321
  async shutdown() {
2999
3322
  if (!this._initialized) {
3000
- _chunkWC573FCIcjs.logger.warn("Brizz SDK not initialized");
3323
+ _chunkC5OT6GAQcjs.logger.warn("Brizz SDK not initialized");
3001
3324
  return;
3002
3325
  }
3003
3326
  try {
3004
3327
  await this.shutdownModules();
3005
- await _optionalChain([this, 'access', _105 => _105._tracerProvider, 'optionalAccess', _106 => _106.forceFlush, 'call', _107 => _107()]);
3006
- await _optionalChain([this, 'access', _108 => _108._tracerProvider, 'optionalAccess', _109 => _109.shutdown, 'call', _110 => _110()]);
3007
- await _optionalChain([this, 'access', _111 => _111._meterProvider, 'optionalAccess', _112 => _112.forceFlush, 'call', _113 => _113()]);
3008
- await _optionalChain([this, 'access', _114 => _114._meterProvider, 'optionalAccess', _115 => _115.shutdown, 'call', _116 => _116()]);
3328
+ await _optionalChain([this, 'access', _117 => _117._tracerProvider, 'optionalAccess', _118 => _118.forceFlush, 'call', _119 => _119()]);
3329
+ await _optionalChain([this, 'access', _120 => _120._tracerProvider, 'optionalAccess', _121 => _121.shutdown, 'call', _122 => _122()]);
3330
+ await _optionalChain([this, 'access', _123 => _123._meterProvider, 'optionalAccess', _124 => _124.forceFlush, 'call', _125 => _125()]);
3331
+ await _optionalChain([this, 'access', _126 => _126._meterProvider, 'optionalAccess', _127 => _127.shutdown, 'call', _128 => _128()]);
3009
3332
  this._initialized = false;
3010
3333
  this._tracerProvider = null;
3011
3334
  this._meterProvider = null;
3012
3335
  __Brizz.instance = null;
3013
- _chunkWC573FCIcjs.logger.info("Brizz SDK shut down successfully");
3336
+ _chunkC5OT6GAQcjs.logger.info("Brizz SDK shut down successfully");
3014
3337
  } catch (error) {
3015
3338
  if (error instanceof Error && error.message.includes("ENOTFOUND")) {
3016
- _chunkWC573FCIcjs.logger.debug(`Network error during shutdown (expected in tests): ${error.message}`);
3339
+ _chunkC5OT6GAQcjs.logger.debug(`Network error during shutdown (expected in tests): ${error.message}`);
3017
3340
  } else {
3018
- _chunkWC573FCIcjs.logger.error(`Failed to shutdown Brizz SDK: ${String(error)}`);
3341
+ _chunkC5OT6GAQcjs.logger.error(`Failed to shutdown Brizz SDK: ${String(error)}`);
3019
3342
  throw error;
3020
3343
  }
3021
3344
  }
@@ -3075,4 +3398,4 @@ var Brizz = new _Brizz();
3075
3398
 
3076
3399
 
3077
3400
 
3078
- exports.Brizz = Brizz; exports.DEFAULT_PII_PATTERNS = DEFAULT_PII_PATTERNS; exports.LogLevel = _chunkWC573FCIcjs.LogLevel; exports.Session = _chunk4QNEI7VZcjs.Session; exports.SessionTitle = _chunk4QNEI7VZcjs.SessionTitle; exports.SeverityNumber = _api.SeverityNumber; exports.addExternalLink = _chunk4QNEI7VZcjs.addExternalLink; exports.callWithMessageId = _chunk4QNEI7VZcjs.callWithMessageId; exports.callWithMute = _chunk4QNEI7VZcjs.callWithMute; exports.callWithOrganization = _chunk4QNEI7VZcjs.callWithOrganization; exports.callWithProperties = _chunk4QNEI7VZcjs.callWithProperties; exports.callWithServiceName = _chunk4QNEI7VZcjs.callWithServiceName; exports.callWithSessionId = _chunk4QNEI7VZcjs.callWithSessionId; exports.callWithUser = _chunk4QNEI7VZcjs.callWithUser; exports.decisionCall = decisionCall; exports.emitEvent = _chunk4QNEI7VZcjs.emitEvent; exports.emitEventWithSessionId = _chunk4QNEI7VZcjs.emitEventWithSessionId; exports.getActiveSession = _chunk4QNEI7VZcjs.getActiveSession; exports.getLogLevel = _chunkWC573FCIcjs.getLogLevel; exports.getMetricsExporter = getMetricsExporter; exports.getMetricsReader = getMetricsReader; exports.getSpanExporter = getSpanExporter; exports.getSpanProcessor = getSpanProcessor; exports.getTracerProvider = _chunkDC2MFO65cjs.getTracerProvider; exports.logger = _chunkWC573FCIcjs.logger; exports.maskAttributes = maskAttributes; exports.maskValue = maskValue; exports.recordDecisionCall = recordDecisionCall; exports.recordFeedback = _chunk4QNEI7VZcjs.recordFeedback; exports.recordMetric = _chunk4QNEI7VZcjs.recordMetric; exports.setAgent = _chunk4QNEI7VZcjs.setAgent; exports.setCurrentSpanCustomProperties = _chunk4QNEI7VZcjs.setCurrentSpanCustomProperties; exports.setLogLevel = _chunkWC573FCIcjs.setLogLevel; exports.setMessageId = _chunk4QNEI7VZcjs.setMessageId; exports.setOrganization = _chunk4QNEI7VZcjs.setOrganization; exports.setServiceName = _chunk4QNEI7VZcjs.setServiceName; exports.setSessionId = _chunk4QNEI7VZcjs.setSessionId; exports.setUser = _chunk4QNEI7VZcjs.setUser; exports.startAgent = _chunk4QNEI7VZcjs.startAgent; exports.startSession = _chunk4QNEI7VZcjs.startSession; exports.startSessionTitle = _chunk4QNEI7VZcjs.startSessionTitle; exports.withAgent = _chunk4QNEI7VZcjs.withAgent; exports.withMessageId = _chunk4QNEI7VZcjs.withMessageId; exports.withMute = _chunk4QNEI7VZcjs.withMute; exports.withOrganization = _chunk4QNEI7VZcjs.withOrganization; exports.withProperties = _chunk4QNEI7VZcjs.withProperties; exports.withServiceName = _chunk4QNEI7VZcjs.withServiceName; exports.withSessionId = _chunk4QNEI7VZcjs.withSessionId; exports.withUser = _chunk4QNEI7VZcjs.withUser;
3401
+ exports.Brizz = Brizz; exports.DEFAULT_PII_PATTERNS = DEFAULT_PII_PATTERNS; exports.LogLevel = _chunkC5OT6GAQcjs.LogLevel; exports.Session = _chunkUF4GMVEYcjs.Session; exports.SessionTitle = _chunkUF4GMVEYcjs.SessionTitle; exports.SeverityNumber = _api.SeverityNumber; exports.addExternalLink = _chunkUF4GMVEYcjs.addExternalLink; exports.callWithMessageId = _chunkUF4GMVEYcjs.callWithMessageId; exports.callWithMute = _chunkUF4GMVEYcjs.callWithMute; exports.callWithOrganization = _chunkUF4GMVEYcjs.callWithOrganization; exports.callWithProperties = _chunkUF4GMVEYcjs.callWithProperties; exports.callWithServiceName = _chunkUF4GMVEYcjs.callWithServiceName; exports.callWithSessionId = _chunkUF4GMVEYcjs.callWithSessionId; exports.callWithUser = _chunkUF4GMVEYcjs.callWithUser; exports.decisionCall = decisionCall; exports.emitEvent = _chunkUF4GMVEYcjs.emitEvent; exports.emitEventWithSessionId = _chunkUF4GMVEYcjs.emitEventWithSessionId; exports.getActiveSession = _chunkUF4GMVEYcjs.getActiveSession; exports.getLogLevel = _chunkC5OT6GAQcjs.getLogLevel; exports.getMetricsExporter = getMetricsExporter; exports.getMetricsReader = getMetricsReader; exports.getSpanExporter = getSpanExporter; exports.getSpanProcessor = getSpanProcessor; exports.getTracerProvider = _chunkDC2MFO65cjs.getTracerProvider; exports.logger = _chunkC5OT6GAQcjs.logger; exports.maskAttributes = maskAttributes; exports.maskValue = maskValue; exports.recordDecisionCall = recordDecisionCall; exports.recordFeedback = _chunkUF4GMVEYcjs.recordFeedback; exports.recordMetric = _chunkUF4GMVEYcjs.recordMetric; exports.setAgent = _chunkUF4GMVEYcjs.setAgent; exports.setCurrentSpanCustomProperties = _chunkUF4GMVEYcjs.setCurrentSpanCustomProperties; exports.setLogLevel = _chunkC5OT6GAQcjs.setLogLevel; exports.setMessageId = _chunkUF4GMVEYcjs.setMessageId; exports.setOrganization = _chunkUF4GMVEYcjs.setOrganization; exports.setServiceName = _chunkUF4GMVEYcjs.setServiceName; exports.setSessionId = _chunkUF4GMVEYcjs.setSessionId; exports.setUser = _chunkUF4GMVEYcjs.setUser; exports.startAgent = _chunkUF4GMVEYcjs.startAgent; exports.startSession = _chunkUF4GMVEYcjs.startSession; exports.startSessionTitle = _chunkUF4GMVEYcjs.startSessionTitle; exports.withAgent = _chunkUF4GMVEYcjs.withAgent; exports.withMessageId = _chunkUF4GMVEYcjs.withMessageId; exports.withMute = _chunkUF4GMVEYcjs.withMute; exports.withOrganization = _chunkUF4GMVEYcjs.withOrganization; exports.withProperties = _chunkUF4GMVEYcjs.withProperties; exports.withServiceName = _chunkUF4GMVEYcjs.withServiceName; exports.withSessionId = _chunkUF4GMVEYcjs.withSessionId; exports.withUser = _chunkUF4GMVEYcjs.withUser;