@brizz/sdk 0.1.32 → 0.1.34

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 _chunkSCYD7XCIcjs = require('./chunk-SCYD7XCI.cjs');
7
+ var _chunkVU5YDLUDcjs = require('./chunk-VU5YDLUD.cjs');
8
8
 
9
9
 
10
10
 
@@ -13,7 +13,7 @@ var _chunkSCYD7XCIcjs = require('./chunk-SCYD7XCI.cjs');
13
13
  var _chunkWC573FCIcjs = require('./chunk-WC573FCI.cjs');
14
14
 
15
15
 
16
- var _chunkA3OOY5A2cjs = require('./chunk-A3OOY5A2.cjs');
16
+ var _chunkM3UGFLH7cjs = require('./chunk-M3UGFLH7.cjs');
17
17
 
18
18
 
19
19
 
@@ -34,7 +34,37 @@ var _chunkA3OOY5A2cjs = require('./chunk-A3OOY5A2.cjs');
34
34
 
35
35
 
36
36
 
37
- var _chunkOZCOXBB7cjs = require('./chunk-OZCOXBB7.cjs');
37
+
38
+
39
+
40
+
41
+
42
+
43
+
44
+
45
+
46
+
47
+
48
+
49
+
50
+
51
+
52
+
53
+
54
+
55
+
56
+
57
+
58
+
59
+
60
+
61
+
62
+
63
+
64
+
65
+
66
+
67
+ var _chunkNEF2O7HFcjs = require('./chunk-NEF2O7HF.cjs');
38
68
 
39
69
 
40
70
  var _chunkOBGZSXTJcjs = require('./chunk-OBGZSXTJ.cjs');
