@brizz/sdk 0.1.58 → 0.1.60

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 (43) hide show
  1. package/README.md +41 -3
  2. package/dist/{chunk-O2IBZJOJ.cjs → chunk-6QXPHZEO.cjs} +4 -4
  3. package/dist/{chunk-7PRTTYWM.js → chunk-GABRGNAU.js} +1 -1
  4. package/dist/{chunk-GUKWVI53.js → chunk-GISL4K6Z.js} +27 -1
  5. package/dist/{chunk-MXKQQ6AU.js → chunk-MPSJSXD3.js} +2 -2
  6. package/dist/{chunk-LXRU77IM.js → chunk-MW6L2BZN.js} +2 -2
  7. package/dist/{chunk-RV7JIIDG.cjs → chunk-NF52RMLW.cjs} +27 -1
  8. package/dist/{chunk-JGATEWJB.cjs → chunk-WCUBTLL5.cjs} +8 -8
  9. package/dist/{chunk-XGD5HD5W.cjs → chunk-Y7UFS5CA.cjs} +122 -122
  10. package/dist/index.cjs +286 -108
  11. package/dist/index.js +216 -38
  12. package/dist/interrupt-36U5562Z.cjs +12 -0
  13. package/dist/{interrupt-UKJK5WOA.js → interrupt-6BSXUK3O.js} +2 -2
  14. package/dist/{mcp-YNOK6OX5.cjs → mcp-2AURUXLD.cjs} +19 -18
  15. package/dist/{mcp-2JWY4GGY.js → mcp-IB3UO2FY.js} +4 -3
  16. package/dist/session.cjs +4 -4
  17. package/dist/session.js +3 -3
  18. package/dist/types/cjs/index.d.ts +3 -3
  19. package/dist/types/cjs/internal/error-type.d.ts +1 -0
  20. package/dist/types/cjs/internal/instrumentation/mcp/semantic-conventions.d.ts +1 -1
  21. package/dist/types/cjs/internal/instrumentation/typesafe.d.ts +0 -8
  22. package/dist/types/cjs/internal/log/emit.d.ts +2 -2
  23. package/dist/types/cjs/internal/log/logging.d.ts +2 -2
  24. package/dist/types/cjs/internal/semantic-conventions.d.ts +13 -0
  25. package/dist/types/cjs/internal/serialization.d.ts +2 -0
  26. package/dist/types/cjs/internal/trace/decision-call.d.ts +24 -0
  27. package/dist/types/cjs/internal/trace/index.d.ts +2 -0
  28. package/dist/types/cjs/internal/trace/session.d.ts +2 -1
  29. package/dist/types/cjs/session.d.ts +1 -1
  30. package/dist/types/esm/index.d.ts +3 -3
  31. package/dist/types/esm/internal/error-type.d.ts +1 -0
  32. package/dist/types/esm/internal/instrumentation/mcp/semantic-conventions.d.ts +1 -1
  33. package/dist/types/esm/internal/instrumentation/typesafe.d.ts +0 -8
  34. package/dist/types/esm/internal/log/emit.d.ts +2 -2
  35. package/dist/types/esm/internal/log/logging.d.ts +2 -2
  36. package/dist/types/esm/internal/semantic-conventions.d.ts +13 -0
  37. package/dist/types/esm/internal/serialization.d.ts +2 -0
  38. package/dist/types/esm/internal/trace/decision-call.d.ts +24 -0
  39. package/dist/types/esm/internal/trace/index.d.ts +2 -0
  40. package/dist/types/esm/internal/trace/session.d.ts +2 -1
  41. package/dist/types/esm/session.d.ts +1 -1
  42. package/package.json +30 -29
  43. package/dist/interrupt-BYLSBXTV.cjs +0 -12
package/dist/index.cjs CHANGED
@@ -39,11 +39,11 @@ var _chunkUNLNNKZ7cjs = require('./chunk-UNLNNKZ7.cjs');
39
39
 
40
40
 
41
41
 
42
- var _chunkXGD5HD5Wcjs = require('./chunk-XGD5HD5W.cjs');
42
+ var _chunkY7UFS5CAcjs = require('./chunk-Y7UFS5CA.cjs');
43
43
 
44
44
 
45
45
 
46
- var _chunkJGATEWJBcjs = require('./chunk-JGATEWJB.cjs');
46
+ var _chunkWCUBTLL5cjs = require('./chunk-WCUBTLL5.cjs');
47
47
 
48
48
 
49
49
 
@@ -62,7 +62,7 @@ var _chunkDC2MFO65cjs = require('./chunk-DC2MFO65.cjs');
62
62
  var _chunkWC573FCIcjs = require('./chunk-WC573FCI.cjs');
63
63
 
64
64
 
65
- var _chunkO2IBZJOJcjs = require('./chunk-O2IBZJOJ.cjs');
65
+ var _chunk6QXPHZEOcjs = require('./chunk-6QXPHZEO.cjs');
66
66
 
67
67
 
68
68
 
@@ -72,7 +72,21 @@ var _chunkO2IBZJOJcjs = require('./chunk-O2IBZJOJ.cjs');
72
72
 
73
73
 
74
74
 
75
- var _chunkRV7JIIDGcjs = require('./chunk-RV7JIIDG.cjs');
75
+
76
+
77
+
78
+
79
+
80
+
81
+
82
+
83
+
84
+
85
+
86
+
87
+
88
+
89
+ var _chunkNF52RMLWcjs = require('./chunk-NF52RMLW.cjs');
76
90
 
77
91
 
78
92
  var _chunkOBGZSXTJcjs = require('./chunk-OBGZSXTJ.cjs');
@@ -98,7 +112,7 @@ var _api = require('@opentelemetry/api');
98
112
 
99
113
  // src/internal/instrumentation/langgraph/attributes.ts
100
114
  var INSTRUMENTATION_NAME = "@brizz/sdk/langgraph";
101
- var INSTRUMENTATION_VERSION = _chunkJGATEWJBcjs.getSDKVersion.call(void 0, );
115
+ var INSTRUMENTATION_VERSION = _chunkWCUBTLL5cjs.getSDKVersion.call(void 0, );
102
116
  var MODULE_NAME = "@langchain/langgraph";
103
117
  var SUPPORTED_VERSIONS = [">=0.2.0 <2"];
