@brizz/sdk 0.1.33 → 0.1.35

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.
@@ -4,7 +4,7 @@
4
4
  var _chunkUNLNNKZ7cjs = require('./chunk-UNLNNKZ7.cjs');
5
5
 
6
6
 
7
- var _chunk3ITCDKTJcjs = require('./chunk-3ITCDKTJ.cjs');
7
+ var _chunkHZOBDXDScjs = require('./chunk-HZOBDXDS.cjs');
8
8
 
9
9
 
10
10
 
@@ -13,7 +13,7 @@ var _chunk3ITCDKTJcjs = require('./chunk-3ITCDKTJ.cjs');
13
13
  var _chunkWC573FCIcjs = require('./chunk-WC573FCI.cjs');
14
14
 
15
15
 
16
- var _chunkLFLYWZ6Dcjs = require('./chunk-LFLYWZ6D.cjs');
16
+ var _chunkM3UGFLH7cjs = require('./chunk-M3UGFLH7.cjs');
17
17
 
18
18
 
19
19
 
@@ -51,7 +51,20 @@ var _chunkLFLYWZ6Dcjs = require('./chunk-LFLYWZ6D.cjs');
51
51
 
52
52
 
53
53
 
54
- var _chunkLIFLVFK6cjs = require('./chunk-LIFLVFK6.cjs');
54
+
55
+
56
+
57
+
58
+
59
+
60
+
61
+
62
+
63
+
64
+
65
+
66
+
67
+ var _chunkNEF2O7HFcjs = require('./chunk-NEF2O7HF.cjs');
55
68
 
56
69
 
57
70
  var _chunkOBGZSXTJcjs = require('./chunk-OBGZSXTJ.cjs');
@@ -157,11 +170,26 @@ var InstrumentationRegistry = (_class = class _InstrumentationRegistry {construc
157
170
  }
158
171
  })();
159
172
  }