@@ -144,7 +174,7 @@ var InstrumentationRegistry = (_class = class _InstrumentationRegistry {construc
144
174
  const mcpModules = this.manualModules.mcp;
145
175
  void (async () => {
146
176
  try {
147
- const { MCPInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("./mcp-GXP22YAQ.cjs")));
177
+ const { MCPInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("./mcp-WCMY6ED6.cjs")));
148
178
  const instrumentation = new MCPInstrumentation({ exceptionLogger });
149
179
  instrumentation.manuallyInstrument(mcpModules);
150
180
  _chunkWC573FCIcjs.logger.debug("Manual instrumentation enabled for MCP");
@@ -635,10 +665,10 @@ var BrizzSimpleLogRecordProcessor = class extends _sdklogs.SimpleLogRecordProces
635
665
  if (maskingConfig) {
636
666
  maskLog(logRecord, maskingConfig);
637
667
  }
638
- const associationProperties = _api.context.active().getValue(_chunkOZCOXBB7cjs.PROPERTIES_CONTEXT_KEY);
668
+ const associationProperties = _api.context.active().getValue(_chunkNEF2O7HFcjs.PROPERTIES_CONTEXT_KEY);
639
669
  if (associationProperties) {
640
670
  for (const [key, value] of Object.entries(associationProperties)) {
641
- logRecord.setAttribute(`${_chunkOZCOXBB7cjs.BRIZZ}.${key}`, value);
671
+ logRecord.setAttribute(`${_chunkNEF2O7HFcjs.BRIZZ}.${key}`, value);
642
672
  }
643
673
  }
644
674
  super.onEmit(logRecord);
@@ -655,10 +685,10 @@ var BrizzBatchLogRecordProcessor = class extends _sdklogs.BatchLogRecordProcesso
655
685
  if (maskingConfig) {
656
686
  maskLog(logRecord, maskingConfig);
657
687
  }
658
- const associationProperties = _api.context.active().getValue(_chunkOZCOXBB7cjs.PROPERTIES_CONTEXT_KEY);
688
+ const associationProperties = _api.context.active().getValue(_chunkNEF2O7HFcjs.PROPERTIES_CONTEXT_KEY);
659
689
  if (associationProperties) {
660
690
  for (const [key, value] of Object.entries(associationProperties)) {
661
- logRecord.setAttribute(`${_chunkOZCOXBB7cjs.BRIZZ}.${key}`, value);
691
+ logRecord.setAttribute(`${_chunkNEF2O7HFcjs.BRIZZ}.${key}`, value);
662
692
  }
663
693
  }
664
694
  super.onEmit(logRecord);
@@ -685,7 +715,7 @@ function maskLog(logRecord, config) {
685
715
  newAttributes[key] = value;
686
716
  }
687
717
  for (const [key, value] of Object.entries(logRecord.attributes)) {
688
- if (key.startsWith(_chunkOZCOXBB7cjs.INTERNAL_EVENT_PREFIX)) {
718
+ if (key.startsWith(_chunkNEF2O7HFcjs.INTERNAL_EVENT_PREFIX)) {
689
719
  newAttributes[key] = value;
690
720
  }
691
721
  }
@@ -776,7 +806,7 @@ var LoggingModule = (_class2 = class _LoggingModule {constructor() { _class2.pro
776
806
  const resourceAttributes = {
777
807
  ...config.resourceAttributes,
778
808
  "service.name": config.appName,
779
- [BRIZZ_SDK_VERSION]: _chunkSCYD7XCIcjs.getSDKVersion.call(void 0, ),
809
+ [BRIZZ_SDK_VERSION]: _chunkVU5YDLUDcjs.getSDKVersion.call(void 0, ),
780
810
  [BRIZZ_SDK_LANGUAGE]: SDK_LANGUAGE
781
811
  };
782
812
  if (config.environment) {
@@ -892,16 +922,16 @@ function setCurrentSpanCustomProperties(properties) {
892
922
  }
893
923
  for (const [key, value] of Object.entries(properties)) {
894
924
  try {
895
- current.setAttribute(`${_chunkOZCOXBB7cjs.BRIZZ}.${key}`, value);
925
+ current.setAttribute(`${_chunkNEF2O7HFcjs.BRIZZ}.${key}`, value);
896
926
  } catch (e) {
897
927
  }
898
928
  }
899
929
  }
900
930
  function callWithProperties(properties, fn, thisArg, ...args) {
901
931
  const base = _api.context.active();
902
- const prev = base.getValue(_chunkOZCOXBB7cjs.PROPERTIES_CONTEXT_KEY);
932
+ const prev = base.getValue(_chunkNEF2O7HFcjs.PROPERTIES_CONTEXT_KEY);
903
933
  const merged = prev ? { ...prev, ...properties } : properties;
904
- const next = base.setValue(_chunkOZCOXBB7cjs.PROPERTIES_CONTEXT_KEY, merged);
934
+ const next = base.setValue(_chunkNEF2O7HFcjs.PROPERTIES_CONTEXT_KEY, merged);
905
935
  return _api.context.with(next, fn, thisArg, ...args);
906
936
  }
907
937
  function withProperties(properties, fn, thisArg) {
@@ -914,14 +944,144 @@ function withProperties(properties, fn, thisArg) {
914
944
  );
915
945
  };
916
946
  }
947
+ function propagatePropertiesImperatively(properties) {
948
+ try {
949
+ const manager = _api.context;
950
+ const mgr = _optionalChain([manager, 'access', _35 => _35._getContextManager, 'optionalCall', _36 => _36()]);
951
+ const store = _optionalChain([mgr, 'optionalAccess', _37 => _37._asyncLocalStorage]);
952
+ if (!store || typeof store.enterWith !== "function") {
953
+ return;
954
+ }
955
+ const base = _api.context.active();
956
+ const prev = base.getValue(_chunkNEF2O7HFcjs.PROPERTIES_CONTEXT_KEY);
957
+ const merged = prev ? { ...prev, ...properties } : properties;
958
+ store.enterWith(base.setValue(_chunkNEF2O7HFcjs.PROPERTIES_CONTEXT_KEY, merged));
959
+ } catch (e2) {
960
+ }
961
+ }
962
+ function setUser(user) {
963
+ const properties = { [_chunkNEF2O7HFcjs.USER_ID]: user.id };
964
+ if (user.email !== void 0) {
965
+ properties[_chunkNEF2O7HFcjs.USER_EMAIL] = user.email;
966
+ }
967
+ if (user.name !== void 0) {
968
+ properties[_chunkNEF2O7HFcjs.USER_NAME] = user.name;
969
+ }
970
+ if (user.role !== void 0) {
971
+ properties[_chunkNEF2O7HFcjs.USER_ROLE] = user.role;
972
+ }
973
+ if (user.plan !== void 0) {
974
+ properties[_chunkNEF2O7HFcjs.USER_PLAN] = user.plan;
975
+ }
976
+ if (user.traits) {
977
+ for (const [key, value] of Object.entries(user.traits)) {
978
+ const k = `user.${key}`;
979
+ if (properties[k] === void 0) {
980
+ properties[k] = value;
981
+ }
982
+ }
983
+ }
984
+ setCurrentSpanCustomProperties(properties);
985
+ propagatePropertiesImperatively(properties);
986
+ }
987
+ function setOrganization(org) {
988
+ const properties = { [_chunkNEF2O7HFcjs.ORGANIZATION_ID]: org.id };
989
+ if (org.name !== void 0) {
990
+ properties[_chunkNEF2O7HFcjs.ORGANIZATION_NAME] = org.name;
991
+ }
992
+ if (org.plan !== void 0) {
993
+ properties[_chunkNEF2O7HFcjs.ORGANIZATION_PLAN] = org.plan;
994
+ }
995
+ if (org.domain !== void 0) {
996
+ properties[_chunkNEF2O7HFcjs.ORGANIZATION_DOMAIN] = org.domain;
997
+ }
998
+ if (org.traits) {
999
+ for (const [key, value] of Object.entries(org.traits)) {
1000
+ const k = `organization.${key}`;
1001
+ if (properties[k] === void 0) {
1002
+ properties[k] = value;
1003
+ }
1004
+ }
1005
+ }
1006
+ setCurrentSpanCustomProperties(properties);
1007
+ propagatePropertiesImperatively(properties);
1008
+ }
1009
+ function setMessageId(id) {
1010
+ const properties = { [_chunkNEF2O7HFcjs.MESSAGE_ID]: id };
1011
+ setCurrentSpanCustomProperties(properties);
1012
+ propagatePropertiesImperatively(properties);
1013
+ }
1014
+ function userProperties(user) {
1015
+ const properties = { [_chunkNEF2O7HFcjs.USER_ID]: user.id };
1016
+ if (user.email !== void 0) {
1017
+ properties[_chunkNEF2O7HFcjs.USER_EMAIL] = user.email;
1018
+ }
1019
+ if (user.name !== void 0) {
1020
+ properties[_chunkNEF2O7HFcjs.USER_NAME] = user.name;
1021
+ }
1022
+ if (user.role !== void 0) {
1023
+ properties[_chunkNEF2O7HFcjs.USER_ROLE] = user.role;
1024
+ }
1025
+ if (user.plan !== void 0) {
1026
+ properties[_chunkNEF2O7HFcjs.USER_PLAN] = user.plan;
1027
+ }
1028
+ if (user.traits) {
1029
+ for (const [key, value] of Object.entries(user.traits)) {
1030
+ const k = `user.${key}`;
1031
+ if (properties[k] === void 0) {
1032
+ properties[k] = value;
1033
+ }
1034
+ }
1035
+ }
1036
+ return properties;
1037
+ }
1038
+ function organizationProperties(org) {
1039
+ const properties = { [_chunkNEF2O7HFcjs.ORGANIZATION_ID]: org.id };
1040
+ if (org.name !== void 0) {
1041
+ properties[_chunkNEF2O7HFcjs.ORGANIZATION_NAME] = org.name;
1042
+ }
1043
+ if (org.plan !== void 0) {
1044
+ properties[_chunkNEF2O7HFcjs.ORGANIZATION_PLAN] = org.plan;
1045
+ }
1046
+ if (org.domain !== void 0) {
1047
+ properties[_chunkNEF2O7HFcjs.ORGANIZATION_DOMAIN] = org.domain;
1048
+ }
1049
+ if (org.traits) {
1050
+ for (const [key, value] of Object.entries(org.traits)) {
1051
+ const k = `organization.${key}`;
1052
+ if (properties[k] === void 0) {
1053
+ properties[k] = value;
1054
+ }
1055
+ }
1056
+ }
1057
+ return properties;
1058
+ }
1059
+ function callWithUser(user, fn, thisArg, ...args) {
1060
+ return callWithProperties(userProperties(user), fn, thisArg, ...args);
1061
+ }
1062
+ function withUser(user, fn, thisArg) {
1063
+ return withProperties(userProperties(user), fn, thisArg);
1064
+ }
1065
+ function callWithOrganization(org, fn, thisArg, ...args) {
1066
+ return callWithProperties(organizationProperties(org), fn, thisArg, ...args);
1067
+ }
1068
+ function withOrganization(org, fn, thisArg) {
1069
+ return withProperties(organizationProperties(org), fn, thisArg);
1070
+ }
1071
+ function callWithMessageId(id, fn, thisArg, ...args) {
1072
+ return callWithProperties({ [_chunkNEF2O7HFcjs.MESSAGE_ID]: id }, fn, thisArg, ...args);
1073
+ }
1074
+ function withMessageId(id, fn, thisArg) {
1075
+ return withProperties({ [_chunkNEF2O7HFcjs.MESSAGE_ID]: id }, fn, thisArg);
1076
+ }
917
1077
  function muteProperties(options) {
918
1078
  const { input = true, output = true } = options;
919
1079
  const properties = {};
920
1080
  if (input) {
921
- properties[_chunkOZCOXBB7cjs.MUTE_INPUT] = "true";
1081
+ properties[_chunkNEF2O7HFcjs.MUTE_INPUT] = "true";
922
1082
  }
923
1083
  if (output) {
924
- properties[_chunkOZCOXBB7cjs.MUTE_OUTPUT] = "true";
1084
+ properties[_chunkNEF2O7HFcjs.MUTE_OUTPUT] = "true";
925
1085
  }
926
1086
  return properties;
927
1087
  }
@@ -932,11 +1092,11 @@ function withMute(options, fn, thisArg) {
932
1092
  return withProperties(muteProperties(options), fn, thisArg);
933
1093
  }
934
1094
  function withSessionId(sessionId, fn, thisArg, extraProperties) {
935
- const properties = { [_chunkOZCOXBB7cjs.SESSION_ID]: sessionId, ...extraProperties };
1095
+ const properties = { [_chunkNEF2O7HFcjs.SESSION_ID]: sessionId, ...extraProperties };
936
1096
  return withProperties(properties, fn, thisArg);
937
1097
  }
938
1098
  function callWithSessionId(sessionId, fn, thisArg, ...args) {
939
- return callWithProperties({ [_chunkOZCOXBB7cjs.SESSION_ID]: sessionId }, fn, thisArg, ...args);
1099
+ return callWithProperties({ [_chunkNEF2O7HFcjs.SESSION_ID]: sessionId }, fn, thisArg, ...args);
940
1100
  }
941
1101
  var Session = (_class3 = class {
942
1102
 
@@ -964,8 +1124,8 @@ var Session = (_class3 = class {
964
1124
  setInput(text, context4) {
965
1125
  this.inputs.push(text);
966
1126
  this.inputContexts.push(_nullishCoalesce(context4, () => ( {})));
967
- this.span.setAttribute(_chunkOZCOXBB7cjs.SESSION_INPUT, JSON.stringify(this.inputs));
968
- this.span.setAttribute(_chunkOZCOXBB7cjs.SESSION_INPUT_CONTEXT, JSON.stringify(this.inputContexts));
1127
+ this.span.setAttribute(_chunkNEF2O7HFcjs.SESSION_INPUT, JSON.stringify(this.inputs));
1128
+ this.span.setAttribute(_chunkNEF2O7HFcjs.SESSION_INPUT_CONTEXT, JSON.stringify(this.inputContexts));
969
1129
  }
970
1130
  /**
971
1131
  * Append an assistant turn to session output tracking.
@@ -980,8 +1140,8 @@ var Session = (_class3 = class {
980
1140
  setOutput(text, context4) {
981
1141
  this.outputs.push(text);
982
1142
  this.outputContexts.push(_nullishCoalesce(context4, () => ( {})));
983
- this.span.setAttribute(_chunkOZCOXBB7cjs.SESSION_OUTPUT, JSON.stringify(this.outputs));
984
- this.span.setAttribute(_chunkOZCOXBB7cjs.SESSION_OUTPUT_CONTEXT, JSON.stringify(this.outputContexts));
1143
+ this.span.setAttribute(_chunkNEF2O7HFcjs.SESSION_OUTPUT, JSON.stringify(this.outputs));
1144
+ this.span.setAttribute(_chunkNEF2O7HFcjs.SESSION_OUTPUT_CONTEXT, JSON.stringify(this.outputContexts));
985
1145
  }
986
1146
  /**
987
1147
  * Set the session title on the span.
@@ -989,7 +1149,7 @@ var Session = (_class3 = class {
989
1149
  * @param title - The generated title string
990
1150
  */
991
1151
  setTitle(title) {
992
- this.span.setAttribute(_chunkOZCOXBB7cjs.SESSION_TITLE, title);
1152
+ this.span.setAttribute(_chunkNEF2O7HFcjs.SESSION_TITLE, title);
993
1153
  }
994
1154
  /**
995
1155
  * Update custom properties on the session span.
@@ -999,7 +1159,56 @@ var Session = (_class3 = class {
999
1159
  */
1000
1160
  updateProperties(properties) {
1001
1161
  for (const [key, value] of Object.entries(properties)) {
1002
- this.span.setAttribute(`${_chunkOZCOXBB7cjs.BRIZZ}.${key}`, value);
1162
+ this.span.setAttribute(`${_chunkNEF2O7HFcjs.BRIZZ}.${key}`, value);
1163
+ }
1164
+ }
1165
+ /**
1166
+ * Set end-user identity on the session span: `brizz.user.id` and, when
1167
+ * provided, `brizz.user.email` / `brizz.user.name`. Undefined fields are omitted.
1168
+ *
1169
+ * @param user - User identity (`id` required; `email` / `name` optional)
1170
+ */
1171
+ setUser(user) {
1172
+ if (user.traits) {
1173
+ for (const [key, value] of Object.entries(user.traits)) {
1174
+ this.span.setAttribute(`${_chunkNEF2O7HFcjs.BRIZZ}.user.${key}`, value);
1175
+ }
1176
+ }
1177
+ this.span.setAttribute(`${_chunkNEF2O7HFcjs.BRIZZ}.${_chunkNEF2O7HFcjs.USER_ID}`, user.id);
1178
+ if (user.email !== void 0) {
1179
+ this.span.setAttribute(`${_chunkNEF2O7HFcjs.BRIZZ}.${_chunkNEF2O7HFcjs.USER_EMAIL}`, user.email);
1180
+ }
1181
+ if (user.name !== void 0) {
1182
+ this.span.setAttribute(`${_chunkNEF2O7HFcjs.BRIZZ}.${_chunkNEF2O7HFcjs.USER_NAME}`, user.name);
1183
+ }
1184
+ if (user.role !== void 0) {
1185
+ this.span.setAttribute(`${_chunkNEF2O7HFcjs.BRIZZ}.${_chunkNEF2O7HFcjs.USER_ROLE}`, user.role);
1186
+ }
1187
+ if (user.plan !== void 0) {
1188
+ this.span.setAttribute(`${_chunkNEF2O7HFcjs.BRIZZ}.${_chunkNEF2O7HFcjs.USER_PLAN}`, user.plan);
1189
+ }
1190
+ }
1191
+ /**
1192
+ * Set organization identity on the session span: `brizz.organization.id` and,
1193
+ * when provided, `brizz.organization.name`. Undefined fields are omitted.
1194
+ *
1195
+ * @param org - Organization identity (`id` required; `name` optional)
1196
+ */
1197
+ setOrganization(org) {
1198
+ if (org.traits) {
1199
+ for (const [key, value] of Object.entries(org.traits)) {
1200
+ this.span.setAttribute(`${_chunkNEF2O7HFcjs.BRIZZ}.organization.${key}`, value);
1201
+ }
1202
+ }
1203
+ this.span.setAttribute(`${_chunkNEF2O7HFcjs.BRIZZ}.${_chunkNEF2O7HFcjs.ORGANIZATION_ID}`, org.id);
1204
+ if (org.name !== void 0) {
1205
+ this.span.setAttribute(`${_chunkNEF2O7HFcjs.BRIZZ}.${_chunkNEF2O7HFcjs.ORGANIZATION_NAME}`, org.name);
1206
+ }
1207
+ if (org.plan !== void 0) {
1208
+ this.span.setAttribute(`${_chunkNEF2O7HFcjs.BRIZZ}.${_chunkNEF2O7HFcjs.ORGANIZATION_PLAN}`, org.plan);
1209
+ }
1210
+ if (org.domain !== void 0) {
1211
+ this.span.setAttribute(`${_chunkNEF2O7HFcjs.BRIZZ}.${_chunkNEF2O7HFcjs.ORGANIZATION_DOMAIN}`, org.domain);
1003
1212
  }
1004
1213
  }
1005
1214
  /**
@@ -1015,7 +1224,7 @@ var Session = (_class3 = class {
1015
1224
  * (free-form category, defaults to `'generic'`)
1016
1225
  */
1017
1226
  addExternalLink(url, options) {
1018
- emitExternalLink(this.sessionId, url, _optionalChain([options, 'optionalAccess', _35 => _35.title]), _optionalChain([options, 'optionalAccess', _36 => _36.linkType]));
1227
+ emitExternalLink(this.sessionId, url, _optionalChain([options, 'optionalAccess', _38 => _38.title]), _optionalChain([options, 'optionalAccess', _39 => _39.linkType]));
1019
1228
  }
1020
1229
  }, _class3);
1021
1230
  var SessionTitle = class {
@@ -1029,56 +1238,228 @@ var SessionTitle = class {
1029
1238
  * @param title - The generated title string
1030
1239
  */
1031
1240
  setTitle(title) {
1032
- this.span.setAttribute(_chunkOZCOXBB7cjs.SESSION_TITLE, title);
1241
+ this.span.setAttribute(_chunkNEF2O7HFcjs.SESSION_TITLE, title);
1033
1242
  }
1034
1243
  };
1035
1244
  function getActiveSession() {
1036
- return _api.context.active().getValue(_chunkOZCOXBB7cjs.SESSION_OBJECT_CONTEXT_KEY);
1245
+ return _api.context.active().getValue(_chunkNEF2O7HFcjs.SESSION_OBJECT_CONTEXT_KEY);
1037
1246
  }
1038
1247
  function resolveSessionIdFromContext() {
1039
1248
  const active = getActiveSession();
1040
1249
  if (active) {
1041
1250
  return active.sessionId;
1042
1251
  }
1043
- const props = _api.context.active().getValue(_chunkOZCOXBB7cjs.PROPERTIES_CONTEXT_KEY);
1044
- return _optionalChain([props, 'optionalAccess', _37 => _37[_chunkOZCOXBB7cjs.SESSION_ID]]);
1252
+ const props = _api.context.active().getValue(_chunkNEF2O7HFcjs.PROPERTIES_CONTEXT_KEY);
1253
+ return _optionalChain([props, 'optionalAccess', _40 => _40[_chunkNEF2O7HFcjs.SESSION_ID]]);
1254
+ }
1255
+ function resolveMessageIdFromContext() {
1256
+ const props = _api.context.active().getValue(_chunkNEF2O7HFcjs.PROPERTIES_CONTEXT_KEY);
1257
+ return _optionalChain([props, 'optionalAccess', _41 => _41[_chunkNEF2O7HFcjs.MESSAGE_ID]]);
1045
1258
  }
1046
1259
  function emitExternalLink(sessionId, url, title, linkType) {
1047
1260
  try {
1048
- emitEventWithSessionId(sessionId, _chunkOZCOXBB7cjs.EXTERNAL_LINK_EVENT_NAME, {
1049
- [_chunkOZCOXBB7cjs.EXTERNAL_LINK_URL]: url,
1050
- [_chunkOZCOXBB7cjs.EXTERNAL_LINK_TITLE]: _nullishCoalesce(title, () => ( "")),
1051
- [_chunkOZCOXBB7cjs.EXTERNAL_LINK_TYPE]: _nullishCoalesce(linkType, () => ( "generic"))
1261
+ emitEventWithSessionId(sessionId, _chunkNEF2O7HFcjs.EXTERNAL_LINK_EVENT_NAME, {
1262
+ [_chunkNEF2O7HFcjs.EXTERNAL_LINK_URL]: url,
1263
+ [_chunkNEF2O7HFcjs.EXTERNAL_LINK_TITLE]: _nullishCoalesce(title, () => ( "")),
1264
+ [_chunkNEF2O7HFcjs.EXTERNAL_LINK_TYPE]: _nullishCoalesce(linkType, () => ( "generic"))
1052
1265
  });
1053
1266
  } catch (error) {
1054
1267
  _chunkWC573FCIcjs.logger.warn("addExternalLink: failed to emit external link", error);
1055
1268
  }
1056
1269
  }
1057
1270
  function addExternalLink(url, options) {
1058
- const sessionId = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _38 => _38.sessionId]), () => ( resolveSessionIdFromContext()));
1271
+ const sessionId = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _42 => _42.sessionId]), () => ( resolveSessionIdFromContext()));
1059
1272
  if (!sessionId) {
1060
1273
  _chunkWC573FCIcjs.logger.warn(
1061
1274
  "addExternalLink called without a resolvable session id; link dropped. Pass options.sessionId or call inside a startSession/callWithSessionId scope."
1062
1275
  );
1063
1276
  return;
1064
1277
  }
1065
- emitExternalLink(sessionId, url, _optionalChain([options, 'optionalAccess', _39 => _39.title]), _optionalChain([options, 'optionalAccess', _40 => _40.linkType]));
1278
+ emitExternalLink(sessionId, url, _optionalChain([options, 'optionalAccess', _43 => _43.title]), _optionalChain([options, 'optionalAccess', _44 => _44.linkType]));
1279
+ }
1280
+ function recordFeedback(type, options) {
1281
+ const eventAttributes = { [_chunkNEF2O7HFcjs.FEEDBACK_TYPE]: type };
1282
+ if (_optionalChain([options, 'optionalAccess', _45 => _45.score]) !== void 0) {
1283
+ eventAttributes[_chunkNEF2O7HFcjs.FEEDBACK_SCORE] = options.score;
1284
+ }
1285
+ if (_optionalChain([options, 'optionalAccess', _46 => _46.reason]) !== void 0) {
1286
+ eventAttributes[_chunkNEF2O7HFcjs.FEEDBACK_REASON] = options.reason;
1287
+ }
1288
+ if (_optionalChain([options, 'optionalAccess', _47 => _47.comment]) !== void 0) {
1289
+ eventAttributes[_chunkNEF2O7HFcjs.FEEDBACK_COMMENT] = options.comment;
1290
+ }
1291
+ if (_optionalChain([options, 'optionalAccess', _48 => _48.source]) !== void 0) {
1292
+ eventAttributes[_chunkNEF2O7HFcjs.FEEDBACK_SOURCE] = options.source;
1293
+ }
1294
+ if (_optionalChain([options, 'optionalAccess', _49 => _49.attributes])) {
1295
+ for (const [key, value] of Object.entries(options.attributes)) {
1296
+ const k = `${_chunkNEF2O7HFcjs.FEEDBACK_ATTR_PREFIX}${key}`;
1297
+ if (eventAttributes[k] === void 0) {
1298
+ eventAttributes[k] = value;
1299
+ }
1300
+ }
1301
+ }
1302
+ const messageId = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _50 => _50.messageId]), () => ( resolveMessageIdFromContext()));
1303
+ const sessionId = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _51 => _51.sessionId]), () => ( resolveSessionIdFromContext()));
1304
+ if (messageId === void 0 && sessionId === void 0) {
1305
+ _chunkWC573FCIcjs.logger.warn(
1306
+ "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."
1307
+ );
1308
+ }
1309
+ const anchor = {};
1310
+ if (messageId !== void 0) {
1311
+ anchor[_chunkNEF2O7HFcjs.MESSAGE_ID] = messageId;
1312
+ }
1313
+ if (sessionId !== void 0) {
1314
+ anchor[_chunkNEF2O7HFcjs.SESSION_ID] = sessionId;
1315
+ }
1316
+ try {
1317
+ if (Object.keys(anchor).length === 0) {
1318
+ emitEvent(_chunkNEF2O7HFcjs.FEEDBACK_EVENT_NAME, eventAttributes);
1319
+ } else {
1320
+ callWithProperties(anchor, () => emitEvent(_chunkNEF2O7HFcjs.FEEDBACK_EVENT_NAME, eventAttributes));
1321
+ }
1322
+ } catch (error) {
1323
+ _chunkWC573FCIcjs.logger.warn("recordFeedback: failed to emit feedback event", error);
1324
+ }
1325
+ }
1326
+ var METRIC_NAME_PATTERN = /^[a-z][a-z0-9_.-]{0,63}$/;
1327
+ var METRIC_COMMENT_MAX_LEN = 4096;
1328
+ var METRIC_ATTRIBUTES_MAX = 20;
1329
+ var METRIC_ATTRIBUTE_VALUE_MAX_LEN = 256;
1330
+ function recordMetric(options) {
1331
+ try {
1332
+ recordMetricImpl(options);
1333
+ } catch (error) {
1334
+ _chunkWC573FCIcjs.logger.warn(`recordMetric(${JSON.stringify(_optionalChain([options, 'optionalAccess', _52 => _52.name]))}) failed; metric dropped.`, error);
1335
+ }
1336
+ }
1337
+ function recordMetricImpl(options) {
1338
+ const name = typeof options.name === "string" ? options.name.toLowerCase() : "";
1339
+ if (!METRIC_NAME_PATTERN.test(name)) {
1340
+ _chunkWC573FCIcjs.logger.warn(
1341
+ `recordMetric called with an invalid name ${JSON.stringify(options.name)}; metric dropped. Names must match ${METRIC_NAME_PATTERN.source} after lowercasing.`
1342
+ );
1343
+ return;
1344
+ }
1345
+ if (_chunkNEF2O7HFcjs.RESERVED_METRIC_NAMES.has(name)) {
1346
+ _chunkWC573FCIcjs.logger.warn(
1347
+ `recordMetric called with the reserved name ${JSON.stringify(name)}; metric dropped. Brizz computes this metric itself \u2014 pick a different name.`
1348
+ );
1349
+ return;
1350
+ }
1351
+ const { value } = options;
1352
+ let numericValue;
1353
+ if (typeof value === "boolean") {
1354
+ numericValue = value ? 1 : 0;
1355
+ } else if (typeof value === "number" && Number.isFinite(value)) {
1356
+ numericValue = value;
1357
+ } else {
1358
+ _chunkWC573FCIcjs.logger.warn(
1359
+ `recordMetric(${name}) called with a non-finite or non-numeric value ${JSON.stringify(value)}; metric dropped.`
1360
+ );
1361
+ return;
1362
+ }
1363
+ const eventAttributes = {
1364
+ [_chunkNEF2O7HFcjs.METRIC_NAME]: name,
1365
+ [_chunkNEF2O7HFcjs.METRIC_VALUE]: numericValue
1366
+ };
1367
+ if (options.unit !== void 0) {
1368
+ eventAttributes[_chunkNEF2O7HFcjs.METRIC_UNIT] = options.unit;
1369
+ }
1370
+ if (options.minValue !== void 0) {
1371
+ eventAttributes[_chunkNEF2O7HFcjs.METRIC_MIN] = options.minValue;
1372
+ }
1373
+ if (options.maxValue !== void 0) {
1374
+ eventAttributes[_chunkNEF2O7HFcjs.METRIC_MAX] = options.maxValue;
1375
+ }
1376
+ if (options.comment !== void 0) {
1377
+ let comment = options.comment;
1378
+ if (comment.length > METRIC_COMMENT_MAX_LEN) {
1379
+ _chunkWC573FCIcjs.logger.warn(
1380
+ `recordMetric(${name}) comment exceeds ${METRIC_COMMENT_MAX_LEN} characters; truncated.`
1381
+ );
1382
+ comment = comment.slice(0, METRIC_COMMENT_MAX_LEN);
1383
+ }
1384
+ eventAttributes[_chunkNEF2O7HFcjs.METRIC_COMMENT] = comment;
1385
+ }
1386
+ if (options.polarity !== void 0) {
1387
+ const polarity = options.polarity;
1388
+ if (polarity === _chunkNEF2O7HFcjs.METRIC_POLARITY_POSITIVE || polarity === _chunkNEF2O7HFcjs.METRIC_POLARITY_NEGATIVE) {
1389
+ eventAttributes[_chunkNEF2O7HFcjs.METRIC_POLARITY] = polarity;
1390
+ } else {
1391
+ _chunkWC573FCIcjs.logger.warn(
1392
+ `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.`
1393
+ );
1394
+ }
1395
+ }
1396
+ if (options.timestamp !== void 0) {
1397
+ if (Number.isFinite(options.timestamp.getTime())) {
1398
+ eventAttributes[_chunkNEF2O7HFcjs.METRIC_TIMESTAMP] = options.timestamp.toISOString();
1399
+ } else {
1400
+ _chunkWC573FCIcjs.logger.warn(
1401
+ `recordMetric(${name}) called with an invalid timestamp; emitting the metric without it.`
1402
+ );
1403
+ }
1404
+ }
1405
+ if (options.attributes) {
1406
+ let accepted = 0;
1407
+ for (const [key, attrValue] of Object.entries(options.attributes)) {
1408
+ if (accepted >= METRIC_ATTRIBUTES_MAX) {
1409
+ _chunkWC573FCIcjs.logger.warn(
1410
+ `recordMetric(${name}) called with more than ${METRIC_ATTRIBUTES_MAX} attributes; the excess was dropped.`
1411
+ );
1412
+ break;
1413
+ }
1414
+ const normalizedKey = key.toLowerCase();
1415
+ if (!METRIC_NAME_PATTERN.test(normalizedKey)) {
1416
+ _chunkWC573FCIcjs.logger.warn(
1417
+ `recordMetric(${name}) called with an invalid attribute key ${JSON.stringify(key)}; that attribute was dropped. Keys must match ${METRIC_NAME_PATTERN.source} after lowercasing.`
1418
+ );
1419
+ continue;
1420
+ }
1421
+ let text = typeof attrValue === "string" ? attrValue : String(attrValue);
1422
+ if (text.length > METRIC_ATTRIBUTE_VALUE_MAX_LEN) {
1423
+ _chunkWC573FCIcjs.logger.warn(
1424
+ `recordMetric(${name}) attribute ${JSON.stringify(normalizedKey)} exceeds ${METRIC_ATTRIBUTE_VALUE_MAX_LEN} characters; truncated.`
1425
+ );
1426
+ text = text.slice(0, METRIC_ATTRIBUTE_VALUE_MAX_LEN);
1427
+ }
1428
+ eventAttributes[`${_chunkNEF2O7HFcjs.METRIC_ATTRIBUTE_PREFIX}${normalizedKey}`] = text;
1429
+ accepted += 1;
1430
+ }
1431
+ }
1432
+ const sessionId = _nullishCoalesce(options.sessionId, () => ( resolveSessionIdFromContext()));
1433
+ if (sessionId === void 0) {
1434
+ _chunkWC573FCIcjs.logger.warn(
1435
+ `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.`
1436
+ );
1437
+ return;
1438
+ }
1439
+ try {
1440
+ callWithProperties(
1441
+ { [_chunkNEF2O7HFcjs.SESSION_ID]: sessionId },
1442
+ () => emitEvent(_chunkNEF2O7HFcjs.METRIC_EVENT_NAME, eventAttributes)
1443
+ );
1444
+ } catch (error) {
1445
+ _chunkWC573FCIcjs.logger.warn("recordMetric: failed to emit metric event", error);
1446
+ }
1066
1447
  }