104
118
  function isSupportedVersion(version) {
@@ -436,25 +450,40 @@ var BrizzOpenAIInstrumentation = class extends _openinferenceinstrumentationopen
436
450
 
437
451
 
438
452
 
453
+
454
+ // src/internal/error-type.ts
455
+ function errorType(error) {
456
+ if (!(error instanceof Error)) {
457
+ return "_OTHER";
458
+ }
459
+ return _optionalChain([error, 'access', _19 => _19.constructor, 'optionalAccess', _20 => _20.name]) || error.name || "_OTHER";
460
+ }
461
+
462
+ // src/internal/serialization.ts
463
+ function toJson(value) {
464
+ try {
465
+ return JSON.stringify(value);
466
+ } catch (error) {
467
+ _chunkWC573FCIcjs.logger.debug(`Brizz: value is not JSON-serializable: ${String(error)}`);
468
+ return void 0;
469
+ }
470
+ }
471
+ function text(value) {
472
+ return typeof value === "string" ? value : _nullishCoalesce(toJson(value), () => ( ""));
473
+ }
474
+
475
+ // src/internal/instrumentation/typesafe.ts
439
476
  var INSTRUMENTATION_NAME2 = "@brizz/sdk/typesafe";
440
477
  var MODULE_NAME2 = "@typesafe-ai/sdk";
441
478
  var SUPPORTED_VERSIONS2 = [">=0.5.7 <1"];
442
479
  var SPAN_NAME = "typesafe.system_one";
443
480
  var PROVIDER_NAME = "typesafe";
444
- var OPERATION_NAME = "classify";
445
- var ATTR_OPERATION_NAME = "gen_ai.operation.name";
446
- var ATTR_PROVIDER_NAME = "gen_ai.provider.name";
447
- var ATTR_REQUEST_MODEL = "gen_ai.request.model";
448
- var ATTR_RESPONSE_MODEL = "gen_ai.response.model";
449
- var ATTR_INPUT_TOKENS = "gen_ai.usage.input_tokens";
450
- var ATTR_OUTPUT_TOKENS = "gen_ai.usage.output_tokens";
451
- var ATTR_INPUT_MESSAGES = "gen_ai.input.messages";
452
481
  var ATTR_QUESTIONS = "typesafe.questions";
453
482
  var ATTR_ANSWERS = "typesafe.answers";
454
483
  var PATCHED_FLAG2 = /* @__PURE__ */ Symbol.for("brizz.typesafe.patched");
455
484
  var TypeSafeInstrumentation = class extends _instrumentation.InstrumentationBase {
456
485
  constructor(config = {}) {
457
- super(INSTRUMENTATION_NAME2, _chunkJGATEWJBcjs.getSDKVersion.call(void 0, ), config);
486
+ super(INSTRUMENTATION_NAME2, _chunkWCUBTLL5cjs.getSDKVersion.call(void 0, ), config);
458
487
  this.setTracerProvider(_chunkDC2MFO65cjs.brizzTracerProvider);
459
488
  }
460
489
  init() {
@@ -477,7 +506,7 @@ var TypeSafeInstrumentation = class extends _instrumentation.InstrumentationBase
477
506
  * `patchInstalledTypeSafe`, or `instrumentModules: { typesafe }`.
478
507
  */
479
508
  manuallyInstrument(moduleExports) {
480
- const client = _optionalChain([moduleExports, 'optionalAccess', _19 => _19.TypeSafeClient]);
509
+ const client = _optionalChain([moduleExports, 'optionalAccess', _21 => _21.TypeSafeClient]);
481
510
  if (typeof client !== "function" || !client.prototype) {
482
511
  _chunkWC573FCIcjs.logger.debug("Brizz TypeSafe: module does not expose TypeSafeClient \u2014 skipping patch");
483
512
  return;
@@ -560,9 +589,9 @@ function patchSystemOne(proto, getTracer) {
560
589
  function observe(pending, span) {
561
590
  const onError = (error) => endSpan(span, error);
562
591
  try {
563
- if (typeof _optionalChain([pending, 'optionalAccess', _20 => _20.asResponse]) === "function") {
592
+ if (typeof _optionalChain([pending, 'optionalAccess', _22 => _22.asResponse]) === "function") {
564
593
  pending.asResponse().then((response) => {
565
- if (typeof _optionalChain([response, 'optionalAccess', _21 => _21.clone]) !== "function") {
594
+ if (typeof _optionalChain([response, 'optionalAccess', _23 => _23.clone]) !== "function") {
566
595
  endSpan(span);
567
596
  return;
568
597
  }
@@ -573,7 +602,7 @@ function observe(pending, span) {
573
602
  }, onError);
574
603
  return pending;
575
604
  }
576
- if (typeof _optionalChain([pending, 'optionalAccess', _22 => _22.then]) === "function") {
605
+ if (typeof _optionalChain([pending, 'optionalAccess', _24 => _24.then]) === "function") {
577
606
  pending.then((result) => {
578
607
  recordResult(span, result);
579
608
  endSpan(span);
@@ -588,18 +617,18 @@ function observe(pending, span) {
588
617
  }
589
618
  function startSpan(getTracer, request) {
590
619
  try {
591
- const model = typeof _optionalChain([request, 'optionalAccess', _23 => _23.model]) === "string" && request.model !== "" ? request.model : void 0;
620
+ const model = typeof _optionalChain([request, 'optionalAccess', _25 => _25.model]) === "string" && request.model !== "" ? request.model : void 0;
592
621
  const attributes = {
593
- [ATTR_OPERATION_NAME]: OPERATION_NAME,
594
- [ATTR_PROVIDER_NAME]: PROVIDER_NAME,
595
- [ATTR_INPUT_MESSAGES]: JSON.stringify([
596
- { role: "user", parts: [{ type: "text", content: text(_optionalChain([request, 'optionalAccess', _24 => _24.state])) }] }
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([
625
+ { role: "user", parts: [{ type: "text", content: text(_optionalChain([request, 'optionalAccess', _26 => _26.state])) }] }
597
626
  ])
598
627
  };
599
628
  if (model) {
600
- attributes[ATTR_REQUEST_MODEL] = model;
629
+ attributes[_chunkNF52RMLWcjs.GEN_AI_REQUEST_MODEL] = model;
601
630
  }
602
- if (_optionalChain([request, 'optionalAccess', _25 => _25.questions]) !== void 0) {
631
+ if (_optionalChain([request, 'optionalAccess', _27 => _27.questions]) !== void 0) {
603
632
  attributes[ATTR_QUESTIONS] = JSON.stringify(request.questions);
604
633
  }
605
634
  return getTracer().startSpan(SPAN_NAME, { kind: _api.SpanKind.CLIENT, attributes });
@@ -612,13 +641,13 @@ function recordResult(span, result) {
612
641
  try {
613
642
  const { model, usage, answers } = _nullishCoalesce(result, () => ( {}));
614
643
  if (typeof model === "string" && model) {
615
- span.setAttribute(ATTR_RESPONSE_MODEL, model);
644
+ span.setAttribute(_chunkNF52RMLWcjs.GEN_AI_RESPONSE_MODEL, model);
616
645
  }
617
- if (typeof _optionalChain([usage, 'optionalAccess', _26 => _26.input_tokens]) === "number") {
618
- span.setAttribute(ATTR_INPUT_TOKENS, usage.input_tokens);
646
+ if (typeof _optionalChain([usage, 'optionalAccess', _28 => _28.input_tokens]) === "number") {
647
+ span.setAttribute(_chunkNF52RMLWcjs.GEN_AI_USAGE_INPUT_TOKENS, usage.input_tokens);
619
648
  }
620
- if (typeof _optionalChain([usage, 'optionalAccess', _27 => _27.output_tokens]) === "number") {
621
- span.setAttribute(ATTR_OUTPUT_TOKENS, usage.output_tokens);
649
+ if (typeof _optionalChain([usage, 'optionalAccess', _29 => _29.output_tokens]) === "number") {
650
+ span.setAttribute(_chunkNF52RMLWcjs.GEN_AI_USAGE_OUTPUT_TOKENS, usage.output_tokens);
622
651
  }
623
652
  if (answers !== void 0) {
624
653
  span.setAttribute(ATTR_ANSWERS, JSON.stringify(answers));
@@ -634,12 +663,10 @@ function endSpan(span, error) {
634
663
  if (error !== void 0) {
635
664
  span.recordException(error instanceof Error ? error : new Error(String(error)));
636
665
  span.setStatus({ code: _api.SpanStatusCode.ERROR, message: String(error) });
666
+ span.setAttribute(_chunkNF52RMLWcjs.ERROR_TYPE, errorType(error));
637
667
  }
638
668
  span.end();
639
669
  }
640
- function text(value) {
641
- return typeof value === "string" ? value : _nullishCoalesce(JSON.stringify(value), () => ( ""));
642
- }
643
670
 
644
671
  // src/internal/instrumentation/auto-init.ts
645
672
  var exceptionLogger = (error) => {
@@ -683,7 +710,7 @@ function loadGenAIInstrumentations() {
683
710
  function loadMCPInstrumentation() {
684
711
  void (async () => {
685
712
  try {
686
- const { MCPInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("./mcp-YNOK6OX5.cjs")));
713
+ const { MCPInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("./mcp-2AURUXLD.cjs")));
687
714
  const mcp = new MCPInstrumentation({ exceptionLogger });
688
715
  _instrumentation.registerInstrumentations.call(void 0, { instrumentations: [mcp], tracerProvider: _chunkDC2MFO65cjs.brizzTracerProvider });
689
716
  _chunkWC573FCIcjs.logger.debug("Auto-loaded MCP instrumentation");
@@ -767,7 +794,7 @@ function loadVercelAITelemetry() {
767
794
  }
768
795
  const isV7 = typeof ai.registerTelemetry === "function";
769
796
  const integrations = [];
770
- const { createInterruptIntegration } = await Promise.resolve().then(() => _interopRequireWildcard(require("./interrupt-BYLSBXTV.cjs")));
797
+ const { createInterruptIntegration } = await Promise.resolve().then(() => _interopRequireWildcard(require("./interrupt-36U5562Z.cjs")));
771
798
  integrations.push(createInterruptIntegration());
772
799
  let otelCollectorLoaded = false;
773
800
  try {
@@ -846,7 +873,7 @@ function parseBoolEnv(name) {
846
873
  return void 0;
847
874
  }
848
875
  function resolveConfig(options) {
849
- const envLogLevel = process.env["BRIZZ_LOG_LEVEL"] || _optionalChain([options, 'access', _28 => _28.logLevel, 'optionalAccess', _29 => _29.toString, 'call', _30 => _30()]) || _chunkWC573FCIcjs.DEFAULT_LOG_LEVEL.toString();
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();
850
877
  let resolvedLogLevel;
851
878
  if (envLogLevel) {
852
879
  resolvedLogLevel = _chunkWC573FCIcjs.parseLogLevel.call(void 0, envLogLevel);
@@ -1002,29 +1029,29 @@ var PATCHED_MARKER = /* @__PURE__ */ Symbol.for("brizz.langchain.callbackManager
1002
1029
  var TRACER_PATCHED_MARKER = /* @__PURE__ */ Symbol.for("brizz.langchain.tracerPatched");
1003
1030
  var runContexts = /* @__PURE__ */ new WeakMap();
1004
1031
  var OMITTED_KEYS = /* @__PURE__ */ new Set([
1005
- _chunkRV7JIIDGcjs.USER_EMAIL,
1006
- _chunkRV7JIIDGcjs.USER_NAME,
1007
- _chunkRV7JIIDGcjs.ORGANIZATION_NAME,
1008
- _chunkRV7JIIDGcjs.ORGANIZATION_DOMAIN
1032
+ _chunkNF52RMLWcjs.USER_EMAIL,
1033
+ _chunkNF52RMLWcjs.USER_NAME,
1034
+ _chunkNF52RMLWcjs.ORGANIZATION_NAME,
1035
+ _chunkNF52RMLWcjs.ORGANIZATION_DOMAIN
1009
1036
  ]);
1010
1037
  var TOOL_CALL_ID_METADATA_KEY = "brizz_tool_call_id";
1011
1038
  var TOOL_ID = "tool.id";
1012
1039
  var TOOL_CALL_ID_ARG = 7;
1013
1040
  function runMetadataFromContext() {
1014
- const bag = _api.context.active().getValue(_chunkRV7JIIDGcjs.PROPERTIES_CONTEXT_KEY);
1041
+ const bag = _api.context.active().getValue(_chunkNF52RMLWcjs.PROPERTIES_CONTEXT_KEY);
1015
1042
  if (!bag) {
1016
1043
  return void 0;
1017
1044
  }
1018
1045
  const metadata = {};
1019
1046
  for (const [name, value] of Object.entries(bag)) {
1020
1047
  if (!OMITTED_KEYS.has(name)) {
1021
- metadata[`${_chunkRV7JIIDGcjs.BRIZZ}.${name}`] = String(value);
1048
+ metadata[`${_chunkNF52RMLWcjs.BRIZZ}.${name}`] = String(value);
1022
1049
  }
1023
1050
  }
1024
1051
  return Object.keys(metadata).length > 0 ? metadata : void 0;
1025
1052
  }
1026
1053
  function patchCallbackManagerModule(module2) {
1027
- const callbackManager = _optionalChain([module2, 'optionalAccess', _31 => _31.CallbackManager]);
1054
+ const callbackManager = _optionalChain([module2, 'optionalAccess', _33 => _33.CallbackManager]);
1028
1055
  if (callbackManager === null || typeof callbackManager !== "function" && typeof callbackManager !== "object") {
1029
1056
  return false;
1030
1057
  }
@@ -1047,7 +1074,7 @@ function patchCallbackManagerModule(module2) {
1047
1074
  }
1048
1075
  } catch (e2) {
1049
1076
  }
1050
- _optionalChain([manager, 'optionalAccess', _32 => _32.handlers, 'optionalAccess', _33 => _33.forEach, 'call', _34 => _34((handler) => {
1077
+ _optionalChain([manager, 'optionalAccess', _34 => _34.handlers, 'optionalAccess', _35 => _35.forEach, 'call', _36 => _36((handler) => {
1051
1078
  try {
1052
1079
  patchTracer(handler);
1053
1080
  } catch (e3) {
@@ -1060,21 +1087,21 @@ function patchCallbackManagerModule(module2) {
1060
1087
  return true;
1061
1088
  }
1062
1089
  function patchTracer(handler) {
1063
- const tracer = handler;
1064
- if (typeof tracer !== "object" || tracer === null || tracer[TRACER_PATCHED_MARKER] === true) {
1090
+ const tracer2 = handler;
1091
+ if (typeof tracer2 !== "object" || tracer2 === null || tracer2[TRACER_PATCHED_MARKER] === true) {
1065
1092
  return;
1066
1093
  }
1067
- const addRunToRunMap = tracer["_addRunToRunMap"];
1068
- const onRunCreate = tracer["onRunCreate"];
1069
- const endTrace = tracer["_endTrace"];
1094
+ const addRunToRunMap = tracer2["_addRunToRunMap"];
1095
+ const onRunCreate = tracer2["onRunCreate"];
1096
+ const endTrace = tracer2["_endTrace"];
1070
1097
  if (typeof addRunToRunMap !== "function" || typeof onRunCreate !== "function" || typeof endTrace !== "function") {
1071
1098
  return;
1072
1099
  }
1073
- tracer[TRACER_PATCHED_MARKER] = true;
1074
- tracer["onRunCreate"] = inRunContext(onRunCreate);
1075
- tracer["_endTrace"] = inRunContext(endTrace);
1100
+ tracer2[TRACER_PATCHED_MARKER] = true;
1101
+ tracer2["onRunCreate"] = inRunContext(onRunCreate);
1102
+ tracer2["_endTrace"] = inRunContext(endTrace);
1076
1103
  const addRun = addRunToRunMap;
1077
- tracer["_addRunToRunMap"] = function(...args) {
1104
+ tracer2["_addRunToRunMap"] = function(...args) {
1078
1105
  const run = addRun.apply(this, args);
1079
1106
  if (typeof run === "object" && run !== null) {
1080
1107
  runContexts.set(run, _api.context.active());
@@ -1090,7 +1117,7 @@ function inRunContext(method) {
1090
1117
  }
1091
1118
  function patchToolStart(prototype) {
1092
1119
  const proto = prototype;
1093
- const original = _optionalChain([proto, 'optionalAccess', _35 => _35["handleToolStart"]]);
1120
+ const original = _optionalChain([proto, 'optionalAccess', _37 => _37["handleToolStart"]]);
1094
1121
  if (!proto || typeof original !== "function") {
1095
1122
  return;
1096
1123
  }
@@ -1128,12 +1155,12 @@ function patchInstalledCallbackManager() {
1128
1155
  function restampLangChainSpan(span) {
1129
1156
  try {
1130
1157
  const scope = span.instrumentationScope;
1131
- if (_optionalChain([scope, 'optionalAccess', _36 => _36.name]) !== SCOPE_NAME) {
1158
+ if (_optionalChain([scope, 'optionalAccess', _38 => _38.name]) !== SCOPE_NAME) {
1132
1159
  return;
1133
1160
  }
1134
1161
  const attrs = span.attributes;
1135
1162
  const metadata = attrs["metadata"];
1136
- if (typeof metadata !== "string" || !metadata.includes(`"${_chunkRV7JIIDGcjs.BRIZZ}.`) && !metadata.includes(`"${TOOL_CALL_ID_METADATA_KEY}"`)) {
1163
+ if (typeof metadata !== "string" || !metadata.includes(`"${_chunkNF52RMLWcjs.BRIZZ}.`) && !metadata.includes(`"${TOOL_CALL_ID_METADATA_KEY}"`)) {
1137
1164
  return;
1138
1165
  }
1139
1166
  const parsed = JSON.parse(metadata);
@@ -1142,7 +1169,7 @@ function restampLangChainSpan(span) {
1142
1169
  }
1143
1170
  const entries = parsed;
1144
1171
  for (const [key, value] of Object.entries(entries)) {
1145
- if (key.startsWith(`${_chunkRV7JIIDGcjs.BRIZZ}.`) && value !== null && value !== void 0) {
1172
+ if (key.startsWith(`${_chunkNF52RMLWcjs.BRIZZ}.`) && value !== null && value !== void 0) {
1146
1173
  attrs[key] = String(value);
1147
1174
  }
1148
1175
  }
@@ -1190,7 +1217,7 @@ var InstrumentationRegistry = (_class = class _InstrumentationRegistry {construc
1190
1217
  * @private
1191
1218
  */
1192
1219
  loadManualInstrumentations(instrumentations, exceptionLogger2) {
1193
- if (_optionalChain([this, 'access', _37 => _37.manualModules, 'optionalAccess', _38 => _38.openAI])) {
1220
+ if (_optionalChain([this, 'access', _39 => _39.manualModules, 'optionalAccess', _40 => _40.openAI])) {
1194
1221
  try {
1195
1222
  const openAIInst = new BrizzOpenAIInstrumentation();
1196
1223
  openAIInst.manuallyInstrument(this.manualModules.openAI);
@@ -1201,18 +1228,18 @@ var InstrumentationRegistry = (_class = class _InstrumentationRegistry {construc
1201
1228
  }
1202
1229
  }
1203
1230
  const instrumentationConfigs = [
1204
- { class: _instrumentationanthropic.AnthropicInstrumentation, name: "Anthropic", module: _optionalChain([this, 'access', _39 => _39.manualModules, 'optionalAccess', _40 => _40.anthropic]) },
1205
- { class: _instrumentationcohere.CohereInstrumentation, name: "Cohere", module: _optionalChain([this, 'access', _41 => _41.manualModules, 'optionalAccess', _42 => _42.cohere]) },
1206
- { class: _instrumentationbedrock.BedrockInstrumentation, name: "Bedrock", module: _optionalChain([this, 'access', _43 => _43.manualModules, 'optionalAccess', _44 => _44.bedrock]) },
1207
- { class: _instrumentationpinecone.PineconeInstrumentation, name: "Pinecone", module: _optionalChain([this, 'access', _45 => _45.manualModules, 'optionalAccess', _46 => _46.pinecone]) },
1231
+ { class: _instrumentationanthropic.AnthropicInstrumentation, name: "Anthropic", module: _optionalChain([this, 'access', _41 => _41.manualModules, 'optionalAccess', _42 => _42.anthropic]) },
1232
+ { class: _instrumentationcohere.CohereInstrumentation, name: "Cohere", module: _optionalChain([this, 'access', _43 => _43.manualModules, 'optionalAccess', _44 => _44.cohere]) },
1233
+ { class: _instrumentationbedrock.BedrockInstrumentation, name: "Bedrock", module: _optionalChain([this, 'access', _45 => _45.manualModules, 'optionalAccess', _46 => _46.bedrock]) },
1234
+ { class: _instrumentationpinecone.PineconeInstrumentation, name: "Pinecone", module: _optionalChain([this, 'access', _47 => _47.manualModules, 'optionalAccess', _48 => _48.pinecone]) },
1208
1235
  {
1209
1236
  class: _instrumentationllamaindex.LlamaIndexInstrumentation,
1210
1237
  name: "LlamaIndex",
1211
- module: _optionalChain([this, 'access', _47 => _47.manualModules, 'optionalAccess', _48 => _48.llamaindex])
1238
+ module: _optionalChain([this, 'access', _49 => _49.manualModules, 'optionalAccess', _50 => _50.llamaindex])
1212
1239
  },
1213
- { class: _instrumentationchromadb.ChromaDBInstrumentation, name: "ChromaDB", module: _optionalChain([this, 'access', _49 => _49.manualModules, 'optionalAccess', _50 => _50.chromadb]) },
1214
- { class: _instrumentationqdrant.QdrantInstrumentation, name: "Qdrant", module: _optionalChain([this, 'access', _51 => _51.manualModules, 'optionalAccess', _52 => _52.qdrant]) },
1215
- { class: _instrumentationtogether.TogetherInstrumentation, name: "Together", module: _optionalChain([this, 'access', _53 => _53.manualModules, 'optionalAccess', _54 => _54.together]) }
1240
+ { class: _instrumentationchromadb.ChromaDBInstrumentation, name: "ChromaDB", module: _optionalChain([this, 'access', _51 => _51.manualModules, 'optionalAccess', _52 => _52.chromadb]) },
1241
+ { class: _instrumentationqdrant.QdrantInstrumentation, name: "Qdrant", module: _optionalChain([this, 'access', _53 => _53.manualModules, 'optionalAccess', _54 => _54.qdrant]) },
1242
+ { class: _instrumentationtogether.TogetherInstrumentation, name: "Together", module: _optionalChain([this, 'access', _55 => _55.manualModules, 'optionalAccess', _56 => _56.together]) }
1216
1243
  ];
1217
1244
  for (const config of instrumentationConfigs) {
1218
1245
  if (!config.module) {
@@ -1228,7 +1255,7 @@ var InstrumentationRegistry = (_class = class _InstrumentationRegistry {construc
1228
1255
  instrumentations.push(instrumentation);
1229
1256
  }
1230
1257
  }
1231
- if (_optionalChain([this, 'access', _55 => _55.manualModules, 'optionalAccess', _56 => _56.langchain, 'optionalAccess', _57 => _57.callbackManagerModule])) {
1258
+ if (_optionalChain([this, 'access', _57 => _57.manualModules, 'optionalAccess', _58 => _58.langchain, 'optionalAccess', _59 => _59.callbackManagerModule])) {
1232
1259
  const callbackManagerModule = this.manualModules.langchain.callbackManagerModule;
1233
1260
  void (async () => {
1234
1261
  try {
@@ -1244,7 +1271,7 @@ var InstrumentationRegistry = (_class = class _InstrumentationRegistry {construc
1244
1271
  }
1245
1272
  })();
1246
1273
  }
1247
- if (_optionalChain([this, 'access', _58 => _58.manualModules, 'optionalAccess', _59 => _59.langgraph])) {
1274
+ if (_optionalChain([this, 'access', _60 => _60.manualModules, 'optionalAccess', _61 => _61.langgraph])) {
1248
1275
  try {
1249
1276
  new LangGraphInstrumentation().manuallyInstrument(this.manualModules.langgraph);
1250
1277
  _chunkWC573FCIcjs.logger.debug("Manual instrumentation enabled for LangGraph");
@@ -1252,7 +1279,7 @@ var InstrumentationRegistry = (_class = class _InstrumentationRegistry {construc
1252
1279
  _chunkWC573FCIcjs.logger.error(`Failed to apply LangGraph instrumentation: ${String(error)}`);
1253
1280
  }
1254
1281
  }
1255
- if (_optionalChain([this, 'access', _60 => _60.manualModules, 'optionalAccess', _61 => _61.typesafe])) {
1282
+ if (_optionalChain([this, 'access', _62 => _62.manualModules, 'optionalAccess', _63 => _63.typesafe])) {
1256
1283
  try {
1257
1284
  new TypeSafeInstrumentation().manuallyInstrument(this.manualModules.typesafe);
1258
1285
  _chunkWC573FCIcjs.logger.debug("Manual instrumentation enabled for TypeSafe");
@@ -1260,7 +1287,7 @@ var InstrumentationRegistry = (_class = class _InstrumentationRegistry {construc
1260
1287
  _chunkWC573FCIcjs.logger.error(`Failed to apply TypeSafe instrumentation: ${String(error)}`);
1261
1288
  }
1262
1289
  }
1263
- if (_optionalChain([this, 'access', _62 => _62.manualModules, 'optionalAccess', _63 => _63.google_vertexai])) {
1290
+ if (_optionalChain([this, 'access', _64 => _64.manualModules, 'optionalAccess', _65 => _65.google_vertexai])) {
1264
1291
  const vertexModule = this.manualModules.google_vertexai;
1265
1292
  void (async () => {
1266
1293
  try {
@@ -1275,7 +1302,7 @@ var InstrumentationRegistry = (_class = class _InstrumentationRegistry {construc
1275
1302
  }
1276
1303
  })();
1277
1304
  }
1278
- if (_optionalChain([this, 'access', _64 => _64.manualModules, 'optionalAccess', _65 => _65.google_genai])) {
1305
+ if (_optionalChain([this, 'access', _66 => _66.manualModules, 'optionalAccess', _67 => _67.google_genai])) {
1279
1306
  const genaiModule = this.manualModules.google_genai;
1280
1307
  void (async () => {
1281
1308
  try {
@@ -1290,11 +1317,11 @@ var InstrumentationRegistry = (_class = class _InstrumentationRegistry {construc
1290
1317
  }
1291
1318
  })();
1292
1319
  }
1293
- if (_optionalChain([this, 'access', _66 => _66.manualModules, 'optionalAccess', _67 => _67.mcp])) {
1320
+ if (_optionalChain([this, 'access', _68 => _68.manualModules, 'optionalAccess', _69 => _69.mcp])) {
1294
1321
  const mcpModules = this.manualModules.mcp;
1295
1322
  void (async () => {
1296
1323
  try {
1297
- const { MCPInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("./mcp-YNOK6OX5.cjs")));
1324
+ const { MCPInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("./mcp-2AURUXLD.cjs")));
1298
1325
  const instrumentation = new MCPInstrumentation({ exceptionLogger: exceptionLogger2 });
1299
1326
  instrumentation.manuallyInstrument(mcpModules);
1300
1327
  _chunkWC573FCIcjs.logger.debug("Manual instrumentation enabled for MCP");
@@ -1331,7 +1358,7 @@ var InstrumentationRegistry = (_class = class _InstrumentationRegistry {construc
1331
1358
  }, _class);
1332
1359
 
1333
1360
  // src/internal/log/logging.ts
1334
-
1361
+ var _apilogs = require('@opentelemetry/api-logs');
1335
1362
  var _exporterlogsotlphttp = require('@opentelemetry/exporter-logs-otlp-http');
1336
1363
 
1337
1364
  var _sdklogs = require('@opentelemetry/sdk-logs');
@@ -1773,14 +1800,14 @@ var BrizzSimpleLogRecordProcessor = class extends _sdklogs.SimpleLogRecordProces
1773
1800
  this.config = config;
1774
1801
  }
1775
1802
  onEmit(logRecord) {
1776
- const maskingConfig = _optionalChain([this, 'access', _68 => _68.config, 'access', _69 => _69.masking, 'optionalAccess', _70 => _70.eventMasking]);
1803
+ const maskingConfig = _optionalChain([this, 'access', _70 => _70.config, 'access', _71 => _71.masking, 'optionalAccess', _72 => _72.eventMasking]);
1777
1804
  if (maskingConfig) {
1778
1805
  maskLog(logRecord, maskingConfig);
1779
1806
  }
1780
- const associationProperties = _api.context.active().getValue(_chunkRV7JIIDGcjs.PROPERTIES_CONTEXT_KEY);
1807
+ const associationProperties = _api.context.active().getValue(_chunkNF52RMLWcjs.PROPERTIES_CONTEXT_KEY);
1781
1808
  if (associationProperties) {
1782
1809
  for (const [key, value] of Object.entries(associationProperties)) {
1783
- logRecord.setAttribute(`${_chunkRV7JIIDGcjs.BRIZZ}.${key}`, value);
1810
+ logRecord.setAttribute(`${_chunkNF52RMLWcjs.BRIZZ}.${key}`, value);
1784
1811
  }
1785
1812
  }
1786
1813
  super.onEmit(logRecord);
@@ -1793,14 +1820,14 @@ var BrizzBatchLogRecordProcessor = class extends _sdklogs.BatchLogRecordProcesso
1793
1820
  this.config = config;
1794
1821
  }
1795
1822
  onEmit(logRecord) {
1796
- const maskingConfig = _optionalChain([this, 'access', _71 => _71.config, 'access', _72 => _72.masking, 'optionalAccess', _73 => _73.eventMasking]);
1823
+ const maskingConfig = _optionalChain([this, 'access', _73 => _73.config, 'access', _74 => _74.masking, 'optionalAccess', _75 => _75.eventMasking]);
1797
1824
  if (maskingConfig) {
1798
1825
  maskLog(logRecord, maskingConfig);
1799
1826
  }
1800
- const associationProperties = _api.context.active().getValue(_chunkRV7JIIDGcjs.PROPERTIES_CONTEXT_KEY);
1827
+ const associationProperties = _api.context.active().getValue(_chunkNF52RMLWcjs.PROPERTIES_CONTEXT_KEY);
1801
1828
  if (associationProperties) {
1802
1829
  for (const [key, value] of Object.entries(associationProperties)) {
1803
- logRecord.setAttribute(`${_chunkRV7JIIDGcjs.BRIZZ}.${key}`, value);
1830
+ logRecord.setAttribute(`${_chunkNF52RMLWcjs.BRIZZ}.${key}`, value);
1804
1831
  }
1805
1832
  }
1806
1833
  super.onEmit(logRecord);
@@ -1827,7 +1854,7 @@ function maskLog(logRecord, config) {
1827
1854
  newAttributes[key] = value;
1828
1855
  }
1829
1856
  for (const [key, value] of Object.entries(logRecord.attributes)) {
1830
- if (key.startsWith(_chunkRV7JIIDGcjs.INTERNAL_EVENT_PREFIX)) {
1857
+ if (key.startsWith(_chunkNF52RMLWcjs.INTERNAL_EVENT_PREFIX)) {
1831
1858
  newAttributes[key] = value;
1832
1859
  }
1833
1860
  }
@@ -1894,14 +1921,14 @@ var LoggingModule = (_class2 = class _LoggingModule {constructor() { _class2.pro
1894
1921
  _chunkWC573FCIcjs.logger.debug("Creating logger provider", {
1895
1922
  serviceName,
1896
1923
  disableBatch: config.disableBatch,
1897
- hasMasking: !!_optionalChain([config, 'access', _74 => _74.masking, 'optionalAccess', _75 => _75.eventMasking])
1924
+ hasMasking: !!_optionalChain([config, 'access', _76 => _76.masking, 'optionalAccess', _77 => _77.eventMasking])
1898
1925
  });
1899
1926
  const exporter = this.createLogExporter(config, serviceName);
1900
1927
  const processor = config.disableBatch ? new BrizzSimpleLogRecordProcessor(exporter, config) : new BrizzBatchLogRecordProcessor(exporter, config);
1901
1928
  const resourceAttributes = {
1902
1929
  ...config.resourceAttributes,
1903
1930
  "service.name": serviceName,
1904
- [BRIZZ_SDK_VERSION]: _chunkJGATEWJBcjs.getSDKVersion.call(void 0, ),
1931
+ [BRIZZ_SDK_VERSION]: _chunkWCUBTLL5cjs.getSDKVersion.call(void 0, ),
1905
1932
  [BRIZZ_SDK_LANGUAGE]: SDK_LANGUAGE
1906
1933
  };
1907
1934
  if (config.environment) {
@@ -1920,7 +1947,7 @@ var LoggingModule = (_class2 = class _LoggingModule {constructor() { _class2.pro
1920
1947
  * `callWithServiceName`, else the configured appName.
1921
1948
  */
1922
1949
  activeLoggerProvider() {
1923
- const serviceName = _chunkXGD5HD5Wcjs.resolveServiceNameFromContext.call(void 0, );
1950
+ const serviceName = _chunkY7UFS5CAcjs.resolveServiceNameFromContext.call(void 0, );
1924
1951
  if (!serviceName || !this.config || serviceName === this.config.appName) {
1925
1952
  return this.loggerProvider;
1926
1953
  }
@@ -1943,13 +1970,13 @@ var LoggingModule = (_class2 = class _LoggingModule {constructor() { _class2.pro
1943
1970
  this.loggerProvider = this.createLoggerProvider(config, config.appName);
1944
1971
  }
1945
1972
  _LoggingModule.instance = this;
1946
- _chunkXGD5HD5Wcjs.setEventSink.call(void 0, this);
1973
+ _chunkY7UFS5CAcjs.setEventSink.call(void 0, this);
1947
1974
  _chunkWC573FCIcjs.logger.info("Logging module setup completed");
1948
1975
  }
1949
1976
  /**
1950
1977
  * Emit a custom event to the telemetry pipeline
1951
1978
  */
1952
- emitEvent(name, attributes, body, severityNumber = _api.SeverityNumber.INFO) {
1979
+ emitEvent(name, attributes, body, severityNumber = _apilogs.SeverityNumber.INFO) {
1953
1980
  _chunkWC573FCIcjs.logger.debug("Attempting to emit event", {
1954
1981
  name,
1955
1982
  hasAttributes: !!attributes,
@@ -2003,7 +2030,7 @@ var LoggingModule = (_class2 = class _LoggingModule {constructor() { _class2.pro
2003
2030
  }
2004
2031
  async forceFlush() {
2005
2032
  await Promise.all(
2006
- [...this.scopedProviders.values(), this.loggerProvider].map(async (p) => _optionalChain([p, 'optionalAccess', _76 => _76.forceFlush, 'call', _77 => _77()]))
2033
+ [...this.scopedProviders.values(), this.loggerProvider].map(async (p) => _optionalChain([p, 'optionalAccess', _78 => _78.forceFlush, 'call', _79 => _79()]))
2007
2034
  );
2008
2035
  }
2009
2036
  /**
@@ -2021,7 +2048,7 @@ var LoggingModule = (_class2 = class _LoggingModule {constructor() { _class2.pro
2021
2048
  if (_LoggingModule.instance === this) {
2022
2049
  _LoggingModule.instance = null;
2023
2050
  }
2024
- _chunkXGD5HD5Wcjs.clearEventSink.call(void 0, this);
2051
+ _chunkY7UFS5CAcjs.clearEventSink.call(void 0, this);
2025
2052
  _chunkWC573FCIcjs.logger.debug("Logging module shutdown completed");
2026
2053
  }
2027
2054
  }, _class2.__initStatic(), _class2);
@@ -2109,7 +2136,7 @@ var MetricsModule = (_class3 = class _MetricsModule {constructor() { _class3.pro
2109
2136
  return this.metricsReader;
2110
2137
  }
2111
2138
  async forceFlush() {
2112
- await _optionalChain([this, 'access', _78 => _78.metricsReader, 'optionalAccess', _79 => _79.forceFlush, 'call', _80 => _80()]);
2139
+ await _optionalChain([this, 'access', _80 => _80.metricsReader, 'optionalAccess', _81 => _81.forceFlush, 'call', _82 => _82()]);
2113
2140
  }
2114
2141
  /**
2115
2142
  * Shutdown the metrics module
@@ -2152,7 +2179,7 @@ var BrizzSpanExporter = (_class4 = class {
2152
2179
  const resourceAttrs = {
2153
2180
  ...config.resourceAttributes,
2154
2181
  "service.name": config.appName,
2155
- [BRIZZ_SDK_VERSION]: _chunkJGATEWJBcjs.getSDKVersion.call(void 0, ),
2182
+ [BRIZZ_SDK_VERSION]: _chunkWCUBTLL5cjs.getSDKVersion.call(void 0, ),
2156
2183
  [BRIZZ_SDK_LANGUAGE]: SDK_LANGUAGE
2157
2184
  };
2158
2185
  if (config.environment) {
@@ -2166,7 +2193,7 @@ var BrizzSpanExporter = (_class4 = class {
2166
2193
  }
2167
2194
  /** The service a span reports under: its scoped override, else the configured appName. */
2168
2195
  _serviceNameOf(span) {
2169
- const value = span.attributes[_chunkRV7JIIDGcjs.SERVICE_NAME_ATTRIBUTE];
2196
+ const value = span.attributes[_chunkNF52RMLWcjs.SERVICE_NAME_ATTRIBUTE];
2170
2197
  return typeof value === "string" && value !== "" ? value : this._defaultServiceName;
2171
2198
  }
2172
2199
  _resourceFor(serviceName) {
@@ -2279,8 +2306,8 @@ var BrizzSpanExporter = (_class4 = class {
2279
2306
  }
2280
2307
  async forceFlush() {
2281
2308
  await Promise.all([
2282
- _optionalChain([this, 'access', _81 => _81._delegate, 'access', _82 => _82.forceFlush, 'optionalCall', _83 => _83()]),
2283
- ...[...this._delegates.values()].map(async (delegate) => _optionalChain([delegate, 'access', _84 => _84.forceFlush, 'optionalCall', _85 => _85()]))
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()]))
2284
2311
  ]);
2285
2312
  }
2286
2313
  }, _class4);
@@ -2292,10 +2319,10 @@ var BrizzSpanExporter = (_class4 = class {
2292
2319
 
2293
2320
 
2294
2321
  function applyContextAttributes(span) {
2295
- const sessionProperties = _api.context.active().getValue(_chunkRV7JIIDGcjs.PROPERTIES_CONTEXT_KEY);
2322
+ const sessionProperties = _api.context.active().getValue(_chunkNF52RMLWcjs.PROPERTIES_CONTEXT_KEY);
2296
2323
  if (sessionProperties) {
2297
2324
  for (const [key, value] of Object.entries(sessionProperties)) {
2298
- span.setAttribute(`${_chunkRV7JIIDGcjs.BRIZZ}.${key}`, value);
2325
+ span.setAttribute(`${_chunkNF52RMLWcjs.BRIZZ}.${key}`, value);
2299
2326
  }
2300
2327
  }
2301
2328
  }
@@ -2338,7 +2365,7 @@ var BrizzSimpleSpanProcessor = class extends _sdktrace.SimpleSpanProcessor {
2338
2365
  }
2339
2366
  onEnd(span) {
2340
2367
  restampLangChainSpan(span);
2341
- const maskingConfig = _optionalChain([this, 'access', _86 => _86.config, 'access', _87 => _87.masking, 'optionalAccess', _88 => _88.spanMasking]);
2368
+ const maskingConfig = _optionalChain([this, 'access', _88 => _88.config, 'access', _89 => _89.masking, 'optionalAccess', _90 => _90.spanMasking]);
2342
2369
  if (maskingConfig) {
2343
2370
  maskReadableSpan(span, maskingConfig);
2344
2371
  }
@@ -2357,7 +2384,7 @@ var BrizzBatchSpanProcessor = class extends _sdktrace.BatchSpanProcessor {
2357
2384
  }
2358
2385
  onEnd(span) {
2359
2386
  restampLangChainSpan(span);
2360
- const maskingConfig = _optionalChain([this, 'access', _89 => _89.config, 'access', _90 => _90.masking, 'optionalAccess', _91 => _91.spanMasking]);
2387
+ const maskingConfig = _optionalChain([this, 'access', _91 => _91.config, 'access', _92 => _92.masking, 'optionalAccess', _93 => _93.spanMasking]);
2361
2388
  if (maskingConfig) {
2362
2389
  maskReadableSpan(span, maskingConfig);
2363
2390
  }
@@ -2374,7 +2401,7 @@ function maskReadableSpan(span, config) {
2374
2401
  for (const [k, v] of Object.entries(attrs)) {
2375
2402
  masked[k] = v;
2376
2403
  }
2377
- if (_optionalChain([config, 'access', _92 => _92.rules, 'optionalAccess', _93 => _93.length])) {
2404
+ if (_optionalChain([config, 'access', _94 => _94.rules, 'optionalAccess', _95 => _95.length])) {
2378
2405
  masked = maskAttributes(masked, config.rules);
2379
2406
  }
2380
2407
  if (!config.disableDefaultRules) {
@@ -2446,7 +2473,7 @@ var TracingModule = (_class5 = class _TracingModule {constructor() { _class5.pro
2446
2473
  }
2447
2474
  _chunkWC573FCIcjs.logger.debug("Initializing span processor", {
2448
2475
  disableBatch: config.disableBatch,
2449
- hasMasking: !!_optionalChain([config, 'access', _94 => _94.masking, 'optionalAccess', _95 => _95.spanMasking])
2476
+ hasMasking: !!_optionalChain([config, 'access', _96 => _96.masking, 'optionalAccess', _97 => _97.spanMasking])
2450
2477
  });
2451
2478
  const spanProcessor = config.disableBatch ? new BrizzSimpleSpanProcessor(this.spanExporter, config) : new BrizzBatchSpanProcessor(this.spanExporter, config);
2452
2479
  _chunkWC573FCIcjs.logger.debug("Span processor initialized successfully");
@@ -2490,7 +2517,7 @@ var TracingModule = (_class5 = class _TracingModule {constructor() { _class5.pro
2490
2517
  return this.spanProcessor;
2491
2518
  }
2492
2519
  async forceFlush() {
2493
- await _optionalChain([this, 'access', _96 => _96.spanProcessor, 'optionalAccess', _97 => _97.forceFlush, 'call', _98 => _98()]);
2520
+ await _optionalChain([this, 'access', _98 => _98.spanProcessor, 'optionalAccess', _99 => _99.forceFlush, 'call', _100 => _100()]);
2494
2521
  }
2495
2522
  async shutdown() {
2496
2523
  _chunkWC573FCIcjs.logger.debug("Shutting down tracing module");
@@ -2513,6 +2540,155 @@ function getSpanProcessor() {
2513
2540
  return TracingModule.getInstance().getSpanProcessor();
2514
2541
  }
2515
2542
 
2543
+ // src/internal/trace/decision-call.ts
2544
+
2545
+
2546
+ var tracer = _chunkDC2MFO65cjs.brizzTracerProvider.getTracer("@brizz/sdk/decision-call", _chunkWCUBTLL5cjs.getSDKVersion.call(void 0, ));
2547
+ function decisionCall(options, callback) {
2548
+ const span = startDecisionSpan(options);
2549
+ if (!span) {
2550
+ return callback(describeResultOn(void 0, options.provider));
2551
+ }
2552
+ const callbackContext = _core.suppressTracing.call(void 0, _api.trace.setSpan(_api.context.active(), span));
2553
+ let result;
2554
+ try {
2555
+ result = _api.context.with(
2556
+ callbackContext,
2557
+ callback,
2558
+ void 0,
2559
+ describeResultOn(span, options.provider)
2560
+ );
2561
+ } catch (error) {
2562
+ endWithError(span, error);
2563
+ throw error;
2564
+ }
2565
+ return endWhenSettled(span, result);
2566
+ }
2567
+ function recordDecisionCall(record) {
2568
+ try {
2569
+ const span = startDecisionSpan(record, _nullishCoalesce(record.startTime, () => ( record.endTime)));
2570
+ if (!span) {
2571
+ return;
2572
+ }
2573
+ const call = describeResultOn(span, record.provider);
2574
+ if (record.answers !== void 0) {
2575
+ call.setAnswers(record.answers);
2576
+ }
2577
+ call.setUsage(record);
2578
+ if (record.costUsd !== void 0) {
2579
+ call.setCost(record.costUsd);
2580
+ }
2581
+ span.end(record.endTime);
2582
+ } catch (error) {
2583
+ _chunkWC573FCIcjs.logger.debug(`Brizz decision call: could not record the call: ${String(error)}`);
2584
+ }
2585
+ }
2586
+ function startDecisionSpan(options, startTime) {
2587
+ try {
2588
+ const requestModel = options.requestModel || options.model;
2589
+ 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"
2595
+ };
2596
+ const inputMessages = toJson([
2597
+ {
2598
+ role: "user",
2599
+ parts: [
2600
+ { type: "text", content: text(options.state) },
2601
+ { type: `${options.provider}.questions`, content: options.questions }
2602
+ ]
2603
+ }
2604
+ ]);
2605
+ if (inputMessages !== void 0) {
2606
+ attributes[_chunkNF52RMLWcjs.GEN_AI_INPUT_MESSAGES] = inputMessages;
2607
+ }
2608
+ const sessionId = currentSessionId();
2609
+ if (sessionId) {
2610
+ attributes[_chunkNF52RMLWcjs.GEN_AI_CONVERSATION_ID] = sessionId;
2611
+ }
2612
+ return tracer.startSpan(`${_chunkNF52RMLWcjs.GEN_AI_OPERATION_CLASSIFY} ${requestModel}`, {
2613
+ kind: _api.SpanKind.CLIENT,
2614
+ attributes,
2615
+ startTime
2616
+ });
2617
+ } catch (error) {
2618
+ _chunkWC573FCIcjs.logger.debug(`Brizz decision call: could not start span: ${String(error)}`);
2619
+ return void 0;
2620
+ }
2621
+ }
2622
+ function currentSessionId() {
2623
+ const properties = _api.context.active().getValue(_chunkNF52RMLWcjs.PROPERTIES_CONTEXT_KEY);
2624
+ return _optionalChain([properties, 'optionalAccess', _101 => _101[_chunkNF52RMLWcjs.SESSION_ID]]);
2625
+ }
2626
+ function describeResultOn(span, provider) {
2627
+ const set = (key, value) => {
2628
+ if (!span || value === void 0) {
2629
+ return;
2630
+ }
2631
+ try {
2632
+ span.setAttribute(key, value);
2633
+ } catch (error) {
2634
+ _chunkWC573FCIcjs.logger.debug(`Brizz decision call: could not set ${key}: ${String(error)}`);
2635
+ }
2636
+ };
2637
+ return {
2638
+ setAnswers(answers) {
2639
+ set(
2640
+ _chunkNF52RMLWcjs.GEN_AI_OUTPUT_MESSAGES,
2641
+ toJson([
2642
+ {
2643
+ role: "assistant",
2644
+ parts: [{ type: `${provider}.answers`, content: answers }],
2645
+ finish_reason: "stop"
2646
+ }
2647
+ ])
2648
+ );
2649
+ },
2650
+ 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])));
2653
+ },
2654
+ setCost(costUsd) {
2655
+ set(_chunkNF52RMLWcjs.GEN_AI_USAGE_COST_USD, finiteNumber(costUsd));
2656
+ }
2657
+ };
2658
+ }
2659
+ function endWhenSettled(span, result) {
2660
+ if (typeof _optionalChain([result, 'optionalAccess', _104 => _104.then]) !== "function") {
2661
+ span.end();
2662
+ return result;
2663
+ }
2664
+ return Promise.resolve(result).then(
2665
+ (value) => {
2666
+ span.end();
2667
+ return value;
2668
+ },
2669
+ (error) => {
2670
+ endWithError(span, error);
2671
+ throw error;
2672
+ }
2673
+ );
2674
+ }
2675
+ function endWithError(span, error) {
2676
+ try {
2677
+ span.recordException(error instanceof Error ? error : String(error));
2678
+ span.setStatus({
2679
+ code: _api.SpanStatusCode.ERROR,
2680
+ message: error instanceof Error ? error.message : String(error)
2681
+ });
2682
+ span.setAttribute(_chunkNF52RMLWcjs.ERROR_TYPE, errorType(error));
2683
+ } catch (describeError) {
2684
+ _chunkWC573FCIcjs.logger.debug(`Brizz decision call: could not record the error: ${String(describeError)}`);
2685
+ }
2686
+ span.end();
2687
+ }
2688
+ function finiteNumber(value) {
2689
+ return typeof value === "number" && Number.isFinite(value) ? value : void 0;
2690
+ }
2691
+
2516
2692
  // src/internal/sdk.ts
2517
2693
  function resolveMcpSessionTracking(configured) {
2518
2694
  const fromEnv = process.env["BRIZZ_MCP_SESSION_TRACKING"];
@@ -2547,7 +2723,7 @@ var _Brizz = (_class6 = class __Brizz {constructor() { _class6.prototype.__init1
2547
2723
  */
2548
2724
  setupInstrumentation(options) {
2549
2725
  const registry = InstrumentationRegistry.getInstance();
2550
- _chunkJGATEWJBcjs.configure.call(void 0, resolveMcpSessionTracking(options.mcpSessionTracking));
2726
+ _chunkWCUBTLL5cjs.configure.call(void 0, resolveMcpSessionTracking(options.mcpSessionTracking));
2551
2727
  patchInstalledCallbackManager();
2552
2728
  patchInstalledLangGraph();
2553
2729
  patchInstalledTypeSafe();
@@ -2582,7 +2758,7 @@ var _Brizz = (_class6 = class __Brizz {constructor() { _class6.prototype.__init1
2582
2758
  const resourceAttributes = {
2583
2759
  ...resolvedConfig.resourceAttributes,
2584
2760
  "service.name": resolvedConfig.appName,
2585
- [BRIZZ_SDK_VERSION]: _chunkJGATEWJBcjs.getSDKVersion.call(void 0, ),
2761
+ [BRIZZ_SDK_VERSION]: _chunkWCUBTLL5cjs.getSDKVersion.call(void 0, ),
2586
2762
  [BRIZZ_SDK_LANGUAGE]: SDK_LANGUAGE
2587
2763
  };
2588
2764
  if (resolvedConfig.environment) {
@@ -2592,7 +2768,7 @@ var _Brizz = (_class6 = class __Brizz {constructor() { _class6.prototype.__init1
2592
2768
  resourceAttributes["service.version"] = resolvedConfig.appVersion;
2593
2769
  }
2594
2770
  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));
2595
- const spanProcessors = resolvedConfig.disableSpanExporter ? [] : [new (0, _chunkO2IBZJOJcjs.InterruptPropagator)(), getSpanProcessor()];
2771
+ const spanProcessors = resolvedConfig.disableSpanExporter ? [] : [new (0, _chunk6QXPHZEOcjs.InterruptPropagator)(), getSpanProcessor()];
2596
2772
  if (resolvedConfig.setGlobalTracerProvider) {
2597
2773
  this._tracerProvider = new (0, _sdktrace.TracerProvider)({ resource, spanProcessors });
2598
2774
  this.registerGlobalTracerProvider(this._tracerProvider);
@@ -2826,10 +3002,10 @@ var _Brizz = (_class6 = class __Brizz {constructor() { _class6.prototype.__init1
2826
3002
  }
2827
3003
  try {
2828
3004
  await this.shutdownModules();
2829
- await _optionalChain([this, 'access', _99 => _99._tracerProvider, 'optionalAccess', _100 => _100.forceFlush, 'call', _101 => _101()]);
2830
- await _optionalChain([this, 'access', _102 => _102._tracerProvider, 'optionalAccess', _103 => _103.shutdown, 'call', _104 => _104()]);
2831
- await _optionalChain([this, 'access', _105 => _105._meterProvider, 'optionalAccess', _106 => _106.forceFlush, 'call', _107 => _107()]);
2832
- await _optionalChain([this, 'access', _108 => _108._meterProvider, 'optionalAccess', _109 => _109.shutdown, 'call', _110 => _110()]);
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()]);
2833
3009
  this._initialized = false;
2834
3010
  this._tracerProvider = null;
2835
3011
  this._meterProvider = null;
@@ -2897,4 +3073,6 @@ var Brizz = new _Brizz();
2897
3073
 
2898
3074
 
2899
3075
 
2900
- exports.Brizz = Brizz; exports.DEFAULT_PII_PATTERNS = DEFAULT_PII_PATTERNS; exports.LogLevel = _chunkWC573FCIcjs.LogLevel; exports.Session = _chunkXGD5HD5Wcjs.Session; exports.SessionTitle = _chunkXGD5HD5Wcjs.SessionTitle; exports.SeverityNumber = _api.SeverityNumber; exports.addExternalLink = _chunkXGD5HD5Wcjs.addExternalLink; exports.callWithMessageId = _chunkXGD5HD5Wcjs.callWithMessageId; exports.callWithMute = _chunkXGD5HD5Wcjs.callWithMute; exports.callWithOrganization = _chunkXGD5HD5Wcjs.callWithOrganization; exports.callWithProperties = _chunkXGD5HD5Wcjs.callWithProperties; exports.callWithServiceName = _chunkXGD5HD5Wcjs.callWithServiceName; exports.callWithSessionId = _chunkXGD5HD5Wcjs.callWithSessionId; exports.callWithUser = _chunkXGD5HD5Wcjs.callWithUser; exports.emitEvent = _chunkXGD5HD5Wcjs.emitEvent; exports.emitEventWithSessionId = _chunkXGD5HD5Wcjs.emitEventWithSessionId; exports.getActiveSession = _chunkXGD5HD5Wcjs.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.recordFeedback = _chunkXGD5HD5Wcjs.recordFeedback; exports.recordMetric = _chunkXGD5HD5Wcjs.recordMetric; exports.setAgent = _chunkXGD5HD5Wcjs.setAgent; exports.setCurrentSpanCustomProperties = _chunkXGD5HD5Wcjs.setCurrentSpanCustomProperties; exports.setLogLevel = _chunkWC573FCIcjs.setLogLevel; exports.setMessageId = _chunkXGD5HD5Wcjs.setMessageId; exports.setOrganization = _chunkXGD5HD5Wcjs.setOrganization; exports.setServiceName = _chunkXGD5HD5Wcjs.setServiceName; exports.setSessionId = _chunkXGD5HD5Wcjs.setSessionId; exports.setUser = _chunkXGD5HD5Wcjs.setUser; exports.startAgent = _chunkXGD5HD5Wcjs.startAgent; exports.startSession = _chunkXGD5HD5Wcjs.startSession; exports.startSessionTitle = _chunkXGD5HD5Wcjs.startSessionTitle; exports.withAgent = _chunkXGD5HD5Wcjs.withAgent; exports.withMessageId = _chunkXGD5HD5Wcjs.withMessageId; exports.withMute = _chunkXGD5HD5Wcjs.withMute; exports.withOrganization = _chunkXGD5HD5Wcjs.withOrganization; exports.withProperties = _chunkXGD5HD5Wcjs.withProperties; exports.withServiceName = _chunkXGD5HD5Wcjs.withServiceName; exports.withSessionId = _chunkXGD5HD5Wcjs.withSessionId; exports.withUser = _chunkXGD5HD5Wcjs.withUser;
3076
+
3077
+
3078
+ exports.Brizz = Brizz; exports.DEFAULT_PII_PATTERNS = DEFAULT_PII_PATTERNS; exports.LogLevel = _chunkWC573FCIcjs.LogLevel; exports.Session = _chunkY7UFS5CAcjs.Session; exports.SessionTitle = _chunkY7UFS5CAcjs.SessionTitle; exports.SeverityNumber = _apilogs.SeverityNumber; exports.addExternalLink = _chunkY7UFS5CAcjs.addExternalLink; exports.callWithMessageId = _chunkY7UFS5CAcjs.callWithMessageId; exports.callWithMute = _chunkY7UFS5CAcjs.callWithMute; exports.callWithOrganization = _chunkY7UFS5CAcjs.callWithOrganization; exports.callWithProperties = _chunkY7UFS5CAcjs.callWithProperties; exports.callWithServiceName = _chunkY7UFS5CAcjs.callWithServiceName; exports.callWithSessionId = _chunkY7UFS5CAcjs.callWithSessionId; exports.callWithUser = _chunkY7UFS5CAcjs.callWithUser; exports.decisionCall = decisionCall; exports.emitEvent = _chunkY7UFS5CAcjs.emitEvent; exports.emitEventWithSessionId = _chunkY7UFS5CAcjs.emitEventWithSessionId; exports.getActiveSession = _chunkY7UFS5CAcjs.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 = _chunkY7UFS5CAcjs.recordFeedback; exports.recordMetric = _chunkY7UFS5CAcjs.recordMetric; exports.setAgent = _chunkY7UFS5CAcjs.setAgent; exports.setCurrentSpanCustomProperties = _chunkY7UFS5CAcjs.setCurrentSpanCustomProperties; exports.setLogLevel = _chunkWC573FCIcjs.setLogLevel; exports.setMessageId = _chunkY7UFS5CAcjs.setMessageId; exports.setOrganization = _chunkY7UFS5CAcjs.setOrganization; exports.setServiceName = _chunkY7UFS5CAcjs.setServiceName; exports.setSessionId = _chunkY7UFS5CAcjs.setSessionId; exports.setUser = _chunkY7UFS5CAcjs.setUser; exports.startAgent = _chunkY7UFS5CAcjs.startAgent; exports.startSession = _chunkY7UFS5CAcjs.startSession; exports.startSessionTitle = _chunkY7UFS5CAcjs.startSessionTitle; exports.withAgent = _chunkY7UFS5CAcjs.withAgent; exports.withMessageId = _chunkY7UFS5CAcjs.withMessageId; exports.withMute = _chunkY7UFS5CAcjs.withMute; exports.withOrganization = _chunkY7UFS5CAcjs.withOrganization; exports.withProperties = _chunkY7UFS5CAcjs.withProperties; exports.withServiceName = _chunkY7UFS5CAcjs.withServiceName; exports.withSessionId = _chunkY7UFS5CAcjs.withSessionId; exports.withUser = _chunkY7UFS5CAcjs.withUser;