160
- if (_optionalChain([this, 'access', _25 => _25.manualModules, 'optionalAccess', _26 => _26.mcp])) {
173
+ if (_optionalChain([this, 'access', _25 => _25.manualModules, 'optionalAccess', _26 => _26.google_genai])) {
174
+ const genaiModule = this.manualModules.google_genai;
175
+ void (async () => {
176
+ try {
177
+ const { GoogleGenAIInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("./google-genai-LMEZ62FB.cjs")));
178
+ const genaiInst = new GoogleGenAIInstrumentation({ exceptionLogger });
179
+ genaiInst.manuallyInstrument(genaiModule);
180
+ _chunkWC573FCIcjs.logger.debug("Manual instrumentation enabled for Google GenAI");
181
+ } catch (error) {
182
+ _chunkWC573FCIcjs.logger.error(
183
+ `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)}`
184
+ );
185
+ }
186
+ })();
187
+ }
188
+ if (_optionalChain([this, 'access', _27 => _27.manualModules, 'optionalAccess', _28 => _28.mcp])) {
161
189
  const mcpModules = this.manualModules.mcp;
162
190
  void (async () => {
163
191
  try {
164
- const { MCPInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("./mcp-OKSS2R56.cjs")));
192
+ const { MCPInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("./mcp-KAYXU4AU.cjs")));
165
193
  const instrumentation = new MCPInstrumentation({ exceptionLogger });
166
194
  instrumentation.manuallyInstrument(mcpModules);
167
195
  _chunkWC573FCIcjs.logger.debug("Manual instrumentation enabled for MCP");
@@ -648,14 +676,14 @@ var BrizzSimpleLogRecordProcessor = class extends _sdklogs.SimpleLogRecordProces
648
676
  this.config = config;
649
677
  }
650
678
  onEmit(logRecord) {
651
- const maskingConfig = _optionalChain([this, 'access', _27 => _27.config, 'access', _28 => _28.masking, 'optionalAccess', _29 => _29.eventMasking]);
679
+ const maskingConfig = _optionalChain([this, 'access', _29 => _29.config, 'access', _30 => _30.masking, 'optionalAccess', _31 => _31.eventMasking]);
652
680
  if (maskingConfig) {
653
681
  maskLog(logRecord, maskingConfig);
654
682
  }
655
- const associationProperties = _api.context.active().getValue(_chunkLIFLVFK6cjs.PROPERTIES_CONTEXT_KEY);
683
+ const associationProperties = _api.context.active().getValue(_chunkNEF2O7HFcjs.PROPERTIES_CONTEXT_KEY);
656
684
  if (associationProperties) {
657
685
  for (const [key, value] of Object.entries(associationProperties)) {
658
- logRecord.setAttribute(`${_chunkLIFLVFK6cjs.BRIZZ}.${key}`, value);
686
+ logRecord.setAttribute(`${_chunkNEF2O7HFcjs.BRIZZ}.${key}`, value);
659
687
  }
660
688
  }
661
689
  super.onEmit(logRecord);
@@ -668,14 +696,14 @@ var BrizzBatchLogRecordProcessor = class extends _sdklogs.BatchLogRecordProcesso
668
696
  this.config = config;
669
697
  }
670
698
  onEmit(logRecord) {
671
- const maskingConfig = _optionalChain([this, 'access', _30 => _30.config, 'access', _31 => _31.masking, 'optionalAccess', _32 => _32.eventMasking]);
699
+ const maskingConfig = _optionalChain([this, 'access', _32 => _32.config, 'access', _33 => _33.masking, 'optionalAccess', _34 => _34.eventMasking]);
672
700
  if (maskingConfig) {
673
701
  maskLog(logRecord, maskingConfig);
674
702
  }
675
- const associationProperties = _api.context.active().getValue(_chunkLIFLVFK6cjs.PROPERTIES_CONTEXT_KEY);
703
+ const associationProperties = _api.context.active().getValue(_chunkNEF2O7HFcjs.PROPERTIES_CONTEXT_KEY);
676
704
  if (associationProperties) {
677
705
  for (const [key, value] of Object.entries(associationProperties)) {
678
- logRecord.setAttribute(`${_chunkLIFLVFK6cjs.BRIZZ}.${key}`, value);
706
+ logRecord.setAttribute(`${_chunkNEF2O7HFcjs.BRIZZ}.${key}`, value);
679
707
  }
680
708
  }
681
709
  super.onEmit(logRecord);
@@ -702,7 +730,7 @@ function maskLog(logRecord, config) {
702
730
  newAttributes[key] = value;
703
731
  }
704
732
  for (const [key, value] of Object.entries(logRecord.attributes)) {
705
- if (key.startsWith(_chunkLIFLVFK6cjs.INTERNAL_EVENT_PREFIX)) {
733
+ if (key.startsWith(_chunkNEF2O7HFcjs.INTERNAL_EVENT_PREFIX)) {
706
734
  newAttributes[key] = value;
707
735
  }
708
736
  }
@@ -771,7 +799,7 @@ var LoggingModule = (_class2 = class _LoggingModule {constructor() { _class2.pro
771
799
  }
772
800
  _chunkWC573FCIcjs.logger.debug("Initializing log processor", {
773
801
  disableBatch: config.disableBatch,
774
- hasMasking: !!_optionalChain([config, 'access', _33 => _33.masking, 'optionalAccess', _34 => _34.eventMasking])
802
+ hasMasking: !!_optionalChain([config, 'access', _35 => _35.masking, 'optionalAccess', _36 => _36.eventMasking])
775
803
  });
776
804
  this.logProcessor = config.disableBatch ? new BrizzSimpleLogRecordProcessor(this.logExporter, config) : new BrizzBatchLogRecordProcessor(this.logExporter, config);
777
805
  _chunkWC573FCIcjs.logger.debug("Log processor initialized successfully");
@@ -793,7 +821,7 @@ var LoggingModule = (_class2 = class _LoggingModule {constructor() { _class2.pro
793
821
  const resourceAttributes = {
794
822
  ...config.resourceAttributes,
795
823
  "service.name": config.appName,
796
- [BRIZZ_SDK_VERSION]: _chunk3ITCDKTJcjs.getSDKVersion.call(void 0, ),
824
+ [BRIZZ_SDK_VERSION]: _chunkHZOBDXDScjs.getSDKVersion.call(void 0, ),
797
825
  [BRIZZ_SDK_LANGUAGE]: SDK_LANGUAGE
798
826
  };
799
827
  if (config.environment) {
@@ -909,16 +937,16 @@ function setCurrentSpanCustomProperties(properties) {
909
937
  }
910
938
  for (const [key, value] of Object.entries(properties)) {
911
939
  try {
912
- current.setAttribute(`${_chunkLIFLVFK6cjs.BRIZZ}.${key}`, value);
940
+ current.setAttribute(`${_chunkNEF2O7HFcjs.BRIZZ}.${key}`, value);
913
941
  } catch (e) {
914
942
  }
915
943
  }
916
944
  }
917
945
  function callWithProperties(properties, fn, thisArg, ...args) {
918
946
  const base = _api.context.active();
919
- const prev = base.getValue(_chunkLIFLVFK6cjs.PROPERTIES_CONTEXT_KEY);
947
+ const prev = base.getValue(_chunkNEF2O7HFcjs.PROPERTIES_CONTEXT_KEY);
920
948
  const merged = prev ? { ...prev, ...properties } : properties;
921
- const next = base.setValue(_chunkLIFLVFK6cjs.PROPERTIES_CONTEXT_KEY, merged);
949
+ const next = base.setValue(_chunkNEF2O7HFcjs.PROPERTIES_CONTEXT_KEY, merged);
922
950
  return _api.context.with(next, fn, thisArg, ...args);
923
951
  }
924
952
  function withProperties(properties, fn, thisArg) {
@@ -934,31 +962,31 @@ function withProperties(properties, fn, thisArg) {
934
962
  function propagatePropertiesImperatively(properties) {
935
963
  try {
936
964
  const manager = _api.context;
937
- const mgr = _optionalChain([manager, 'access', _35 => _35._getContextManager, 'optionalCall', _36 => _36()]);
938
- const store = _optionalChain([mgr, 'optionalAccess', _37 => _37._asyncLocalStorage]);
965
+ const mgr = _optionalChain([manager, 'access', _37 => _37._getContextManager, 'optionalCall', _38 => _38()]);
966
+ const store = _optionalChain([mgr, 'optionalAccess', _39 => _39._asyncLocalStorage]);
939
967
  if (!store || typeof store.enterWith !== "function") {
940
968
  return;
941
969
  }
942
970
  const base = _api.context.active();
943
- const prev = base.getValue(_chunkLIFLVFK6cjs.PROPERTIES_CONTEXT_KEY);
971
+ const prev = base.getValue(_chunkNEF2O7HFcjs.PROPERTIES_CONTEXT_KEY);
944
972
  const merged = prev ? { ...prev, ...properties } : properties;
945
- store.enterWith(base.setValue(_chunkLIFLVFK6cjs.PROPERTIES_CONTEXT_KEY, merged));
973
+ store.enterWith(base.setValue(_chunkNEF2O7HFcjs.PROPERTIES_CONTEXT_KEY, merged));
946
974
  } catch (e2) {
947
975
  }
948
976
  }
949
977
  function setUser(user) {
950
- const properties = { [_chunkLIFLVFK6cjs.USER_ID]: user.id };
978
+ const properties = { [_chunkNEF2O7HFcjs.USER_ID]: user.id };
951
979
  if (user.email !== void 0) {
952
- properties[_chunkLIFLVFK6cjs.USER_EMAIL] = user.email;
980
+ properties[_chunkNEF2O7HFcjs.USER_EMAIL] = user.email;
953
981
  }
954
982
  if (user.name !== void 0) {
955
- properties[_chunkLIFLVFK6cjs.USER_NAME] = user.name;
983
+ properties[_chunkNEF2O7HFcjs.USER_NAME] = user.name;
956
984
  }
957
985
  if (user.role !== void 0) {
958
- properties[_chunkLIFLVFK6cjs.USER_ROLE] = user.role;
986
+ properties[_chunkNEF2O7HFcjs.USER_ROLE] = user.role;
959
987
  }
960
988
  if (user.plan !== void 0) {
961
- properties[_chunkLIFLVFK6cjs.USER_PLAN] = user.plan;
989
+ properties[_chunkNEF2O7HFcjs.USER_PLAN] = user.plan;
962
990
  }
963
991
  if (user.traits) {
964
992
  for (const [key, value] of Object.entries(user.traits)) {
@@ -972,15 +1000,15 @@ function setUser(user) {
972
1000
  propagatePropertiesImperatively(properties);
973
1001
  }
974
1002
  function setOrganization(org) {
975
- const properties = { [_chunkLIFLVFK6cjs.ORGANIZATION_ID]: org.id };
1003
+ const properties = { [_chunkNEF2O7HFcjs.ORGANIZATION_ID]: org.id };
976
1004
  if (org.name !== void 0) {
977
- properties[_chunkLIFLVFK6cjs.ORGANIZATION_NAME] = org.name;
1005
+ properties[_chunkNEF2O7HFcjs.ORGANIZATION_NAME] = org.name;
978
1006
  }
979
1007
  if (org.plan !== void 0) {
980
- properties[_chunkLIFLVFK6cjs.ORGANIZATION_PLAN] = org.plan;
1008
+ properties[_chunkNEF2O7HFcjs.ORGANIZATION_PLAN] = org.plan;
981
1009
  }
982
1010
  if (org.domain !== void 0) {
983
- properties[_chunkLIFLVFK6cjs.ORGANIZATION_DOMAIN] = org.domain;
1011
+ properties[_chunkNEF2O7HFcjs.ORGANIZATION_DOMAIN] = org.domain;
984
1012
  }
985
1013
  if (org.traits) {
986
1014
  for (const [key, value] of Object.entries(org.traits)) {
@@ -994,23 +1022,23 @@ function setOrganization(org) {
994
1022
  propagatePropertiesImperatively(properties);
995
1023
  }
996
1024
  function setMessageId(id) {
997
- const properties = { [_chunkLIFLVFK6cjs.MESSAGE_ID]: id };
1025
+ const properties = { [_chunkNEF2O7HFcjs.MESSAGE_ID]: id };
998
1026
  setCurrentSpanCustomProperties(properties);
999
1027
  propagatePropertiesImperatively(properties);
1000
1028
  }
1001
1029
  function userProperties(user) {
1002
- const properties = { [_chunkLIFLVFK6cjs.USER_ID]: user.id };
1030
+ const properties = { [_chunkNEF2O7HFcjs.USER_ID]: user.id };
1003
1031
  if (user.email !== void 0) {
1004
- properties[_chunkLIFLVFK6cjs.USER_EMAIL] = user.email;
1032
+ properties[_chunkNEF2O7HFcjs.USER_EMAIL] = user.email;
1005
1033
  }
1006
1034
  if (user.name !== void 0) {
1007
- properties[_chunkLIFLVFK6cjs.USER_NAME] = user.name;
1035
+ properties[_chunkNEF2O7HFcjs.USER_NAME] = user.name;
1008
1036
  }
1009
1037
  if (user.role !== void 0) {
1010
- properties[_chunkLIFLVFK6cjs.USER_ROLE] = user.role;
1038
+ properties[_chunkNEF2O7HFcjs.USER_ROLE] = user.role;
1011
1039
  }
1012
1040
  if (user.plan !== void 0) {
1013
- properties[_chunkLIFLVFK6cjs.USER_PLAN] = user.plan;
1041
+ properties[_chunkNEF2O7HFcjs.USER_PLAN] = user.plan;
1014
1042
  }
1015
1043
  if (user.traits) {
1016
1044
  for (const [key, value] of Object.entries(user.traits)) {
@@ -1023,15 +1051,15 @@ function userProperties(user) {
1023
1051
  return properties;
1024
1052
  }
1025
1053
  function organizationProperties(org) {
1026
- const properties = { [_chunkLIFLVFK6cjs.ORGANIZATION_ID]: org.id };
1054
+ const properties = { [_chunkNEF2O7HFcjs.ORGANIZATION_ID]: org.id };
1027
1055
  if (org.name !== void 0) {
1028
- properties[_chunkLIFLVFK6cjs.ORGANIZATION_NAME] = org.name;
1056
+ properties[_chunkNEF2O7HFcjs.ORGANIZATION_NAME] = org.name;
1029
1057
  }
1030
1058
  if (org.plan !== void 0) {
1031
- properties[_chunkLIFLVFK6cjs.ORGANIZATION_PLAN] = org.plan;
1059
+ properties[_chunkNEF2O7HFcjs.ORGANIZATION_PLAN] = org.plan;
1032
1060
  }
1033
1061
  if (org.domain !== void 0) {
1034
- properties[_chunkLIFLVFK6cjs.ORGANIZATION_DOMAIN] = org.domain;
1062
+ properties[_chunkNEF2O7HFcjs.ORGANIZATION_DOMAIN] = org.domain;
1035
1063
  }
1036
1064
  if (org.traits) {
1037
1065
  for (const [key, value] of Object.entries(org.traits)) {
@@ -1056,19 +1084,19 @@ function withOrganization(org, fn, thisArg) {
1056
1084
  return withProperties(organizationProperties(org), fn, thisArg);
1057
1085
  }
1058
1086
  function callWithMessageId(id, fn, thisArg, ...args) {
1059
- return callWithProperties({ [_chunkLIFLVFK6cjs.MESSAGE_ID]: id }, fn, thisArg, ...args);
1087
+ return callWithProperties({ [_chunkNEF2O7HFcjs.MESSAGE_ID]: id }, fn, thisArg, ...args);
1060
1088
  }
1061
1089
  function withMessageId(id, fn, thisArg) {
1062
- return withProperties({ [_chunkLIFLVFK6cjs.MESSAGE_ID]: id }, fn, thisArg);
1090
+ return withProperties({ [_chunkNEF2O7HFcjs.MESSAGE_ID]: id }, fn, thisArg);
1063
1091
  }
1064
1092
  function muteProperties(options) {
1065
1093
  const { input = true, output = true } = options;
1066
1094
  const properties = {};
1067
1095
  if (input) {
1068
- properties[_chunkLIFLVFK6cjs.MUTE_INPUT] = "true";
1096
+ properties[_chunkNEF2O7HFcjs.MUTE_INPUT] = "true";
1069
1097
  }
1070
1098
  if (output) {
1071
- properties[_chunkLIFLVFK6cjs.MUTE_OUTPUT] = "true";
1099
+ properties[_chunkNEF2O7HFcjs.MUTE_OUTPUT] = "true";
1072
1100
  }
1073
1101
  return properties;
1074
1102
  }
@@ -1079,11 +1107,11 @@ function withMute(options, fn, thisArg) {
1079
1107
  return withProperties(muteProperties(options), fn, thisArg);
1080
1108
  }
1081
1109
  function withSessionId(sessionId, fn, thisArg, extraProperties) {
1082
- const properties = { [_chunkLIFLVFK6cjs.SESSION_ID]: sessionId, ...extraProperties };
1110
+ const properties = { [_chunkNEF2O7HFcjs.SESSION_ID]: sessionId, ...extraProperties };
1083
1111
  return withProperties(properties, fn, thisArg);
1084
1112
  }
1085
1113
  function callWithSessionId(sessionId, fn, thisArg, ...args) {
1086
- return callWithProperties({ [_chunkLIFLVFK6cjs.SESSION_ID]: sessionId }, fn, thisArg, ...args);
1114
+ return callWithProperties({ [_chunkNEF2O7HFcjs.SESSION_ID]: sessionId }, fn, thisArg, ...args);
1087
1115
  }
1088
1116
  var Session = (_class3 = class {
1089
1117
 
@@ -1111,8 +1139,8 @@ var Session = (_class3 = class {
1111
1139
  setInput(text, context4) {
1112
1140
  this.inputs.push(text);
1113
1141
  this.inputContexts.push(_nullishCoalesce(context4, () => ( {})));
1114
- this.span.setAttribute(_chunkLIFLVFK6cjs.SESSION_INPUT, JSON.stringify(this.inputs));
1115
- this.span.setAttribute(_chunkLIFLVFK6cjs.SESSION_INPUT_CONTEXT, JSON.stringify(this.inputContexts));
1142
+ this.span.setAttribute(_chunkNEF2O7HFcjs.SESSION_INPUT, JSON.stringify(this.inputs));
1143
+ this.span.setAttribute(_chunkNEF2O7HFcjs.SESSION_INPUT_CONTEXT, JSON.stringify(this.inputContexts));
1116
1144
  }
1117
1145
  /**
1118
1146
  * Append an assistant turn to session output tracking.
@@ -1127,8 +1155,8 @@ var Session = (_class3 = class {
1127
1155
  setOutput(text, context4) {
1128
1156
  this.outputs.push(text);
1129
1157
  this.outputContexts.push(_nullishCoalesce(context4, () => ( {})));
1130
- this.span.setAttribute(_chunkLIFLVFK6cjs.SESSION_OUTPUT, JSON.stringify(this.outputs));
1131
- this.span.setAttribute(_chunkLIFLVFK6cjs.SESSION_OUTPUT_CONTEXT, JSON.stringify(this.outputContexts));
1158
+ this.span.setAttribute(_chunkNEF2O7HFcjs.SESSION_OUTPUT, JSON.stringify(this.outputs));
1159
+ this.span.setAttribute(_chunkNEF2O7HFcjs.SESSION_OUTPUT_CONTEXT, JSON.stringify(this.outputContexts));
1132
1160
  }
1133
1161
  /**
1134
1162
  * Set the session title on the span.
@@ -1136,7 +1164,7 @@ var Session = (_class3 = class {
1136
1164
  * @param title - The generated title string
1137
1165
  */
1138
1166
  setTitle(title) {
1139
- this.span.setAttribute(_chunkLIFLVFK6cjs.SESSION_TITLE, title);
1167
+ this.span.setAttribute(_chunkNEF2O7HFcjs.SESSION_TITLE, title);
1140
1168
  }
1141
1169
  /**
1142
1170
  * Update custom properties on the session span.
@@ -1146,7 +1174,7 @@ var Session = (_class3 = class {
1146
1174
  */
1147
1175
  updateProperties(properties) {
1148
1176
  for (const [key, value] of Object.entries(properties)) {
1149
- this.span.setAttribute(`${_chunkLIFLVFK6cjs.BRIZZ}.${key}`, value);
1177
+ this.span.setAttribute(`${_chunkNEF2O7HFcjs.BRIZZ}.${key}`, value);
1150
1178
  }
1151
1179
  }
1152
1180
  /**
@@ -1158,21 +1186,21 @@ var Session = (_class3 = class {
1158
1186
  setUser(user) {
1159
1187
  if (user.traits) {
1160
1188
  for (const [key, value] of Object.entries(user.traits)) {
1161
- this.span.setAttribute(`${_chunkLIFLVFK6cjs.BRIZZ}.user.${key}`, value);
1189
+ this.span.setAttribute(`${_chunkNEF2O7HFcjs.BRIZZ}.user.${key}`, value);
1162
1190
  }
1163
1191
  }
1164
- this.span.setAttribute(`${_chunkLIFLVFK6cjs.BRIZZ}.${_chunkLIFLVFK6cjs.USER_ID}`, user.id);
1192
+ this.span.setAttribute(`${_chunkNEF2O7HFcjs.BRIZZ}.${_chunkNEF2O7HFcjs.USER_ID}`, user.id);
1165
1193
  if (user.email !== void 0) {
1166
- this.span.setAttribute(`${_chunkLIFLVFK6cjs.BRIZZ}.${_chunkLIFLVFK6cjs.USER_EMAIL}`, user.email);
1194
+ this.span.setAttribute(`${_chunkNEF2O7HFcjs.BRIZZ}.${_chunkNEF2O7HFcjs.USER_EMAIL}`, user.email);
1167
1195
  }
1168
1196
  if (user.name !== void 0) {
1169
- this.span.setAttribute(`${_chunkLIFLVFK6cjs.BRIZZ}.${_chunkLIFLVFK6cjs.USER_NAME}`, user.name);
1197
+ this.span.setAttribute(`${_chunkNEF2O7HFcjs.BRIZZ}.${_chunkNEF2O7HFcjs.USER_NAME}`, user.name);
1170
1198
  }
1171
1199
  if (user.role !== void 0) {
1172
- this.span.setAttribute(`${_chunkLIFLVFK6cjs.BRIZZ}.${_chunkLIFLVFK6cjs.USER_ROLE}`, user.role);
1200
+ this.span.setAttribute(`${_chunkNEF2O7HFcjs.BRIZZ}.${_chunkNEF2O7HFcjs.USER_ROLE}`, user.role);
1173
1201
  }
1174
1202
  if (user.plan !== void 0) {
1175
- this.span.setAttribute(`${_chunkLIFLVFK6cjs.BRIZZ}.${_chunkLIFLVFK6cjs.USER_PLAN}`, user.plan);
1203
+ this.span.setAttribute(`${_chunkNEF2O7HFcjs.BRIZZ}.${_chunkNEF2O7HFcjs.USER_PLAN}`, user.plan);
1176
1204
  }
1177
1205
  }
1178
1206
  /**
@@ -1184,18 +1212,18 @@ var Session = (_class3 = class {
1184
1212
  setOrganization(org) {
1185
1213
  if (org.traits) {
1186
1214
  for (const [key, value] of Object.entries(org.traits)) {
1187
- this.span.setAttribute(`${_chunkLIFLVFK6cjs.BRIZZ}.organization.${key}`, value);
1215
+ this.span.setAttribute(`${_chunkNEF2O7HFcjs.BRIZZ}.organization.${key}`, value);
1188
1216
  }
1189
1217
  }
1190
- this.span.setAttribute(`${_chunkLIFLVFK6cjs.BRIZZ}.${_chunkLIFLVFK6cjs.ORGANIZATION_ID}`, org.id);
1218
+ this.span.setAttribute(`${_chunkNEF2O7HFcjs.BRIZZ}.${_chunkNEF2O7HFcjs.ORGANIZATION_ID}`, org.id);
1191
1219
  if (org.name !== void 0) {
1192
- this.span.setAttribute(`${_chunkLIFLVFK6cjs.BRIZZ}.${_chunkLIFLVFK6cjs.ORGANIZATION_NAME}`, org.name);
1220
+ this.span.setAttribute(`${_chunkNEF2O7HFcjs.BRIZZ}.${_chunkNEF2O7HFcjs.ORGANIZATION_NAME}`, org.name);
1193
1221
  }
1194
1222
  if (org.plan !== void 0) {
1195
- this.span.setAttribute(`${_chunkLIFLVFK6cjs.BRIZZ}.${_chunkLIFLVFK6cjs.ORGANIZATION_PLAN}`, org.plan);
1223
+ this.span.setAttribute(`${_chunkNEF2O7HFcjs.BRIZZ}.${_chunkNEF2O7HFcjs.ORGANIZATION_PLAN}`, org.plan);
1196
1224
  }
1197
1225
  if (org.domain !== void 0) {
1198
- this.span.setAttribute(`${_chunkLIFLVFK6cjs.BRIZZ}.${_chunkLIFLVFK6cjs.ORGANIZATION_DOMAIN}`, org.domain);
1226
+ this.span.setAttribute(`${_chunkNEF2O7HFcjs.BRIZZ}.${_chunkNEF2O7HFcjs.ORGANIZATION_DOMAIN}`, org.domain);
1199
1227
  }
1200
1228
  }
1201
1229
  /**
@@ -1211,7 +1239,7 @@ var Session = (_class3 = class {
1211
1239
  * (free-form category, defaults to `'generic'`)
1212
1240
  */
1213
1241
  addExternalLink(url, options) {
1214
- emitExternalLink(this.sessionId, url, _optionalChain([options, 'optionalAccess', _38 => _38.title]), _optionalChain([options, 'optionalAccess', _39 => _39.linkType]));
1242
+ emitExternalLink(this.sessionId, url, _optionalChain([options, 'optionalAccess', _40 => _40.title]), _optionalChain([options, 'optionalAccess', _41 => _41.linkType]));
1215
1243
  }
1216
1244
  }, _class3);
1217
1245
  var SessionTitle = class {
@@ -1225,69 +1253,69 @@ var SessionTitle = class {
1225
1253
  * @param title - The generated title string
1226
1254
  */
1227
1255
  setTitle(title) {
1228
- this.span.setAttribute(_chunkLIFLVFK6cjs.SESSION_TITLE, title);
1256
+ this.span.setAttribute(_chunkNEF2O7HFcjs.SESSION_TITLE, title);
1229
1257
  }
1230
1258
  };
1231
1259
  function getActiveSession() {
1232
- return _api.context.active().getValue(_chunkLIFLVFK6cjs.SESSION_OBJECT_CONTEXT_KEY);
1260
+ return _api.context.active().getValue(_chunkNEF2O7HFcjs.SESSION_OBJECT_CONTEXT_KEY);
1233
1261
  }
1234
1262
  function resolveSessionIdFromContext() {
1235
1263
  const active = getActiveSession();
1236
1264
  if (active) {
1237
1265
  return active.sessionId;
1238
1266
  }
1239
- const props = _api.context.active().getValue(_chunkLIFLVFK6cjs.PROPERTIES_CONTEXT_KEY);
1240
- return _optionalChain([props, 'optionalAccess', _40 => _40[_chunkLIFLVFK6cjs.SESSION_ID]]);
1267
+ const props = _api.context.active().getValue(_chunkNEF2O7HFcjs.PROPERTIES_CONTEXT_KEY);
1268
+ return _optionalChain([props, 'optionalAccess', _42 => _42[_chunkNEF2O7HFcjs.SESSION_ID]]);
1241
1269
  }
1242
1270
  function resolveMessageIdFromContext() {
1243
- const props = _api.context.active().getValue(_chunkLIFLVFK6cjs.PROPERTIES_CONTEXT_KEY);
1244
- return _optionalChain([props, 'optionalAccess', _41 => _41[_chunkLIFLVFK6cjs.MESSAGE_ID]]);
1271
+ const props = _api.context.active().getValue(_chunkNEF2O7HFcjs.PROPERTIES_CONTEXT_KEY);
1272
+ return _optionalChain([props, 'optionalAccess', _43 => _43[_chunkNEF2O7HFcjs.MESSAGE_ID]]);
1245
1273
  }
1246
1274
  function emitExternalLink(sessionId, url, title, linkType) {
1247
1275
  try {
1248
- emitEventWithSessionId(sessionId, _chunkLIFLVFK6cjs.EXTERNAL_LINK_EVENT_NAME, {
1249
- [_chunkLIFLVFK6cjs.EXTERNAL_LINK_URL]: url,
1250
- [_chunkLIFLVFK6cjs.EXTERNAL_LINK_TITLE]: _nullishCoalesce(title, () => ( "")),
1251
- [_chunkLIFLVFK6cjs.EXTERNAL_LINK_TYPE]: _nullishCoalesce(linkType, () => ( "generic"))
1276
+ emitEventWithSessionId(sessionId, _chunkNEF2O7HFcjs.EXTERNAL_LINK_EVENT_NAME, {
1277
+ [_chunkNEF2O7HFcjs.EXTERNAL_LINK_URL]: url,
1278
+ [_chunkNEF2O7HFcjs.EXTERNAL_LINK_TITLE]: _nullishCoalesce(title, () => ( "")),
1279
+ [_chunkNEF2O7HFcjs.EXTERNAL_LINK_TYPE]: _nullishCoalesce(linkType, () => ( "generic"))
1252
1280
  });
1253
1281
  } catch (error) {
1254
1282
  _chunkWC573FCIcjs.logger.warn("addExternalLink: failed to emit external link", error);
1255
1283
  }
1256
1284
  }
1257
1285
  function addExternalLink(url, options) {
1258
- const sessionId = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _42 => _42.sessionId]), () => ( resolveSessionIdFromContext()));
1286
+ const sessionId = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _44 => _44.sessionId]), () => ( resolveSessionIdFromContext()));
1259
1287
  if (!sessionId) {
1260
1288
  _chunkWC573FCIcjs.logger.warn(
1261
1289
  "addExternalLink called without a resolvable session id; link dropped. Pass options.sessionId or call inside a startSession/callWithSessionId scope."
1262
1290
  );
1263
1291
  return;
1264
1292
  }
1265
- emitExternalLink(sessionId, url, _optionalChain([options, 'optionalAccess', _43 => _43.title]), _optionalChain([options, 'optionalAccess', _44 => _44.linkType]));
1293
+ emitExternalLink(sessionId, url, _optionalChain([options, 'optionalAccess', _45 => _45.title]), _optionalChain([options, 'optionalAccess', _46 => _46.linkType]));
1266
1294
  }
1267
1295
  function recordFeedback(type, options) {
1268
- const attributes = { [_chunkLIFLVFK6cjs.FEEDBACK_TYPE]: type };
1269
- if (_optionalChain([options, 'optionalAccess', _45 => _45.score]) !== void 0) {
1270
- attributes[_chunkLIFLVFK6cjs.FEEDBACK_SCORE] = options.score;
1296
+ const eventAttributes = { [_chunkNEF2O7HFcjs.FEEDBACK_TYPE]: type };
1297
+ if (_optionalChain([options, 'optionalAccess', _47 => _47.score]) !== void 0) {
1298
+ eventAttributes[_chunkNEF2O7HFcjs.FEEDBACK_SCORE] = options.score;
1271
1299
  }
1272
- if (_optionalChain([options, 'optionalAccess', _46 => _46.reason]) !== void 0) {
1273
- attributes[_chunkLIFLVFK6cjs.FEEDBACK_REASON] = options.reason;
1300
+ if (_optionalChain([options, 'optionalAccess', _48 => _48.reason]) !== void 0) {
1301
+ eventAttributes[_chunkNEF2O7HFcjs.FEEDBACK_REASON] = options.reason;
1274
1302
  }
1275
- if (_optionalChain([options, 'optionalAccess', _47 => _47.comment]) !== void 0) {
1276
- attributes[_chunkLIFLVFK6cjs.FEEDBACK_COMMENT] = options.comment;
1303
+ if (_optionalChain([options, 'optionalAccess', _49 => _49.comment]) !== void 0) {
1304
+ eventAttributes[_chunkNEF2O7HFcjs.FEEDBACK_COMMENT] = options.comment;
1277
1305
  }
1278
- if (_optionalChain([options, 'optionalAccess', _48 => _48.source]) !== void 0) {
1279
- attributes[_chunkLIFLVFK6cjs.FEEDBACK_SOURCE] = options.source;
1306
+ if (_optionalChain([options, 'optionalAccess', _50 => _50.source]) !== void 0) {
1307
+ eventAttributes[_chunkNEF2O7HFcjs.FEEDBACK_SOURCE] = options.source;
1280
1308
  }
1281
- if (_optionalChain([options, 'optionalAccess', _49 => _49.traits])) {
1282
- for (const [key, value] of Object.entries(options.traits)) {
1283
- const k = `${_chunkLIFLVFK6cjs.FEEDBACK_ATTR_PREFIX}${key}`;
1284
- if (attributes[k] === void 0) {
1285
- attributes[k] = value;
1309
+ if (_optionalChain([options, 'optionalAccess', _51 => _51.attributes])) {
1310
+ for (const [key, value] of Object.entries(options.attributes)) {
1311
+ const k = `${_chunkNEF2O7HFcjs.FEEDBACK_ATTR_PREFIX}${key}`;
1312
+ if (eventAttributes[k] === void 0) {
1313
+ eventAttributes[k] = value;
1286
1314
  }
1287
1315
  }
1288
1316
  }
1289
- const messageId = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _50 => _50.messageId]), () => ( resolveMessageIdFromContext()));
1290
- const sessionId = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _51 => _51.sessionId]), () => ( resolveSessionIdFromContext()));
1317
+ const messageId = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _52 => _52.messageId]), () => ( resolveMessageIdFromContext()));
1318
+ const sessionId = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _53 => _53.sessionId]), () => ( resolveSessionIdFromContext()));
1291
1319
  if (messageId === void 0 && sessionId === void 0) {
1292
1320
  _chunkWC573FCIcjs.logger.warn(
1293
1321
  "recordFeedback called with no resolvable message id or session id; the feedback cannot be attributed to a message or conversation. Pass options.messageId / options.sessionId or call inside a startSession/callWithMessageId scope."
@@ -1295,36 +1323,158 @@ function recordFeedback(type, options) {
1295
1323
  }
1296
1324
  const anchor = {};
1297
1325
  if (messageId !== void 0) {
1298
- anchor[_chunkLIFLVFK6cjs.MESSAGE_ID] = messageId;
1326
+ anchor[_chunkNEF2O7HFcjs.MESSAGE_ID] = messageId;
1299
1327
  }
1300
1328
  if (sessionId !== void 0) {
1301
- anchor[_chunkLIFLVFK6cjs.SESSION_ID] = sessionId;
1329
+ anchor[_chunkNEF2O7HFcjs.SESSION_ID] = sessionId;
1302
1330
  }
1303
1331
  try {
1304
1332
  if (Object.keys(anchor).length === 0) {
1305
- emitEvent(_chunkLIFLVFK6cjs.FEEDBACK_EVENT_NAME, attributes);
1333
+ emitEvent(_chunkNEF2O7HFcjs.FEEDBACK_EVENT_NAME, eventAttributes);
1306
1334
  } else {
1307
- callWithProperties(anchor, () => emitEvent(_chunkLIFLVFK6cjs.FEEDBACK_EVENT_NAME, attributes));
1335
+ callWithProperties(anchor, () => emitEvent(_chunkNEF2O7HFcjs.FEEDBACK_EVENT_NAME, eventAttributes));
1308
1336
  }
1309
1337
  } catch (error) {
1310
1338
  _chunkWC573FCIcjs.logger.warn("recordFeedback: failed to emit feedback event", error);
1311
1339
  }
1312
1340
  }
1341
+ var METRIC_NAME_PATTERN = /^[a-z][a-z0-9_.-]{0,63}$/;
1342
+ var METRIC_COMMENT_MAX_LEN = 4096;
1343
+ var METRIC_ATTRIBUTES_MAX = 20;
1344
+ var METRIC_ATTRIBUTE_VALUE_MAX_LEN = 256;
1345
+ function recordMetric(options) {
1346
+ try {
1347
+ recordMetricImpl(options);
1348
+ } catch (error) {
1349
+ _chunkWC573FCIcjs.logger.warn(`recordMetric(${JSON.stringify(_optionalChain([options, 'optionalAccess', _54 => _54.name]))}) failed; metric dropped.`, error);
1350
+ }
1351
+ }
1352
+ function recordMetricImpl(options) {
1353
+ const name = typeof options.name === "string" ? options.name.toLowerCase() : "";
1354
+ if (!METRIC_NAME_PATTERN.test(name)) {
1355
+ _chunkWC573FCIcjs.logger.warn(
1356
+ `recordMetric called with an invalid name ${JSON.stringify(options.name)}; metric dropped. Names must match ${METRIC_NAME_PATTERN.source} after lowercasing.`
1357
+ );
1358
+ return;
1359
+ }
1360
+ if (_chunkNEF2O7HFcjs.RESERVED_METRIC_NAMES.has(name)) {
1361
+ _chunkWC573FCIcjs.logger.warn(
1362
+ `recordMetric called with the reserved name ${JSON.stringify(name)}; metric dropped. Brizz computes this metric itself \u2014 pick a different name.`
1363
+ );
1364
+ return;
1365
+ }
1366
+ const { value } = options;
1367
+ let numericValue;
1368
+ if (typeof value === "boolean") {
1369
+ numericValue = value ? 1 : 0;
1370
+ } else if (typeof value === "number" && Number.isFinite(value)) {
1371
+ numericValue = value;
1372
+ } else {
1373
+ _chunkWC573FCIcjs.logger.warn(
1374
+ `recordMetric(${name}) called with a non-finite or non-numeric value ${JSON.stringify(value)}; metric dropped.`
1375
+ );
1376
+ return;
1377
+ }
1378
+ const eventAttributes = {
1379
+ [_chunkNEF2O7HFcjs.METRIC_NAME]: name,
1380
+ [_chunkNEF2O7HFcjs.METRIC_VALUE]: numericValue
1381
+ };
1382
+ if (options.unit !== void 0) {
1383
+ eventAttributes[_chunkNEF2O7HFcjs.METRIC_UNIT] = options.unit;
1384
+ }
1385
+ if (options.minValue !== void 0) {
1386
+ eventAttributes[_chunkNEF2O7HFcjs.METRIC_MIN] = options.minValue;
1387
+ }
1388
+ if (options.maxValue !== void 0) {
1389
+ eventAttributes[_chunkNEF2O7HFcjs.METRIC_MAX] = options.maxValue;
1390
+ }
1391
+ if (options.comment !== void 0) {
1392
+ let comment = options.comment;
1393
+ if (comment.length > METRIC_COMMENT_MAX_LEN) {
1394
+ _chunkWC573FCIcjs.logger.warn(
1395
+ `recordMetric(${name}) comment exceeds ${METRIC_COMMENT_MAX_LEN} characters; truncated.`
1396
+ );
1397
+ comment = comment.slice(0, METRIC_COMMENT_MAX_LEN);
1398
+ }
1399
+ eventAttributes[_chunkNEF2O7HFcjs.METRIC_COMMENT] = comment;
1400
+ }
1401
+ if (options.polarity !== void 0) {
1402
+ const polarity = options.polarity;
1403
+ if (polarity === _chunkNEF2O7HFcjs.METRIC_POLARITY_POSITIVE || polarity === _chunkNEF2O7HFcjs.METRIC_POLARITY_NEGATIVE) {
1404
+ eventAttributes[_chunkNEF2O7HFcjs.METRIC_POLARITY] = polarity;
1405
+ } else {
1406
+ _chunkWC573FCIcjs.logger.warn(
1407
+ `recordMetric(${name}) called with an invalid polarity ${JSON.stringify(polarity)}; expected '${_chunkNEF2O7HFcjs.METRIC_POLARITY_POSITIVE}' or '${_chunkNEF2O7HFcjs.METRIC_POLARITY_NEGATIVE}'. Emitting the metric without it.`
1408
+ );
1409
+ }
1410
+ }
1411
+ if (options.timestamp !== void 0) {
1412
+ if (Number.isFinite(options.timestamp.getTime())) {
1413
+ eventAttributes[_chunkNEF2O7HFcjs.METRIC_TIMESTAMP] = options.timestamp.toISOString();
1414
+ } else {
1415
+ _chunkWC573FCIcjs.logger.warn(
1416
+ `recordMetric(${name}) called with an invalid timestamp; emitting the metric without it.`
1417
+ );
1418
+ }
1419
+ }
1420
+ if (options.attributes) {
1421
+ let accepted = 0;
1422
+ for (const [key, attrValue] of Object.entries(options.attributes)) {
1423
+ if (accepted >= METRIC_ATTRIBUTES_MAX) {
1424
+ _chunkWC573FCIcjs.logger.warn(
1425
+ `recordMetric(${name}) called with more than ${METRIC_ATTRIBUTES_MAX} attributes; the excess was dropped.`
1426
+ );
1427
+ break;
1428
+ }
1429
+ const normalizedKey = key.toLowerCase();
1430
+ if (!METRIC_NAME_PATTERN.test(normalizedKey)) {
1431
+ _chunkWC573FCIcjs.logger.warn(
1432
+ `recordMetric(${name}) called with an invalid attribute key ${JSON.stringify(key)}; that attribute was dropped. Keys must match ${METRIC_NAME_PATTERN.source} after lowercasing.`
1433
+ );
1434
+ continue;
1435
+ }
1436
+ let text = typeof attrValue === "string" ? attrValue : String(attrValue);
1437
+ if (text.length > METRIC_ATTRIBUTE_VALUE_MAX_LEN) {
1438
+ _chunkWC573FCIcjs.logger.warn(
1439
+ `recordMetric(${name}) attribute ${JSON.stringify(normalizedKey)} exceeds ${METRIC_ATTRIBUTE_VALUE_MAX_LEN} characters; truncated.`
1440
+ );
1441
+ text = text.slice(0, METRIC_ATTRIBUTE_VALUE_MAX_LEN);
1442
+ }
1443
+ eventAttributes[`${_chunkNEF2O7HFcjs.METRIC_ATTRIBUTE_PREFIX}${normalizedKey}`] = text;
1444
+ accepted += 1;
1445
+ }
1446
+ }
1447
+ const sessionId = _nullishCoalesce(options.sessionId, () => ( resolveSessionIdFromContext()));
1448
+ if (sessionId === void 0) {
1449
+ _chunkWC573FCIcjs.logger.warn(
1450
+ `recordMetric(${name}) called with no resolvable session id; the metric cannot be attributed to a conversation and is dropped. Pass options.sessionId or call inside a startSession/callWithSessionId scope.`
1451
+ );
1452
+ return;
1453
+ }
1454
+ try {
1455
+ callWithProperties(
1456
+ { [_chunkNEF2O7HFcjs.SESSION_ID]: sessionId },
1457
+ () => emitEvent(_chunkNEF2O7HFcjs.METRIC_EVENT_NAME, eventAttributes)
1458
+ );
1459
+ } catch (error) {
1460
+ _chunkWC573FCIcjs.logger.warn("recordMetric: failed to emit metric event", error);
1461
+ }
1462
+ }
1313
1463
  function startSession(sessionId, callback, extraProperties, options) {
1314
- const isTitle = _optionalChain([options, 'optionalAccess', _52 => _52.mode]) === "title";
1315
- const spanName = isTitle ? _chunkLIFLVFK6cjs.SESSION_TITLE_SPAN_NAME : _chunkLIFLVFK6cjs.SESSION_SPAN_NAME;
1464
+ const isTitle = _optionalChain([options, 'optionalAccess', _55 => _55.mode]) === "title";
1465
+ const spanName = isTitle ? _chunkNEF2O7HFcjs.SESSION_TITLE_SPAN_NAME : _chunkNEF2O7HFcjs.SESSION_SPAN_NAME;
1316
1466
  const tracer = _api.trace.getTracer("@brizz/sdk");
1317
1467
  return tracer.startActiveSpan(spanName, (span) => {
1318
- span.setAttribute(`${_chunkLIFLVFK6cjs.BRIZZ}.${_chunkLIFLVFK6cjs.SESSION_ID}`, sessionId);
1468
+ span.setAttribute(`${_chunkNEF2O7HFcjs.BRIZZ}.${_chunkNEF2O7HFcjs.SESSION_ID}`, sessionId);
1319
1469
  if (extraProperties) {
1320
1470
  for (const [key, value] of Object.entries(extraProperties)) {
1321
- span.setAttribute(`${_chunkLIFLVFK6cjs.BRIZZ}.${key}`, value);
1471
+ span.setAttribute(`${_chunkNEF2O7HFcjs.BRIZZ}.${key}`, value);
1322
1472
  }
1323
1473
  }
1324
1474
  const session = new Session(sessionId, span);
1325
- const contextProperties = { [_chunkLIFLVFK6cjs.SESSION_ID]: sessionId };
1475
+ const contextProperties = { [_chunkNEF2O7HFcjs.SESSION_ID]: sessionId };
1326
1476
  if (isTitle) {
1327
- contextProperties[_chunkLIFLVFK6cjs.SESSION_TITLE_GENERATION] = "true";
1477
+ contextProperties[_chunkNEF2O7HFcjs.SESSION_TITLE_GENERATION] = "true";
1328
1478
  }
1329
1479
  if (extraProperties) {
1330
1480
  for (const [key, value] of Object.entries(extraProperties)) {
@@ -1332,7 +1482,7 @@ function startSession(sessionId, callback, extraProperties, options) {
1332
1482
  }
1333
1483
  }
1334
1484
  return callWithProperties(contextProperties, () => {
1335
- const sessionCtx = _api.context.active().setValue(_chunkLIFLVFK6cjs.SESSION_OBJECT_CONTEXT_KEY, session);
1485
+ const sessionCtx = _api.context.active().setValue(_chunkNEF2O7HFcjs.SESSION_OBJECT_CONTEXT_KEY, session);
1336
1486
  return _api.context.with(sessionCtx, () => {
1337
1487
  try {
1338
1488
  const result = callback(session);
@@ -1360,16 +1510,16 @@ function startSession(sessionId, callback, extraProperties, options) {
1360
1510
  });
1361
1511
  }
1362
1512
  function startSessionTitle(callback, options) {
1363
- const resolvedSessionId = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _53 => _53.sessionId]), () => ( _optionalChain([getActiveSession, 'call', _54 => _54(), 'optionalAccess', _55 => _55.sessionId])));
1513
+ const resolvedSessionId = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _56 => _56.sessionId]), () => ( _optionalChain([getActiveSession, 'call', _57 => _57(), 'optionalAccess', _58 => _58.sessionId])));
1364
1514
  const tracer = _api.trace.getTracer("@brizz/sdk");
1365
- return tracer.startActiveSpan(_chunkLIFLVFK6cjs.SESSION_TITLE_SPAN_NAME, (span) => {
1515
+ return tracer.startActiveSpan(_chunkNEF2O7HFcjs.SESSION_TITLE_SPAN_NAME, (span) => {
1366
1516
  if (resolvedSessionId) {
1367
- span.setAttribute(`${_chunkLIFLVFK6cjs.BRIZZ}.${_chunkLIFLVFK6cjs.SESSION_ID}`, resolvedSessionId);
1517
+ span.setAttribute(`${_chunkNEF2O7HFcjs.BRIZZ}.${_chunkNEF2O7HFcjs.SESSION_ID}`, resolvedSessionId);
1368
1518
  }
1369
1519
  const sessionTitle = new SessionTitle(span);
1370
- const properties = { [_chunkLIFLVFK6cjs.SESSION_TITLE_GENERATION]: "true" };
1520
+ const properties = { [_chunkNEF2O7HFcjs.SESSION_TITLE_GENERATION]: "true" };
1371
1521
  if (resolvedSessionId) {
1372
- properties[_chunkLIFLVFK6cjs.SESSION_ID] = resolvedSessionId;
1522
+ properties[_chunkNEF2O7HFcjs.SESSION_ID] = resolvedSessionId;
1373
1523
  }
1374
1524
  return callWithProperties(properties, () => {
1375
1525
  try {
@@ -1514,7 +1664,7 @@ var BrizzSpanExporter = class {
1514
1664
  const resourceAttrs = {
1515
1665
  ...config.resourceAttributes,
1516
1666
  "service.name": config.appName,
1517
- [BRIZZ_SDK_VERSION]: _chunk3ITCDKTJcjs.getSDKVersion.call(void 0, ),
1667
+ [BRIZZ_SDK_VERSION]: _chunkHZOBDXDScjs.getSDKVersion.call(void 0, ),
1518
1668
  [BRIZZ_SDK_LANGUAGE]: SDK_LANGUAGE
1519
1669
  };
1520
1670
  if (config.environment) {
@@ -1566,7 +1716,7 @@ var BrizzSpanExporter = class {
1566
1716
  return this._delegate.shutdown();
1567
1717
  }
1568
1718
  async forceFlush() {
1569
- return _optionalChain([this, 'access', _56 => _56._delegate, 'access', _57 => _57.forceFlush, 'optionalCall', _58 => _58()]);
1719
+ return _optionalChain([this, 'access', _59 => _59._delegate, 'access', _60 => _60.forceFlush, 'optionalCall', _61 => _61()]);
1570
1720
  }
1571
1721
  };
1572
1722
 
@@ -1577,10 +1727,10 @@ var BrizzSpanExporter = class {
1577
1727
 
1578
1728
  var _sdktracebase = require('@opentelemetry/sdk-trace-base');
1579
1729
  function applyContextAttributes(span) {
1580
- const sessionProperties = _api.context.active().getValue(_chunkLIFLVFK6cjs.PROPERTIES_CONTEXT_KEY);
1730
+ const sessionProperties = _api.context.active().getValue(_chunkNEF2O7HFcjs.PROPERTIES_CONTEXT_KEY);
1581
1731
  if (sessionProperties) {
1582
1732
  for (const [key, value] of Object.entries(sessionProperties)) {
1583
- span.setAttribute(`${_chunkLIFLVFK6cjs.BRIZZ}.${key}`, value);
1733
+ span.setAttribute(`${_chunkNEF2O7HFcjs.BRIZZ}.${key}`, value);
1584
1734
  }
1585
1735
  }
1586
1736
  }
@@ -1601,7 +1751,7 @@ var BrizzSimpleSpanProcessor = class extends _sdktracebase.SimpleSpanProcessor {
1601
1751
  super.onStart(span, parentContext);
1602
1752
  }
1603
1753
  onEnd(span) {
1604
- const maskingConfig = _optionalChain([this, 'access', _59 => _59.config, 'access', _60 => _60.masking, 'optionalAccess', _61 => _61.spanMasking]);
1754
+ const maskingConfig = _optionalChain([this, 'access', _62 => _62.config, 'access', _63 => _63.masking, 'optionalAccess', _64 => _64.spanMasking]);
1605
1755
  if (maskingConfig) {
1606
1756
  maskReadableSpan(span, maskingConfig);
1607
1757
  }
@@ -1619,7 +1769,7 @@ var BrizzBatchSpanProcessor = class extends _sdktracebase.BatchSpanProcessor {
1619
1769
  super.onStart(span, parentContext);
1620
1770
  }
1621
1771
  onEnd(span) {
1622
- const maskingConfig = _optionalChain([this, 'access', _62 => _62.config, 'access', _63 => _63.masking, 'optionalAccess', _64 => _64.spanMasking]);
1772
+ const maskingConfig = _optionalChain([this, 'access', _65 => _65.config, 'access', _66 => _66.masking, 'optionalAccess', _67 => _67.spanMasking]);
1623
1773
  if (maskingConfig) {
1624
1774
  maskReadableSpan(span, maskingConfig);
1625
1775
  }
@@ -1699,7 +1849,7 @@ var TracingModule = (_class5 = class _TracingModule {constructor() { _class5.pro
1699
1849
  }
1700
1850
  _chunkWC573FCIcjs.logger.debug("Initializing span processor", {
1701
1851
  disableBatch: config.disableBatch,
1702
- hasMasking: !!_optionalChain([config, 'access', _65 => _65.masking, 'optionalAccess', _66 => _66.spanMasking])
1852
+ hasMasking: !!_optionalChain([config, 'access', _68 => _68.masking, 'optionalAccess', _69 => _69.spanMasking])
1703
1853
  });
1704
1854
  const spanProcessor = config.disableBatch ? new BrizzSimpleSpanProcessor(this.spanExporter, config) : new BrizzBatchSpanProcessor(this.spanExporter, config);
1705
1855
  _chunkWC573FCIcjs.logger.debug("Span processor initialized successfully");
@@ -1779,7 +1929,7 @@ var _sdktracenode = require('@opentelemetry/sdk-trace-node');
1779
1929
 
1780
1930
  // src/internal/config.ts
1781
1931
  function resolveConfig(options) {
1782
- const envLogLevel = process.env["BRIZZ_LOG_LEVEL"] || _optionalChain([options, 'access', _67 => _67.logLevel, 'optionalAccess', _68 => _68.toString, 'call', _69 => _69()]) || _chunkWC573FCIcjs.DEFAULT_LOG_LEVEL.toString();
1932
+ const envLogLevel = process.env["BRIZZ_LOG_LEVEL"] || _optionalChain([options, 'access', _70 => _70.logLevel, 'optionalAccess', _71 => _71.toString, 'call', _72 => _72()]) || _chunkWC573FCIcjs.DEFAULT_LOG_LEVEL.toString();
1783
1933
  let resolvedLogLevel;
1784
1934
  if (envLogLevel) {
1785
1935
  resolvedLogLevel = _chunkWC573FCIcjs.parseLogLevel.call(void 0, envLogLevel);
@@ -1950,7 +2100,7 @@ var _Brizz = (_class6 = class __Brizz {constructor() { _class6.prototype.__init1
1950
2100
  const resourceAttributes = {
1951
2101
  ...resolvedConfig.resourceAttributes,
1952
2102
  "service.name": resolvedConfig.appName,
1953
- [BRIZZ_SDK_VERSION]: _chunk3ITCDKTJcjs.getSDKVersion.call(void 0, ),
2103
+ [BRIZZ_SDK_VERSION]: _chunkHZOBDXDScjs.getSDKVersion.call(void 0, ),
1954
2104
  [BRIZZ_SDK_LANGUAGE]: SDK_LANGUAGE
1955
2105
  };
1956
2106
  if (resolvedConfig.environment) {
@@ -1962,7 +2112,7 @@ var _Brizz = (_class6 = class __Brizz {constructor() { _class6.prototype.__init1
1962
2112
  const resource = _resources.defaultResource.call(void 0, ).merge(_resources.detectResources.call(void 0, { detectors: [_resources.envDetector, _resources.hostDetector, _resources.processDetector] })).merge(_resources.resourceFromAttributes.call(void 0, resourceAttributes));
1963
2113
  this._tracerProvider = new (0, _sdktracenode.NodeTracerProvider)({
1964
2114
  resource,
1965
- spanProcessors: resolvedConfig.disableSpanExporter ? [] : [new (0, _chunkLFLYWZ6Dcjs.InterruptPropagator)(), getSpanProcessor()]
2115
+ spanProcessors: resolvedConfig.disableSpanExporter ? [] : [new (0, _chunkM3UGFLH7cjs.InterruptPropagator)(), getSpanProcessor()]
1966
2116
  });
1967
2117
  this._tracerProvider.register();
1968
2118
  this._meterProvider = new (0, _sdkmetrics.MeterProvider)({ resource, readers: [getMetricsReader()] });
@@ -2098,10 +2248,10 @@ var _Brizz = (_class6 = class __Brizz {constructor() { _class6.prototype.__init1
2098
2248
  }
2099
2249
  try {
2100
2250
  await this.shutdownModules();
2101
- await _optionalChain([this, 'access', _70 => _70._tracerProvider, 'optionalAccess', _71 => _71.forceFlush, 'call', _72 => _72()]);
2102
- await _optionalChain([this, 'access', _73 => _73._tracerProvider, 'optionalAccess', _74 => _74.shutdown, 'call', _75 => _75()]);
2103
- await _optionalChain([this, 'access', _76 => _76._meterProvider, 'optionalAccess', _77 => _77.forceFlush, 'call', _78 => _78()]);
2104
- await _optionalChain([this, 'access', _79 => _79._meterProvider, 'optionalAccess', _80 => _80.shutdown, 'call', _81 => _81()]);
2251
+ await _optionalChain([this, 'access', _73 => _73._tracerProvider, 'optionalAccess', _74 => _74.forceFlush, 'call', _75 => _75()]);
2252
+ await _optionalChain([this, 'access', _76 => _76._tracerProvider, 'optionalAccess', _77 => _77.shutdown, 'call', _78 => _78()]);
2253
+ await _optionalChain([this, 'access', _79 => _79._meterProvider, 'optionalAccess', _80 => _80.forceFlush, 'call', _81 => _81()]);
2254
+ await _optionalChain([this, 'access', _82 => _82._meterProvider, 'optionalAccess', _83 => _83.shutdown, 'call', _84 => _84()]);
2105
2255
  this._initialized = false;
2106
2256
  this._tracerProvider = null;
2107
2257
  this._meterProvider = null;
@@ -2130,7 +2280,7 @@ function detectRuntime() {
2130
2280
  const supportsLoaderAPI = (_nullishCoalesce(major, () => ( 0))) >= 21 || (_nullishCoalesce(major, () => ( 0))) === 20 && (_nullishCoalesce(minor, () => ( 0))) >= 6 || (_nullishCoalesce(major, () => ( 0))) === 18 && (_nullishCoalesce(minor, () => ( 0))) >= 19;
2131
2281
  const supportsRegister = (
2132
2282
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
2133
- !!_optionalChain([process, 'access', _82 => _82.features, 'optionalAccess', _83 => _83.typescript]) || !!_optionalChain([globalThis, 'access', _84 => _84.module, 'optionalAccess', _85 => _85.register])
2283
+ !!_optionalChain([process, 'access', _85 => _85.features, 'optionalAccess', _86 => _86.typescript]) || !!_optionalChain([globalThis, 'access', _87 => _87.module, 'optionalAccess', _88 => _88.register])
2134
2284
  );
2135
2285
  _chunkWC573FCIcjs.logger.debug("Runtime detection results:", {
2136
2286
  nodeVersion: `${_nullishCoalesce(major, () => ( 0))}.${_nullishCoalesce(minor, () => ( 0))}`,
@@ -2199,4 +2349,5 @@ function detectRuntime() {
2199
2349
 
2200
2350
 
2201
2351
 
2202
- exports.setCurrentSpanCustomProperties = setCurrentSpanCustomProperties; exports.callWithProperties = callWithProperties; exports.withProperties = withProperties; exports.setUser = setUser; exports.setOrganization = setOrganization; exports.setMessageId = setMessageId; exports.callWithUser = callWithUser; exports.withUser = withUser; exports.callWithOrganization = callWithOrganization; exports.withOrganization = withOrganization; exports.callWithMessageId = callWithMessageId; exports.withMessageId = withMessageId; exports.callWithMute = callWithMute; exports.withMute = withMute; exports.withSessionId = withSessionId; exports.callWithSessionId = callWithSessionId; exports.Session = Session; exports.SessionTitle = SessionTitle; exports.getActiveSession = getActiveSession; exports.addExternalLink = addExternalLink; exports.recordFeedback = recordFeedback; exports.startSession = startSession; exports.startSessionTitle = startSessionTitle; exports.DEFAULT_PII_PATTERNS = DEFAULT_PII_PATTERNS; exports.maskValue = maskValue; exports.maskAttributes = maskAttributes; exports.emitEvent = emitEvent; exports.emitEventWithSessionId = emitEventWithSessionId; exports.getMetricsExporter = getMetricsExporter; exports.getMetricsReader = getMetricsReader; exports.getSpanExporter = getSpanExporter; exports.getSpanProcessor = getSpanProcessor; exports.Brizz = Brizz; exports.detectRuntime = detectRuntime;
2352
+
2353
+ exports.setCurrentSpanCustomProperties = setCurrentSpanCustomProperties; exports.callWithProperties = callWithProperties; exports.withProperties = withProperties; exports.setUser = setUser; exports.setOrganization = setOrganization; exports.setMessageId = setMessageId; exports.callWithUser = callWithUser; exports.withUser = withUser; exports.callWithOrganization = callWithOrganization; exports.withOrganization = withOrganization; exports.callWithMessageId = callWithMessageId; exports.withMessageId = withMessageId; exports.callWithMute = callWithMute; exports.withMute = withMute; exports.withSessionId = withSessionId; exports.callWithSessionId = callWithSessionId; exports.Session = Session; exports.SessionTitle = SessionTitle; exports.getActiveSession = getActiveSession; exports.addExternalLink = addExternalLink; exports.recordFeedback = recordFeedback; exports.recordMetric = recordMetric; exports.startSession = startSession; exports.startSessionTitle = startSessionTitle; exports.DEFAULT_PII_PATTERNS = DEFAULT_PII_PATTERNS; exports.maskValue = maskValue; exports.maskAttributes = maskAttributes; exports.emitEvent = emitEvent; exports.emitEventWithSessionId = emitEventWithSessionId; exports.getMetricsExporter = getMetricsExporter; exports.getMetricsReader = getMetricsReader; exports.getSpanExporter = getSpanExporter; exports.getSpanProcessor = getSpanProcessor; exports.Brizz = Brizz; exports.detectRuntime = detectRuntime;