1067
1448
  function startSession(sessionId, callback, extraProperties, options) {
1068
- const isTitle = _optionalChain([options, 'optionalAccess', _41 => _41.mode]) === "title";
1069
- const spanName = isTitle ? _chunkOZCOXBB7cjs.SESSION_TITLE_SPAN_NAME : _chunkOZCOXBB7cjs.SESSION_SPAN_NAME;
1449
+ const isTitle = _optionalChain([options, 'optionalAccess', _53 => _53.mode]) === "title";
1450
+ const spanName = isTitle ? _chunkNEF2O7HFcjs.SESSION_TITLE_SPAN_NAME : _chunkNEF2O7HFcjs.SESSION_SPAN_NAME;
1070
1451
  const tracer = _api.trace.getTracer("@brizz/sdk");
1071
1452
  return tracer.startActiveSpan(spanName, (span) => {
1072
- span.setAttribute(`${_chunkOZCOXBB7cjs.BRIZZ}.${_chunkOZCOXBB7cjs.SESSION_ID}`, sessionId);
1453
+ span.setAttribute(`${_chunkNEF2O7HFcjs.BRIZZ}.${_chunkNEF2O7HFcjs.SESSION_ID}`, sessionId);
1073
1454
  if (extraProperties) {
1074
1455
  for (const [key, value] of Object.entries(extraProperties)) {
1075
- span.setAttribute(`${_chunkOZCOXBB7cjs.BRIZZ}.${key}`, value);
1456
+ span.setAttribute(`${_chunkNEF2O7HFcjs.BRIZZ}.${key}`, value);
1076
1457
  }
1077
1458
  }
1078
1459
  const session = new Session(sessionId, span);
1079
- const contextProperties = { [_chunkOZCOXBB7cjs.SESSION_ID]: sessionId };
1460
+ const contextProperties = { [_chunkNEF2O7HFcjs.SESSION_ID]: sessionId };
1080
1461
  if (isTitle) {
1081
- contextProperties[_chunkOZCOXBB7cjs.SESSION_TITLE_GENERATION] = "true";
1462
+ contextProperties[_chunkNEF2O7HFcjs.SESSION_TITLE_GENERATION] = "true";
1082
1463
  }
1083
1464
  if (extraProperties) {
1084
1465
  for (const [key, value] of Object.entries(extraProperties)) {
@@ -1086,7 +1467,7 @@ function startSession(sessionId, callback, extraProperties, options) {
1086
1467
  }
1087
1468
  }
1088
1469
  return callWithProperties(contextProperties, () => {
1089
- const sessionCtx = _api.context.active().setValue(_chunkOZCOXBB7cjs.SESSION_OBJECT_CONTEXT_KEY, session);
1470
+ const sessionCtx = _api.context.active().setValue(_chunkNEF2O7HFcjs.SESSION_OBJECT_CONTEXT_KEY, session);
1090
1471
  return _api.context.with(sessionCtx, () => {
1091
1472
  try {
1092
1473
  const result = callback(session);
@@ -1114,16 +1495,16 @@ function startSession(sessionId, callback, extraProperties, options) {
1114
1495
  });
1115
1496
  }
1116
1497
  function startSessionTitle(callback, options) {
1117
- const resolvedSessionId = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _42 => _42.sessionId]), () => ( _optionalChain([getActiveSession, 'call', _43 => _43(), 'optionalAccess', _44 => _44.sessionId])));
1498
+ const resolvedSessionId = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _54 => _54.sessionId]), () => ( _optionalChain([getActiveSession, 'call', _55 => _55(), 'optionalAccess', _56 => _56.sessionId])));
1118
1499
  const tracer = _api.trace.getTracer("@brizz/sdk");
1119
- return tracer.startActiveSpan(_chunkOZCOXBB7cjs.SESSION_TITLE_SPAN_NAME, (span) => {
1500
+ return tracer.startActiveSpan(_chunkNEF2O7HFcjs.SESSION_TITLE_SPAN_NAME, (span) => {
1120
1501
  if (resolvedSessionId) {
1121
- span.setAttribute(`${_chunkOZCOXBB7cjs.BRIZZ}.${_chunkOZCOXBB7cjs.SESSION_ID}`, resolvedSessionId);
1502
+ span.setAttribute(`${_chunkNEF2O7HFcjs.BRIZZ}.${_chunkNEF2O7HFcjs.SESSION_ID}`, resolvedSessionId);
1122
1503
  }
1123
1504
  const sessionTitle = new SessionTitle(span);
1124
- const properties = { [_chunkOZCOXBB7cjs.SESSION_TITLE_GENERATION]: "true" };
1505
+ const properties = { [_chunkNEF2O7HFcjs.SESSION_TITLE_GENERATION]: "true" };
1125
1506
  if (resolvedSessionId) {
1126
- properties[_chunkOZCOXBB7cjs.SESSION_ID] = resolvedSessionId;
1507
+ properties[_chunkNEF2O7HFcjs.SESSION_ID] = resolvedSessionId;
1127
1508
  }
1128
1509
  return callWithProperties(properties, () => {
1129
1510
  try {
@@ -1268,7 +1649,7 @@ var BrizzSpanExporter = class {
1268
1649
  const resourceAttrs = {
1269
1650
  ...config.resourceAttributes,
1270
1651
  "service.name": config.appName,
1271
- [BRIZZ_SDK_VERSION]: _chunkSCYD7XCIcjs.getSDKVersion.call(void 0, ),
1652
+ [BRIZZ_SDK_VERSION]: _chunkVU5YDLUDcjs.getSDKVersion.call(void 0, ),
1272
1653
  [BRIZZ_SDK_LANGUAGE]: SDK_LANGUAGE
1273
1654
  };
1274
1655
  if (config.environment) {
@@ -1320,7 +1701,7 @@ var BrizzSpanExporter = class {
1320
1701
  return this._delegate.shutdown();
1321
1702
  }
1322
1703
  async forceFlush() {
1323
- return _optionalChain([this, 'access', _45 => _45._delegate, 'access', _46 => _46.forceFlush, 'optionalCall', _47 => _47()]);
1704
+ return _optionalChain([this, 'access', _57 => _57._delegate, 'access', _58 => _58.forceFlush, 'optionalCall', _59 => _59()]);
1324
1705
  }
1325
1706
  };
1326
1707
 
@@ -1331,10 +1712,10 @@ var BrizzSpanExporter = class {
1331
1712
 
1332
1713
  var _sdktracebase = require('@opentelemetry/sdk-trace-base');
1333
1714
  function applyContextAttributes(span) {
1334
- const sessionProperties = _api.context.active().getValue(_chunkOZCOXBB7cjs.PROPERTIES_CONTEXT_KEY);
1715
+ const sessionProperties = _api.context.active().getValue(_chunkNEF2O7HFcjs.PROPERTIES_CONTEXT_KEY);
1335
1716
  if (sessionProperties) {
1336
1717
  for (const [key, value] of Object.entries(sessionProperties)) {
1337
- span.setAttribute(`${_chunkOZCOXBB7cjs.BRIZZ}.${key}`, value);
1718
+ span.setAttribute(`${_chunkNEF2O7HFcjs.BRIZZ}.${key}`, value);
1338
1719
  }
1339
1720
  }
1340
1721
  }
@@ -1355,7 +1736,7 @@ var BrizzSimpleSpanProcessor = class extends _sdktracebase.SimpleSpanProcessor {
1355
1736
  super.onStart(span, parentContext);
1356
1737
  }
1357
1738
  onEnd(span) {
1358
- const maskingConfig = _optionalChain([this, 'access', _48 => _48.config, 'access', _49 => _49.masking, 'optionalAccess', _50 => _50.spanMasking]);
1739
+ const maskingConfig = _optionalChain([this, 'access', _60 => _60.config, 'access', _61 => _61.masking, 'optionalAccess', _62 => _62.spanMasking]);
1359
1740
  if (maskingConfig) {
1360
1741
  maskReadableSpan(span, maskingConfig);
1361
1742
  }
@@ -1373,7 +1754,7 @@ var BrizzBatchSpanProcessor = class extends _sdktracebase.BatchSpanProcessor {
1373
1754
  super.onStart(span, parentContext);
1374
1755
  }
1375
1756
  onEnd(span) {
1376
- const maskingConfig = _optionalChain([this, 'access', _51 => _51.config, 'access', _52 => _52.masking, 'optionalAccess', _53 => _53.spanMasking]);
1757
+ const maskingConfig = _optionalChain([this, 'access', _63 => _63.config, 'access', _64 => _64.masking, 'optionalAccess', _65 => _65.spanMasking]);
1377
1758
  if (maskingConfig) {
1378
1759
  maskReadableSpan(span, maskingConfig);
1379
1760
  }
@@ -1453,7 +1834,7 @@ var TracingModule = (_class5 = class _TracingModule {constructor() { _class5.pro
1453
1834
  }
1454
1835
  _chunkWC573FCIcjs.logger.debug("Initializing span processor", {
1455
1836
  disableBatch: config.disableBatch,
1456
- hasMasking: !!_optionalChain([config, 'access', _54 => _54.masking, 'optionalAccess', _55 => _55.spanMasking])
1837
+ hasMasking: !!_optionalChain([config, 'access', _66 => _66.masking, 'optionalAccess', _67 => _67.spanMasking])
1457
1838
  });
1458
1839
  const spanProcessor = config.disableBatch ? new BrizzSimpleSpanProcessor(this.spanExporter, config) : new BrizzBatchSpanProcessor(this.spanExporter, config);
1459
1840
  _chunkWC573FCIcjs.logger.debug("Span processor initialized successfully");
@@ -1533,7 +1914,7 @@ var _sdktracenode = require('@opentelemetry/sdk-trace-node');
1533
1914
 
1534
1915
  // src/internal/config.ts
1535
1916
  function resolveConfig(options) {
1536
- const envLogLevel = process.env["BRIZZ_LOG_LEVEL"] || _optionalChain([options, 'access', _56 => _56.logLevel, 'optionalAccess', _57 => _57.toString, 'call', _58 => _58()]) || _chunkWC573FCIcjs.DEFAULT_LOG_LEVEL.toString();
1917
+ const envLogLevel = process.env["BRIZZ_LOG_LEVEL"] || _optionalChain([options, 'access', _68 => _68.logLevel, 'optionalAccess', _69 => _69.toString, 'call', _70 => _70()]) || _chunkWC573FCIcjs.DEFAULT_LOG_LEVEL.toString();
1537
1918
  let resolvedLogLevel;
1538
1919
  if (envLogLevel) {
1539
1920
  resolvedLogLevel = _chunkWC573FCIcjs.parseLogLevel.call(void 0, envLogLevel);
@@ -1704,7 +2085,7 @@ var _Brizz = (_class6 = class __Brizz {constructor() { _class6.prototype.__init1
1704
2085
  const resourceAttributes = {
1705
2086
  ...resolvedConfig.resourceAttributes,
1706
2087
  "service.name": resolvedConfig.appName,
1707
- [BRIZZ_SDK_VERSION]: _chunkSCYD7XCIcjs.getSDKVersion.call(void 0, ),
2088
+ [BRIZZ_SDK_VERSION]: _chunkVU5YDLUDcjs.getSDKVersion.call(void 0, ),
1708
2089
  [BRIZZ_SDK_LANGUAGE]: SDK_LANGUAGE
1709
2090
  };
1710
2091
  if (resolvedConfig.environment) {
@@ -1716,7 +2097,7 @@ var _Brizz = (_class6 = class __Brizz {constructor() { _class6.prototype.__init1
1716
2097
  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));
1717
2098
  this._tracerProvider = new (0, _sdktracenode.NodeTracerProvider)({
1718
2099
  resource,
1719
- spanProcessors: resolvedConfig.disableSpanExporter ? [] : [new (0, _chunkA3OOY5A2cjs.InterruptPropagator)(), getSpanProcessor()]
2100
+ spanProcessors: resolvedConfig.disableSpanExporter ? [] : [new (0, _chunkM3UGFLH7cjs.InterruptPropagator)(), getSpanProcessor()]
1720
2101
  });
1721
2102
  this._tracerProvider.register();
1722
2103
  this._meterProvider = new (0, _sdkmetrics.MeterProvider)({ resource, readers: [getMetricsReader()] });
@@ -1774,19 +2155,19 @@ var _Brizz = (_class6 = class __Brizz {constructor() { _class6.prototype.__init1
1774
2155
  try {
1775
2156
  const tracingModule = TracingModule.getInstance();
1776
2157
  await tracingModule.shutdown();
1777
- } catch (e2) {
2158
+ } catch (e3) {
1778
2159
  _chunkWC573FCIcjs.logger.debug("Tracing module already shut down or not initialized");
1779
2160
  }
1780
2161
  try {
1781
2162
  const metricsModule = MetricsModule.getInstance();
1782
2163
  metricsModule.shutdown();
1783
- } catch (e3) {
2164
+ } catch (e4) {
1784
2165
  _chunkWC573FCIcjs.logger.debug("Metrics module already shut down or not initialized");
1785
2166
  }
1786
2167
  try {
1787
2168
  const loggingModule = LoggingModule.getInstance();
1788
2169
  await loggingModule.shutdown();
1789
- } catch (e4) {
2170
+ } catch (e5) {
1790
2171
  _chunkWC573FCIcjs.logger.debug("Logging module already shut down or not initialized");
1791
2172
  }
1792
2173
  _chunkWC573FCIcjs.logger.info("All telemetry modules shut down successfully");
@@ -1852,10 +2233,10 @@ var _Brizz = (_class6 = class __Brizz {constructor() { _class6.prototype.__init1
1852
2233
  }
1853
2234
  try {
1854
2235
  await this.shutdownModules();
1855
- await _optionalChain([this, 'access', _59 => _59._tracerProvider, 'optionalAccess', _60 => _60.forceFlush, 'call', _61 => _61()]);
1856
- await _optionalChain([this, 'access', _62 => _62._tracerProvider, 'optionalAccess', _63 => _63.shutdown, 'call', _64 => _64()]);
1857
- await _optionalChain([this, 'access', _65 => _65._meterProvider, 'optionalAccess', _66 => _66.forceFlush, 'call', _67 => _67()]);
1858
- await _optionalChain([this, 'access', _68 => _68._meterProvider, 'optionalAccess', _69 => _69.shutdown, 'call', _70 => _70()]);
2236
+ await _optionalChain([this, 'access', _71 => _71._tracerProvider, 'optionalAccess', _72 => _72.forceFlush, 'call', _73 => _73()]);
2237
+ await _optionalChain([this, 'access', _74 => _74._tracerProvider, 'optionalAccess', _75 => _75.shutdown, 'call', _76 => _76()]);
2238
+ await _optionalChain([this, 'access', _77 => _77._meterProvider, 'optionalAccess', _78 => _78.forceFlush, 'call', _79 => _79()]);
2239
+ await _optionalChain([this, 'access', _80 => _80._meterProvider, 'optionalAccess', _81 => _81.shutdown, 'call', _82 => _82()]);
1859
2240
  this._initialized = false;
1860
2241
  this._tracerProvider = null;
1861
2242
  this._meterProvider = null;
@@ -1884,7 +2265,7 @@ function detectRuntime() {
1884
2265
  const supportsLoaderAPI = (_nullishCoalesce(major, () => ( 0))) >= 21 || (_nullishCoalesce(major, () => ( 0))) === 20 && (_nullishCoalesce(minor, () => ( 0))) >= 6 || (_nullishCoalesce(major, () => ( 0))) === 18 && (_nullishCoalesce(minor, () => ( 0))) >= 19;
1885
2266
  const supportsRegister = (
1886
2267
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
1887
- !!_optionalChain([process, 'access', _71 => _71.features, 'optionalAccess', _72 => _72.typescript]) || !!_optionalChain([globalThis, 'access', _73 => _73.module, 'optionalAccess', _74 => _74.register])
2268
+ !!_optionalChain([process, 'access', _83 => _83.features, 'optionalAccess', _84 => _84.typescript]) || !!_optionalChain([globalThis, 'access', _85 => _85.module, 'optionalAccess', _86 => _86.register])
1888
2269
  );
1889
2270
  _chunkWC573FCIcjs.logger.debug("Runtime detection results:", {
1890
2271
  nodeVersion: `${_nullishCoalesce(major, () => ( 0))}.${_nullishCoalesce(minor, () => ( 0))}`,
@@ -1943,4 +2324,15 @@ function detectRuntime() {
1943
2324
 
1944
2325
 
1945
2326
 
1946
- exports.setCurrentSpanCustomProperties = setCurrentSpanCustomProperties; exports.callWithProperties = callWithProperties; exports.withProperties = withProperties; 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.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;
2327
+
2328
+
2329
+
2330
+
2331
+
2332
+
2333
+
2334
+
2335
+
2336
+
2337
+
2338
+ 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;