@brizz/sdk 0.1.30 → 0.1.33

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.
@@ -1,17 +1,19 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2; var _class3; var _class4; var _class5; var _class6;
2
2
 
3
3
 
4
+ var _chunkUNLNNKZ7cjs = require('./chunk-UNLNNKZ7.cjs');
4
5
 
5
6
 
7
+ var _chunk3ITCDKTJcjs = require('./chunk-3ITCDKTJ.cjs');
6
8
 
7
- var _chunkJB6MA2RVcjs = require('./chunk-JB6MA2RV.cjs');
8
9
 
9
10
 
10
- var _chunkLTXMCGVQcjs = require('./chunk-LTXMCGVQ.cjs');
11
11
 
12
12
 
13
+ var _chunkWC573FCIcjs = require('./chunk-WC573FCI.cjs');
13
14
 
14
15
 
16
+ var _chunkLFLYWZ6Dcjs = require('./chunk-LFLYWZ6D.cjs');
15
17
 
16
18
 
17
19
 
@@ -29,7 +31,30 @@ var _chunkLTXMCGVQcjs = require('./chunk-LTXMCGVQ.cjs');
29
31
 
30
32
 
31
33
 
32
- var _chunkGCORRK6Bcjs = require('./chunk-GCORRK6B.cjs');
34
+
35
+
36
+
37
+
38
+
39
+
40
+
41
+
42
+
43
+
44
+
45
+
46
+
47
+
48
+
49
+
50
+
51
+
52
+
53
+
54
+ var _chunkLIFLVFK6cjs = require('./chunk-LIFLVFK6.cjs');
55
+
56
+
57
+ var _chunkOBGZSXTJcjs = require('./chunk-OBGZSXTJ.cjs');
33
58
 
34
59
  // src/internal/instrumentation/registry.ts
35
60
  var _instrumentationanthropic = require('@traceloop/instrumentation-anthropic');
@@ -56,15 +81,15 @@ var InstrumentationRegistry = (_class = class _InstrumentationRegistry {construc
56
81
  loadInstrumentation(InstrumentationClass, name, manualModule, exceptionLogger) {
57
82
  try {
58
83
  const inst = new InstrumentationClass({
59
- exceptionLogger: exceptionLogger || ((error) => _chunkJB6MA2RVcjs.logger.error(`Exception in instrumentation: ${String(error)}`))
84
+ exceptionLogger: exceptionLogger || ((error) => _chunkWC573FCIcjs.logger.error(`Exception in instrumentation: ${String(error)}`))
60
85
  });
61
86
  if (manualModule) {
62
87
  inst.manuallyInstrument(manualModule);
63
- _chunkJB6MA2RVcjs.logger.debug(`Manual instrumentation enabled for ${name}`);
88
+ _chunkWC573FCIcjs.logger.debug(`Manual instrumentation enabled for ${name}`);
64
89
  }
65
90
  return inst;
66
91
  } catch (error) {
67
- _chunkJB6MA2RVcjs.logger.error(`Failed to load ${name} instrumentation: ${String(error)}`);
92
+ _chunkWC573FCIcjs.logger.error(`Failed to load ${name} instrumentation: ${String(error)}`);
68
93
  return null;
69
94
  }
70
95
  }
@@ -109,9 +134,9 @@ var InstrumentationRegistry = (_class = class _InstrumentationRegistry {construc
109
134
  const { LangChainInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("@arizeai/openinference-instrumentation-langchain")));
110
135
  const lcInst = new LangChainInstrumentation();
111
136
  lcInst.manuallyInstrument(callbackManagerModule);
112
- _chunkJB6MA2RVcjs.logger.debug("Manual instrumentation enabled for LangChain");
137
+ _chunkWC573FCIcjs.logger.debug("Manual instrumentation enabled for LangChain");
113
138
  } catch (error) {
114
- _chunkJB6MA2RVcjs.logger.error(
139
+ _chunkWC573FCIcjs.logger.error(
115
140
  `Failed to load LangChain instrumentation. Ensure @langchain/core is installed: ${String(error)}`
116
141
  );
117
142
  }
@@ -124,9 +149,9 @@ var InstrumentationRegistry = (_class = class _InstrumentationRegistry {construc
124
149
  const { VertexAIInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("@traceloop/instrumentation-vertexai")));
125
150
  const vertexInst = new VertexAIInstrumentation({ exceptionLogger });
126
151
  vertexInst.manuallyInstrument(vertexModule);
127
- _chunkJB6MA2RVcjs.logger.debug("Manual instrumentation enabled for Vertex AI");
152
+ _chunkWC573FCIcjs.logger.debug("Manual instrumentation enabled for Vertex AI");
128
153
  } catch (error) {
129
- _chunkJB6MA2RVcjs.logger.error(
154
+ _chunkWC573FCIcjs.logger.error(
130
155
  `Failed to load Vertex AI instrumentation. Ensure @traceloop/instrumentation-vertexai is installed: ${String(error)}`
131
156
  );
132
157
  }
@@ -136,12 +161,12 @@ var InstrumentationRegistry = (_class = class _InstrumentationRegistry {construc
136
161
  const mcpModules = this.manualModules.mcp;
137
162
  void (async () => {
138
163
  try {
139
- const { MCPInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("./mcp-6BDG4SWY.cjs")));
164
+ const { MCPInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("./mcp-OKSS2R56.cjs")));
140
165
  const instrumentation = new MCPInstrumentation({ exceptionLogger });
141
166
  instrumentation.manuallyInstrument(mcpModules);
142
- _chunkJB6MA2RVcjs.logger.debug("Manual instrumentation enabled for MCP");
167
+ _chunkWC573FCIcjs.logger.debug("Manual instrumentation enabled for MCP");
143
168
  } catch (error) {
144
- _chunkJB6MA2RVcjs.logger.error(`Failed to apply MCP instrumentation: ${String(error)}`);
169
+ _chunkWC573FCIcjs.logger.error(`Failed to apply MCP instrumentation: ${String(error)}`);
145
170
  }
146
171
  })();
147
172
  }
@@ -151,7 +176,7 @@ var InstrumentationRegistry = (_class = class _InstrumentationRegistry {construc
151
176
  */
152
177
  setManualModules(modules) {
153
178
  this.manualModules = modules;
154
- _chunkJB6MA2RVcjs.logger.info("Manual instrumentation modules configured for Next.js/Webpack compatibility");
179
+ _chunkWC573FCIcjs.logger.info("Manual instrumentation modules configured for Next.js/Webpack compatibility");
155
180
  }
156
181
  /**
157
182
  * Get manual instrumentations only.
@@ -159,15 +184,15 @@ var InstrumentationRegistry = (_class = class _InstrumentationRegistry {construc
159
184
  */
160
185
  getManualInstrumentations() {
161
186
  if (!this.manualModules || Object.keys(this.manualModules).length === 0) {
162
- _chunkJB6MA2RVcjs.logger.debug("No manual instrumentation modules configured");
187
+ _chunkWC573FCIcjs.logger.debug("No manual instrumentation modules configured");
163
188
  return [];
164
189
  }
165
190
  const instrumentations = [];
166
191
  const exceptionLogger = (error) => {
167
- _chunkJB6MA2RVcjs.logger.error(`Exception in manual instrumentation: ${String(error)}`);
192
+ _chunkWC573FCIcjs.logger.error(`Exception in manual instrumentation: ${String(error)}`);
168
193
  };
169
194
  this.loadManualInstrumentations(instrumentations, exceptionLogger);
170
- _chunkJB6MA2RVcjs.logger.info(`Loaded ${instrumentations.length} manual instrumentations`);
195
+ _chunkWC573FCIcjs.logger.info(`Loaded ${instrumentations.length} manual instrumentations`);
171
196
  return instrumentations;
172
197
  }
173
198
  }, _class);
@@ -444,7 +469,7 @@ function compilePatternEntries(patternEntries) {
444
469
  try {
445
470
  patternGroups.push(getGroupedPattern(patternEntry));
446
471
  } catch (error) {
447
- _chunkJB6MA2RVcjs.logger.warn(`Invalid pattern '${patternEntry.name}': ${patternEntry.pattern}`, error);
472
+ _chunkWC573FCIcjs.logger.warn(`Invalid pattern '${patternEntry.name}': ${patternEntry.pattern}`, error);
448
473
  continue;
449
474
  }
450
475
  }
@@ -454,7 +479,7 @@ function compilePatternEntries(patternEntries) {
454
479
  try {
455
480
  return new RegExp(patternGroups.join("|"));
456
481
  } catch (error) {
457
- _chunkJB6MA2RVcjs.logger.warn("Failed to compile pattern entries into regex", error);
482
+ _chunkWC573FCIcjs.logger.warn("Failed to compile pattern entries into regex", error);
458
483
  return null;
459
484
  }
460
485
  }
@@ -470,7 +495,7 @@ function getCompiledPatternsForRule(rule) {
470
495
  }
471
496
  function getCompiledAttributeNamePattern(rule) {
472
497
  if (!rule.attributePattern) {
473
- _chunkJB6MA2RVcjs.logger.debug("No attribute pattern provided, using default .*");
498
+ _chunkWC573FCIcjs.logger.debug("No attribute pattern provided, using default .*");
474
499
  return /.*/;
475
500
  }
476
501
  let compiledPatternString = rule.attributePattern;
@@ -481,12 +506,12 @@ function getCompiledAttributeNamePattern(rule) {
481
506
  }
482
507
  function shouldContinueExecution(startTime, iterations, timeoutMs) {
483
508
  if (Date.now() - startTime > timeoutMs) {
484
- _chunkJB6MA2RVcjs.logger.warn("Regex execution timed out - potential ReDoS pattern detected");
509
+ _chunkWC573FCIcjs.logger.warn("Regex execution timed out - potential ReDoS pattern detected");
485
510
  return false;
486
511
  }
487
512
  const maxIterations = 1e3;
488
513
  if (iterations > maxIterations) {
489
- _chunkJB6MA2RVcjs.logger.warn("Regex execution exceeded maximum iterations - potential ReDoS pattern detected");
514
+ _chunkWC573FCIcjs.logger.warn("Regex execution exceeded maximum iterations - potential ReDoS pattern detected");
490
515
  return false;
491
516
  }
492
517
  return true;
@@ -527,7 +552,7 @@ function maskStringByPattern(value, pattern, mode = "full") {
527
552
  });
528
553
  }
529
554
  } catch (error) {
530
- _chunkJB6MA2RVcjs.logger.warn("Regex execution failed, skipping masking", error);
555
+ _chunkWC573FCIcjs.logger.warn("Regex execution failed, skipping masking", error);
531
556
  return value;
532
557
  }
533
558
  for (const matchInfo of matches.toReversed()) {
@@ -546,7 +571,7 @@ function maskStringByPattern(value, pattern, mode = "full") {
546
571
  }
547
572
  }
548
573
  }
549
- _chunkJB6MA2RVcjs.logger.info(`Masking detected: pattern '${patternName}' found match in value`);
574
+ _chunkWC573FCIcjs.logger.info(`Masking detected: pattern '${patternName}' found match in value`);
550
575
  const masked = mode === "partial" ? matchInfo.text.at(0) + "*****" : "*****";
551
576
  value = value.slice(0, matchInfo.start) + masked + value.slice(matchInfo.end);
552
577
  }
@@ -555,7 +580,7 @@ function maskStringByPattern(value, pattern, mode = "full") {
555
580
  function maskStringByPatternBasedRule(value, rule) {
556
581
  const patternEntries = convertPatternsToPatternEntries(rule.patterns);
557
582
  if (patternEntries.length === 0) {
558
- _chunkJB6MA2RVcjs.logger.warn("No patterns provided for masking rule, returning original value");
583
+ _chunkWC573FCIcjs.logger.warn("No patterns provided for masking rule, returning original value");
559
584
  return value;
560
585
  }
561
586
  const mode = rule.mode;
@@ -599,7 +624,7 @@ function maskAttributes(attributes, rules, outputOriginalValue = false) {
599
624
  const value = maskedAttributes[attribute];
600
625
  if (value !== null && value !== void 0) {
601
626
  if (outputOriginalValue) {
602
- _chunkJB6MA2RVcjs.logger.debug(`Masking attribute '${attribute}' with original value`, { value });
627
+ _chunkWC573FCIcjs.logger.debug(`Masking attribute '${attribute}' with original value`, { value });
603
628
  }
604
629
  maskedAttributes[attribute] = maskValue(value, rule);
605
630
  }
@@ -619,7 +644,7 @@ var DEFAULT_LOG_MASKING_RULES = [
619
644
  var BrizzSimpleLogRecordProcessor = class extends _sdklogs.SimpleLogRecordProcessor {
620
645
 
621
646
  constructor(exporter, config) {
622
- super(exporter);
647
+ super({ exporter });
623
648
  this.config = config;
624
649
  }
625
650
  onEmit(logRecord) {
@@ -627,10 +652,10 @@ var BrizzSimpleLogRecordProcessor = class extends _sdklogs.SimpleLogRecordProces
627
652
  if (maskingConfig) {
628
653
  maskLog(logRecord, maskingConfig);
629
654
  }
630
- const associationProperties = _api.context.active().getValue(_chunkGCORRK6Bcjs.PROPERTIES_CONTEXT_KEY);
655
+ const associationProperties = _api.context.active().getValue(_chunkLIFLVFK6cjs.PROPERTIES_CONTEXT_KEY);
631
656
  if (associationProperties) {
632
657
  for (const [key, value] of Object.entries(associationProperties)) {
633
- logRecord.setAttribute(`${_chunkGCORRK6Bcjs.BRIZZ}.${key}`, value);
658
+ logRecord.setAttribute(`${_chunkLIFLVFK6cjs.BRIZZ}.${key}`, value);
634
659
  }
635
660
  }
636
661
  super.onEmit(logRecord);
@@ -639,7 +664,7 @@ var BrizzSimpleLogRecordProcessor = class extends _sdklogs.SimpleLogRecordProces
639
664
  var BrizzBatchLogRecordProcessor = class extends _sdklogs.BatchLogRecordProcessor {
640
665
 
641
666
  constructor(exporter, config) {
642
- super(exporter);
667
+ super({ exporter });
643
668
  this.config = config;
644
669
  }
645
670
  onEmit(logRecord) {
@@ -647,10 +672,10 @@ var BrizzBatchLogRecordProcessor = class extends _sdklogs.BatchLogRecordProcesso
647
672
  if (maskingConfig) {
648
673
  maskLog(logRecord, maskingConfig);
649
674
  }
650
- const associationProperties = _api.context.active().getValue(_chunkGCORRK6Bcjs.PROPERTIES_CONTEXT_KEY);
675
+ const associationProperties = _api.context.active().getValue(_chunkLIFLVFK6cjs.PROPERTIES_CONTEXT_KEY);
651
676
  if (associationProperties) {
652
677
  for (const [key, value] of Object.entries(associationProperties)) {
653
- logRecord.setAttribute(`${_chunkGCORRK6Bcjs.BRIZZ}.${key}`, value);
678
+ logRecord.setAttribute(`${_chunkLIFLVFK6cjs.BRIZZ}.${key}`, value);
654
679
  }
655
680
  }
656
681
  super.onEmit(logRecord);
@@ -677,7 +702,7 @@ function maskLog(logRecord, config) {
677
702
  newAttributes[key] = value;
678
703
  }
679
704
  for (const [key, value] of Object.entries(logRecord.attributes)) {
680
- if (key.startsWith(_chunkGCORRK6Bcjs.INTERNAL_EVENT_PREFIX)) {
705
+ if (key.startsWith(_chunkLIFLVFK6cjs.INTERNAL_EVENT_PREFIX)) {
681
706
  newAttributes[key] = value;
682
707
  }
683
708
  }
@@ -693,7 +718,7 @@ function maskLog(logRecord, config) {
693
718
  }
694
719
  return logRecord;
695
720
  } catch (error) {
696
- _chunkJB6MA2RVcjs.logger.error("Error masking log record:", error);
721
+ _chunkWC573FCIcjs.logger.error("Error masking log record:", error);
697
722
  return logRecord;
698
723
  }
699
724
  }
@@ -715,60 +740,60 @@ var LoggingModule = (_class2 = class _LoggingModule {constructor() { _class2.pro
715
740
  */
716
741
  initLogExporter(config) {
717
742
  if (this.logExporter) {
718
- _chunkJB6MA2RVcjs.logger.debug("Log exporter already initialized, skipping re-initialization");
743
+ _chunkWC573FCIcjs.logger.debug("Log exporter already initialized, skipping re-initialization");
719
744
  return;
720
745
  }
721
746
  if (config.customLogExporter) {
722
- _chunkJB6MA2RVcjs.logger.debug("Using custom log exporter");
747
+ _chunkWC573FCIcjs.logger.debug("Using custom log exporter");
723
748
  this.logExporter = config.customLogExporter;
724
- _chunkJB6MA2RVcjs.logger.debug("Custom log exporter initialized successfully");
749
+ _chunkWC573FCIcjs.logger.debug("Custom log exporter initialized successfully");
725
750
  return;
726
751
  }
727
752
  const logsUrl = config.baseUrl.replace(/\/$/, "") + "/v1/logs";
728
- _chunkJB6MA2RVcjs.logger.debug("Initializing default OTLP log exporter", { url: logsUrl });
753
+ _chunkWC573FCIcjs.logger.debug("Initializing default OTLP log exporter", { url: logsUrl });
729
754
  const headers = { ...config.headers };
730
755
  this.logExporter = new (0, _exporterlogsotlphttp.OTLPLogExporter)({
731
756
  url: logsUrl,
732
757
  headers
733
758
  });
734
- _chunkJB6MA2RVcjs.logger.debug("OTLP log exporter initialized successfully");
759
+ _chunkWC573FCIcjs.logger.debug("OTLP log exporter initialized successfully");
735
760
  }
736
761
  /**
737
762
  * Initialize the log processor with masking support
738
763
  */
739
764
  initLogProcessor(config) {
740
765
  if (this.logProcessor) {
741
- _chunkJB6MA2RVcjs.logger.debug("Log processor already initialized, skipping re-initialization");
766
+ _chunkWC573FCIcjs.logger.debug("Log processor already initialized, skipping re-initialization");
742
767
  return;
743
768
  }
744
769
  if (!this.logExporter) {
745
770
  throw new Error("Log exporter must be initialized before processor");
746
771
  }
747
- _chunkJB6MA2RVcjs.logger.debug("Initializing log processor", {
772
+ _chunkWC573FCIcjs.logger.debug("Initializing log processor", {
748
773
  disableBatch: config.disableBatch,
749
774
  hasMasking: !!_optionalChain([config, 'access', _33 => _33.masking, 'optionalAccess', _34 => _34.eventMasking])
750
775
  });
751
776
  this.logProcessor = config.disableBatch ? new BrizzSimpleLogRecordProcessor(this.logExporter, config) : new BrizzBatchLogRecordProcessor(this.logExporter, config);
752
- _chunkJB6MA2RVcjs.logger.debug("Log processor initialized successfully");
777
+ _chunkWC573FCIcjs.logger.debug("Log processor initialized successfully");
753
778
  }
754
779
  /**
755
780
  * Initialize the logger provider
756
781
  */
757
782
  initLoggerProvider(config) {
758
783
  if (this.loggerProvider) {
759
- _chunkJB6MA2RVcjs.logger.debug("Logger provider already initialized, skipping re-initialization");
784
+ _chunkWC573FCIcjs.logger.debug("Logger provider already initialized, skipping re-initialization");
760
785
  return;
761
786
  }
762
787
  if (!this.logProcessor) {
763
788
  throw new Error("Log processor must be initialized before logger provider");
764
789
  }
765
- _chunkJB6MA2RVcjs.logger.debug("Creating resource with service name", {
790
+ _chunkWC573FCIcjs.logger.debug("Creating resource with service name", {
766
791
  serviceName: config.appName
767
792
  });
768
793
  const resourceAttributes = {
769
794
  ...config.resourceAttributes,
770
795
  "service.name": config.appName,
771
- [BRIZZ_SDK_VERSION]: _chunkJB6MA2RVcjs.getSDKVersion.call(void 0, ),
796
+ [BRIZZ_SDK_VERSION]: _chunk3ITCDKTJcjs.getSDKVersion.call(void 0, ),
772
797
  [BRIZZ_SDK_LANGUAGE]: SDK_LANGUAGE
773
798
  };
774
799
  if (config.environment) {
@@ -778,29 +803,29 @@ var LoggingModule = (_class2 = class _LoggingModule {constructor() { _class2.pro
778
803
  resourceAttributes["service.version"] = config.appVersion;
779
804
  }
780
805
  const resource = _resources.resourceFromAttributes.call(void 0, resourceAttributes);
781
- _chunkJB6MA2RVcjs.logger.debug("Creating logger provider with resource");
806
+ _chunkWC573FCIcjs.logger.debug("Creating logger provider with resource");
782
807
  this.loggerProvider = new (0, _sdklogs.LoggerProvider)({
783
808
  resource,
784
809
  processors: [this.logProcessor]
785
810
  });
786
- _chunkJB6MA2RVcjs.logger.debug("Logger provider initialization completed");
811
+ _chunkWC573FCIcjs.logger.debug("Logger provider initialization completed");
787
812
  }
788
813
  /**
789
814
  * Initialize the logging module with the provided configuration
790
815
  */
791
816
  setup(config) {
792
- _chunkJB6MA2RVcjs.logger.info("Setting up logging module");
817
+ _chunkWC573FCIcjs.logger.info("Setting up logging module");
793
818
  this.initLogExporter(config);
794
819
  this.initLogProcessor(config);
795
820
  this.initLoggerProvider(config);
796
821
  _LoggingModule.instance = this;
797
- _chunkJB6MA2RVcjs.logger.info("Logging module setup completed");
822
+ _chunkWC573FCIcjs.logger.info("Logging module setup completed");
798
823
  }
799
824
  /**
800
825
  * Emit a custom event to the telemetry pipeline
801
826
  */
802
827
  emitEvent(name, attributes, body, severityNumber = _apilogs.SeverityNumber.INFO) {
803
- _chunkJB6MA2RVcjs.logger.debug("Attempting to emit event", {
828
+ _chunkWC573FCIcjs.logger.debug("Attempting to emit event", {
804
829
  name,
805
830
  hasAttributes: !!attributes,
806
831
  attributesCount: attributes ? Object.keys(attributes).length : 0,
@@ -808,17 +833,17 @@ var LoggingModule = (_class2 = class _LoggingModule {constructor() { _class2.pro
808
833
  severityNumber
809
834
  });
810
835
  if (!this.loggerProvider) {
811
- _chunkJB6MA2RVcjs.logger.error("Cannot emit event: Logger provider not initialized");
836
+ _chunkWC573FCIcjs.logger.error("Cannot emit event: Logger provider not initialized");
812
837
  throw new Error("Logging module not initialized");
813
838
  }
814
839
  const logAttributes = { "event.name": name };
815
840
  if (attributes) {
816
841
  Object.assign(logAttributes, attributes);
817
- _chunkJB6MA2RVcjs.logger.debug("Combined log attributes", { attributes: Object.keys(logAttributes) });
842
+ _chunkWC573FCIcjs.logger.debug("Combined log attributes", { attributes: Object.keys(logAttributes) });
818
843
  }
819
- _chunkJB6MA2RVcjs.logger.debug("Getting logger instance for brizz_events");
844
+ _chunkWC573FCIcjs.logger.debug("Getting logger instance for brizz_events");
820
845
  const eventLogger = this.loggerProvider.getLogger("brizz.events");
821
- _chunkJB6MA2RVcjs.logger.debug("Emitting log record with eventName", { eventName: name });
846
+ _chunkWC573FCIcjs.logger.debug("Emitting log record with eventName", { eventName: name });
822
847
  try {
823
848
  eventLogger.emit({
824
849
  eventName: name,
@@ -826,10 +851,10 @@ var LoggingModule = (_class2 = class _LoggingModule {constructor() { _class2.pro
826
851
  severityNumber,
827
852
  body
828
853
  });
829
- _chunkJB6MA2RVcjs.logger.debug("Event successfully emitted", { eventName: name });
854
+ _chunkWC573FCIcjs.logger.debug("Event successfully emitted", { eventName: name });
830
855
  } catch (error) {
831
- _chunkJB6MA2RVcjs.logger.error(`Failed to emit event '${name}'`, { error, eventName: name });
832
- _chunkJB6MA2RVcjs.logger.error("Log record that failed", {
856
+ _chunkWC573FCIcjs.logger.error(`Failed to emit event '${name}'`, { error, eventName: name });
857
+ _chunkWC573FCIcjs.logger.error("Log record that failed", {
833
858
  eventName: name,
834
859
  hasAttributes: logAttributes,
835
860
  severityNumber,
@@ -854,7 +879,7 @@ var LoggingModule = (_class2 = class _LoggingModule {constructor() { _class2.pro
854
879
  * Shutdown the logging module
855
880
  */
856
881
  async shutdown() {
857
- _chunkJB6MA2RVcjs.logger.debug("Shutting down logging module");
882
+ _chunkWC573FCIcjs.logger.debug("Shutting down logging module");
858
883
  if (this.loggerProvider) {
859
884
  await this.loggerProvider.shutdown();
860
885
  this.loggerProvider = null;
@@ -864,7 +889,7 @@ var LoggingModule = (_class2 = class _LoggingModule {constructor() { _class2.pro
864
889
  if (_LoggingModule.instance === this) {
865
890
  _LoggingModule.instance = null;
866
891
  }
867
- _chunkJB6MA2RVcjs.logger.debug("Logging module shutdown completed");
892
+ _chunkWC573FCIcjs.logger.debug("Logging module shutdown completed");
868
893
  }
869
894
  }, _class2.__initStatic(), _class2);
870
895
  function emitEvent(name, attributes, body, severityNumber = _apilogs.SeverityNumber.INFO) {
@@ -884,16 +909,16 @@ function setCurrentSpanCustomProperties(properties) {
884
909
  }
885
910
  for (const [key, value] of Object.entries(properties)) {
886
911
  try {
887
- current.setAttribute(`${_chunkGCORRK6Bcjs.BRIZZ}.${key}`, value);
912
+ current.setAttribute(`${_chunkLIFLVFK6cjs.BRIZZ}.${key}`, value);
888
913
  } catch (e) {
889
914
  }
890
915
  }
891
916
  }
892
917
  function callWithProperties(properties, fn, thisArg, ...args) {
893
918
  const base = _api.context.active();
894
- const prev = base.getValue(_chunkGCORRK6Bcjs.PROPERTIES_CONTEXT_KEY);
919
+ const prev = base.getValue(_chunkLIFLVFK6cjs.PROPERTIES_CONTEXT_KEY);
895
920
  const merged = prev ? { ...prev, ...properties } : properties;
896
- const next = base.setValue(_chunkGCORRK6Bcjs.PROPERTIES_CONTEXT_KEY, merged);
921
+ const next = base.setValue(_chunkLIFLVFK6cjs.PROPERTIES_CONTEXT_KEY, merged);
897
922
  return _api.context.with(next, fn, thisArg, ...args);
898
923
  }
899
924
  function withProperties(properties, fn, thisArg) {
@@ -906,14 +931,144 @@ function withProperties(properties, fn, thisArg) {
906
931
  );
907
932
  };
908
933
  }
934
+ function propagatePropertiesImperatively(properties) {
935
+ try {
936
+ 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]);
939
+ if (!store || typeof store.enterWith !== "function") {
940
+ return;
941
+ }
942
+ const base = _api.context.active();
943
+ const prev = base.getValue(_chunkLIFLVFK6cjs.PROPERTIES_CONTEXT_KEY);
944
+ const merged = prev ? { ...prev, ...properties } : properties;
945
+ store.enterWith(base.setValue(_chunkLIFLVFK6cjs.PROPERTIES_CONTEXT_KEY, merged));
946
+ } catch (e2) {
947
+ }
948
+ }
949
+ function setUser(user) {
950
+ const properties = { [_chunkLIFLVFK6cjs.USER_ID]: user.id };
951
+ if (user.email !== void 0) {
952
+ properties[_chunkLIFLVFK6cjs.USER_EMAIL] = user.email;
953
+ }
954
+ if (user.name !== void 0) {
955
+ properties[_chunkLIFLVFK6cjs.USER_NAME] = user.name;
956
+ }
957
+ if (user.role !== void 0) {
958
+ properties[_chunkLIFLVFK6cjs.USER_ROLE] = user.role;
959
+ }
960
+ if (user.plan !== void 0) {
961
+ properties[_chunkLIFLVFK6cjs.USER_PLAN] = user.plan;
962
+ }
963
+ if (user.traits) {
964
+ for (const [key, value] of Object.entries(user.traits)) {
965
+ const k = `user.${key}`;
966
+ if (properties[k] === void 0) {
967
+ properties[k] = value;
968
+ }
969
+ }
970
+ }
971
+ setCurrentSpanCustomProperties(properties);
972
+ propagatePropertiesImperatively(properties);
973
+ }
974
+ function setOrganization(org) {
975
+ const properties = { [_chunkLIFLVFK6cjs.ORGANIZATION_ID]: org.id };
976
+ if (org.name !== void 0) {
977
+ properties[_chunkLIFLVFK6cjs.ORGANIZATION_NAME] = org.name;
978
+ }
979
+ if (org.plan !== void 0) {
980
+ properties[_chunkLIFLVFK6cjs.ORGANIZATION_PLAN] = org.plan;
981
+ }
982
+ if (org.domain !== void 0) {
983
+ properties[_chunkLIFLVFK6cjs.ORGANIZATION_DOMAIN] = org.domain;
984
+ }
985
+ if (org.traits) {
986
+ for (const [key, value] of Object.entries(org.traits)) {
987
+ const k = `organization.${key}`;
988
+ if (properties[k] === void 0) {
989
+ properties[k] = value;
990
+ }
991
+ }
992
+ }
993
+ setCurrentSpanCustomProperties(properties);
994
+ propagatePropertiesImperatively(properties);
995
+ }
996
+ function setMessageId(id) {
997
+ const properties = { [_chunkLIFLVFK6cjs.MESSAGE_ID]: id };
998
+ setCurrentSpanCustomProperties(properties);
999
+ propagatePropertiesImperatively(properties);
1000
+ }
1001
+ function userProperties(user) {
1002
+ const properties = { [_chunkLIFLVFK6cjs.USER_ID]: user.id };
1003
+ if (user.email !== void 0) {
1004
+ properties[_chunkLIFLVFK6cjs.USER_EMAIL] = user.email;
1005
+ }
1006
+ if (user.name !== void 0) {
1007
+ properties[_chunkLIFLVFK6cjs.USER_NAME] = user.name;
1008
+ }
1009
+ if (user.role !== void 0) {
1010
+ properties[_chunkLIFLVFK6cjs.USER_ROLE] = user.role;
1011
+ }
1012
+ if (user.plan !== void 0) {
1013
+ properties[_chunkLIFLVFK6cjs.USER_PLAN] = user.plan;
1014
+ }
1015
+ if (user.traits) {
1016
+ for (const [key, value] of Object.entries(user.traits)) {
1017
+ const k = `user.${key}`;
1018
+ if (properties[k] === void 0) {
1019
+ properties[k] = value;
1020
+ }
1021
+ }
1022
+ }
1023
+ return properties;
1024
+ }
1025
+ function organizationProperties(org) {
1026
+ const properties = { [_chunkLIFLVFK6cjs.ORGANIZATION_ID]: org.id };
1027
+ if (org.name !== void 0) {
1028
+ properties[_chunkLIFLVFK6cjs.ORGANIZATION_NAME] = org.name;
1029
+ }
1030
+ if (org.plan !== void 0) {
1031
+ properties[_chunkLIFLVFK6cjs.ORGANIZATION_PLAN] = org.plan;
1032
+ }
1033
+ if (org.domain !== void 0) {
1034
+ properties[_chunkLIFLVFK6cjs.ORGANIZATION_DOMAIN] = org.domain;
1035
+ }
1036
+ if (org.traits) {
1037
+ for (const [key, value] of Object.entries(org.traits)) {
1038
+ const k = `organization.${key}`;
1039
+ if (properties[k] === void 0) {
1040
+ properties[k] = value;
1041
+ }
1042
+ }
1043
+ }
1044
+ return properties;
1045
+ }
1046
+ function callWithUser(user, fn, thisArg, ...args) {
1047
+ return callWithProperties(userProperties(user), fn, thisArg, ...args);
1048
+ }
1049
+ function withUser(user, fn, thisArg) {
1050
+ return withProperties(userProperties(user), fn, thisArg);
1051
+ }
1052
+ function callWithOrganization(org, fn, thisArg, ...args) {
1053
+ return callWithProperties(organizationProperties(org), fn, thisArg, ...args);
1054
+ }
1055
+ function withOrganization(org, fn, thisArg) {
1056
+ return withProperties(organizationProperties(org), fn, thisArg);
1057
+ }
1058
+ function callWithMessageId(id, fn, thisArg, ...args) {
1059
+ return callWithProperties({ [_chunkLIFLVFK6cjs.MESSAGE_ID]: id }, fn, thisArg, ...args);
1060
+ }
1061
+ function withMessageId(id, fn, thisArg) {
1062
+ return withProperties({ [_chunkLIFLVFK6cjs.MESSAGE_ID]: id }, fn, thisArg);
1063
+ }
909
1064
  function muteProperties(options) {
910
1065
  const { input = true, output = true } = options;
911
1066
  const properties = {};
912
1067
  if (input) {
913
- properties[_chunkGCORRK6Bcjs.MUTE_INPUT] = "true";
1068
+ properties[_chunkLIFLVFK6cjs.MUTE_INPUT] = "true";
914
1069
  }
915
1070
  if (output) {
916
- properties[_chunkGCORRK6Bcjs.MUTE_OUTPUT] = "true";
1071
+ properties[_chunkLIFLVFK6cjs.MUTE_OUTPUT] = "true";
917
1072
  }
918
1073
  return properties;
919
1074
  }
@@ -924,11 +1079,11 @@ function withMute(options, fn, thisArg) {
924
1079
  return withProperties(muteProperties(options), fn, thisArg);
925
1080
  }
926
1081
  function withSessionId(sessionId, fn, thisArg, extraProperties) {
927
- const properties = { [_chunkGCORRK6Bcjs.SESSION_ID]: sessionId, ...extraProperties };
1082
+ const properties = { [_chunkLIFLVFK6cjs.SESSION_ID]: sessionId, ...extraProperties };
928
1083
  return withProperties(properties, fn, thisArg);
929
1084
  }
930
1085
  function callWithSessionId(sessionId, fn, thisArg, ...args) {
931
- return callWithProperties({ [_chunkGCORRK6Bcjs.SESSION_ID]: sessionId }, fn, thisArg, ...args);
1086
+ return callWithProperties({ [_chunkLIFLVFK6cjs.SESSION_ID]: sessionId }, fn, thisArg, ...args);
932
1087
  }
933
1088
  var Session = (_class3 = class {
934
1089
 
@@ -956,8 +1111,8 @@ var Session = (_class3 = class {
956
1111
  setInput(text, context4) {
957
1112
  this.inputs.push(text);
958
1113
  this.inputContexts.push(_nullishCoalesce(context4, () => ( {})));
959
- this.span.setAttribute(_chunkGCORRK6Bcjs.SESSION_INPUT, JSON.stringify(this.inputs));
960
- this.span.setAttribute(_chunkGCORRK6Bcjs.SESSION_INPUT_CONTEXT, JSON.stringify(this.inputContexts));
1114
+ this.span.setAttribute(_chunkLIFLVFK6cjs.SESSION_INPUT, JSON.stringify(this.inputs));
1115
+ this.span.setAttribute(_chunkLIFLVFK6cjs.SESSION_INPUT_CONTEXT, JSON.stringify(this.inputContexts));
961
1116
  }
962
1117
  /**
963
1118
  * Append an assistant turn to session output tracking.
@@ -972,8 +1127,8 @@ var Session = (_class3 = class {
972
1127
  setOutput(text, context4) {
973
1128
  this.outputs.push(text);
974
1129
  this.outputContexts.push(_nullishCoalesce(context4, () => ( {})));
975
- this.span.setAttribute(_chunkGCORRK6Bcjs.SESSION_OUTPUT, JSON.stringify(this.outputs));
976
- this.span.setAttribute(_chunkGCORRK6Bcjs.SESSION_OUTPUT_CONTEXT, JSON.stringify(this.outputContexts));
1130
+ this.span.setAttribute(_chunkLIFLVFK6cjs.SESSION_OUTPUT, JSON.stringify(this.outputs));
1131
+ this.span.setAttribute(_chunkLIFLVFK6cjs.SESSION_OUTPUT_CONTEXT, JSON.stringify(this.outputContexts));
977
1132
  }
978
1133
  /**
979
1134
  * Set the session title on the span.
@@ -981,7 +1136,7 @@ var Session = (_class3 = class {
981
1136
  * @param title - The generated title string
982
1137
  */
983
1138
  setTitle(title) {
984
- this.span.setAttribute(_chunkGCORRK6Bcjs.SESSION_TITLE, title);
1139
+ this.span.setAttribute(_chunkLIFLVFK6cjs.SESSION_TITLE, title);
985
1140
  }
986
1141
  /**
987
1142
  * Update custom properties on the session span.
@@ -991,7 +1146,56 @@ var Session = (_class3 = class {
991
1146
  */
992
1147
  updateProperties(properties) {
993
1148
  for (const [key, value] of Object.entries(properties)) {
994
- this.span.setAttribute(`${_chunkGCORRK6Bcjs.BRIZZ}.${key}`, value);
1149
+ this.span.setAttribute(`${_chunkLIFLVFK6cjs.BRIZZ}.${key}`, value);
1150
+ }
1151
+ }
1152
+ /**
1153
+ * Set end-user identity on the session span: `brizz.user.id` and, when
1154
+ * provided, `brizz.user.email` / `brizz.user.name`. Undefined fields are omitted.
1155
+ *
1156
+ * @param user - User identity (`id` required; `email` / `name` optional)
1157
+ */
1158
+ setUser(user) {
1159
+ if (user.traits) {
1160
+ for (const [key, value] of Object.entries(user.traits)) {
1161
+ this.span.setAttribute(`${_chunkLIFLVFK6cjs.BRIZZ}.user.${key}`, value);
1162
+ }
1163
+ }
1164
+ this.span.setAttribute(`${_chunkLIFLVFK6cjs.BRIZZ}.${_chunkLIFLVFK6cjs.USER_ID}`, user.id);
1165
+ if (user.email !== void 0) {
1166
+ this.span.setAttribute(`${_chunkLIFLVFK6cjs.BRIZZ}.${_chunkLIFLVFK6cjs.USER_EMAIL}`, user.email);
1167
+ }
1168
+ if (user.name !== void 0) {
1169
+ this.span.setAttribute(`${_chunkLIFLVFK6cjs.BRIZZ}.${_chunkLIFLVFK6cjs.USER_NAME}`, user.name);
1170
+ }
1171
+ if (user.role !== void 0) {
1172
+ this.span.setAttribute(`${_chunkLIFLVFK6cjs.BRIZZ}.${_chunkLIFLVFK6cjs.USER_ROLE}`, user.role);
1173
+ }
1174
+ if (user.plan !== void 0) {
1175
+ this.span.setAttribute(`${_chunkLIFLVFK6cjs.BRIZZ}.${_chunkLIFLVFK6cjs.USER_PLAN}`, user.plan);
1176
+ }
1177
+ }
1178
+ /**
1179
+ * Set organization identity on the session span: `brizz.organization.id` and,
1180
+ * when provided, `brizz.organization.name`. Undefined fields are omitted.
1181
+ *
1182
+ * @param org - Organization identity (`id` required; `name` optional)
1183
+ */
1184
+ setOrganization(org) {
1185
+ if (org.traits) {
1186
+ for (const [key, value] of Object.entries(org.traits)) {
1187
+ this.span.setAttribute(`${_chunkLIFLVFK6cjs.BRIZZ}.organization.${key}`, value);
1188
+ }
1189
+ }
1190
+ this.span.setAttribute(`${_chunkLIFLVFK6cjs.BRIZZ}.${_chunkLIFLVFK6cjs.ORGANIZATION_ID}`, org.id);
1191
+ if (org.name !== void 0) {
1192
+ this.span.setAttribute(`${_chunkLIFLVFK6cjs.BRIZZ}.${_chunkLIFLVFK6cjs.ORGANIZATION_NAME}`, org.name);
1193
+ }
1194
+ if (org.plan !== void 0) {
1195
+ this.span.setAttribute(`${_chunkLIFLVFK6cjs.BRIZZ}.${_chunkLIFLVFK6cjs.ORGANIZATION_PLAN}`, org.plan);
1196
+ }
1197
+ if (org.domain !== void 0) {
1198
+ this.span.setAttribute(`${_chunkLIFLVFK6cjs.BRIZZ}.${_chunkLIFLVFK6cjs.ORGANIZATION_DOMAIN}`, org.domain);
995
1199
  }
996
1200
  }
997
1201
  /**
@@ -1007,7 +1211,7 @@ var Session = (_class3 = class {
1007
1211
  * (free-form category, defaults to `'generic'`)
1008
1212
  */
1009
1213
  addExternalLink(url, options) {
1010
- emitExternalLink(this.sessionId, url, _optionalChain([options, 'optionalAccess', _35 => _35.title]), _optionalChain([options, 'optionalAccess', _36 => _36.linkType]));
1214
+ emitExternalLink(this.sessionId, url, _optionalChain([options, 'optionalAccess', _38 => _38.title]), _optionalChain([options, 'optionalAccess', _39 => _39.linkType]));
1011
1215
  }
1012
1216
  }, _class3);
1013
1217
  var SessionTitle = class {
@@ -1021,56 +1225,106 @@ var SessionTitle = class {
1021
1225
  * @param title - The generated title string
1022
1226
  */
1023
1227
  setTitle(title) {
1024
- this.span.setAttribute(_chunkGCORRK6Bcjs.SESSION_TITLE, title);
1228
+ this.span.setAttribute(_chunkLIFLVFK6cjs.SESSION_TITLE, title);
1025
1229
  }
1026
1230
  };
1027
1231
  function getActiveSession() {
1028
- return _api.context.active().getValue(_chunkGCORRK6Bcjs.SESSION_OBJECT_CONTEXT_KEY);
1232
+ return _api.context.active().getValue(_chunkLIFLVFK6cjs.SESSION_OBJECT_CONTEXT_KEY);
1029
1233
  }
1030
1234
  function resolveSessionIdFromContext() {
1031
1235
  const active = getActiveSession();
1032
1236
  if (active) {
1033
1237
  return active.sessionId;
1034
1238
  }
1035
- const props = _api.context.active().getValue(_chunkGCORRK6Bcjs.PROPERTIES_CONTEXT_KEY);
1036
- return _optionalChain([props, 'optionalAccess', _37 => _37[_chunkGCORRK6Bcjs.SESSION_ID]]);
1239
+ const props = _api.context.active().getValue(_chunkLIFLVFK6cjs.PROPERTIES_CONTEXT_KEY);
1240
+ return _optionalChain([props, 'optionalAccess', _40 => _40[_chunkLIFLVFK6cjs.SESSION_ID]]);
1241
+ }
1242
+ function resolveMessageIdFromContext() {
1243
+ const props = _api.context.active().getValue(_chunkLIFLVFK6cjs.PROPERTIES_CONTEXT_KEY);
1244
+ return _optionalChain([props, 'optionalAccess', _41 => _41[_chunkLIFLVFK6cjs.MESSAGE_ID]]);
1037
1245
  }
1038
1246
  function emitExternalLink(sessionId, url, title, linkType) {
1039
1247
  try {
1040
- emitEventWithSessionId(sessionId, _chunkGCORRK6Bcjs.EXTERNAL_LINK_EVENT_NAME, {
1041
- [_chunkGCORRK6Bcjs.EXTERNAL_LINK_URL]: url,
1042
- [_chunkGCORRK6Bcjs.EXTERNAL_LINK_TITLE]: _nullishCoalesce(title, () => ( "")),
1043
- [_chunkGCORRK6Bcjs.EXTERNAL_LINK_TYPE]: _nullishCoalesce(linkType, () => ( "generic"))
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"))
1044
1252
  });
1045
1253
  } catch (error) {
1046
- _chunkJB6MA2RVcjs.logger.warn("addExternalLink: failed to emit external link", error);
1254
+ _chunkWC573FCIcjs.logger.warn("addExternalLink: failed to emit external link", error);
1047
1255
  }
1048
1256
  }
1049
1257
  function addExternalLink(url, options) {
1050
- const sessionId = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _38 => _38.sessionId]), () => ( resolveSessionIdFromContext()));
1258
+ const sessionId = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _42 => _42.sessionId]), () => ( resolveSessionIdFromContext()));
1051
1259
  if (!sessionId) {
1052
- _chunkJB6MA2RVcjs.logger.warn(
1260
+ _chunkWC573FCIcjs.logger.warn(
1053
1261
  "addExternalLink called without a resolvable session id; link dropped. Pass options.sessionId or call inside a startSession/callWithSessionId scope."
1054
1262
  );
1055
1263
  return;
1056
1264
  }
1057
- emitExternalLink(sessionId, url, _optionalChain([options, 'optionalAccess', _39 => _39.title]), _optionalChain([options, 'optionalAccess', _40 => _40.linkType]));
1265
+ emitExternalLink(sessionId, url, _optionalChain([options, 'optionalAccess', _43 => _43.title]), _optionalChain([options, 'optionalAccess', _44 => _44.linkType]));
1266
+ }
1267
+ 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;
1271
+ }
1272
+ if (_optionalChain([options, 'optionalAccess', _46 => _46.reason]) !== void 0) {
1273
+ attributes[_chunkLIFLVFK6cjs.FEEDBACK_REASON] = options.reason;
1274
+ }
1275
+ if (_optionalChain([options, 'optionalAccess', _47 => _47.comment]) !== void 0) {
1276
+ attributes[_chunkLIFLVFK6cjs.FEEDBACK_COMMENT] = options.comment;
1277
+ }
1278
+ if (_optionalChain([options, 'optionalAccess', _48 => _48.source]) !== void 0) {
1279
+ attributes[_chunkLIFLVFK6cjs.FEEDBACK_SOURCE] = options.source;
1280
+ }
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;
1286
+ }
1287
+ }
1288
+ }
1289
+ const messageId = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _50 => _50.messageId]), () => ( resolveMessageIdFromContext()));
1290
+ const sessionId = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _51 => _51.sessionId]), () => ( resolveSessionIdFromContext()));
1291
+ if (messageId === void 0 && sessionId === void 0) {
1292
+ _chunkWC573FCIcjs.logger.warn(
1293
+ "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."
1294
+ );
1295
+ }
1296
+ const anchor = {};
1297
+ if (messageId !== void 0) {
1298
+ anchor[_chunkLIFLVFK6cjs.MESSAGE_ID] = messageId;
1299
+ }
1300
+ if (sessionId !== void 0) {
1301
+ anchor[_chunkLIFLVFK6cjs.SESSION_ID] = sessionId;
1302
+ }
1303
+ try {
1304
+ if (Object.keys(anchor).length === 0) {
1305
+ emitEvent(_chunkLIFLVFK6cjs.FEEDBACK_EVENT_NAME, attributes);
1306
+ } else {
1307
+ callWithProperties(anchor, () => emitEvent(_chunkLIFLVFK6cjs.FEEDBACK_EVENT_NAME, attributes));
1308
+ }
1309
+ } catch (error) {
1310
+ _chunkWC573FCIcjs.logger.warn("recordFeedback: failed to emit feedback event", error);
1311
+ }
1058
1312
  }
1059
1313
  function startSession(sessionId, callback, extraProperties, options) {
1060
- const isTitle = _optionalChain([options, 'optionalAccess', _41 => _41.mode]) === "title";
1061
- const spanName = isTitle ? _chunkGCORRK6Bcjs.SESSION_TITLE_SPAN_NAME : _chunkGCORRK6Bcjs.SESSION_SPAN_NAME;
1314
+ const isTitle = _optionalChain([options, 'optionalAccess', _52 => _52.mode]) === "title";
1315
+ const spanName = isTitle ? _chunkLIFLVFK6cjs.SESSION_TITLE_SPAN_NAME : _chunkLIFLVFK6cjs.SESSION_SPAN_NAME;
1062
1316
  const tracer = _api.trace.getTracer("@brizz/sdk");
1063
1317
  return tracer.startActiveSpan(spanName, (span) => {
1064
- span.setAttribute(`${_chunkGCORRK6Bcjs.BRIZZ}.${_chunkGCORRK6Bcjs.SESSION_ID}`, sessionId);
1318
+ span.setAttribute(`${_chunkLIFLVFK6cjs.BRIZZ}.${_chunkLIFLVFK6cjs.SESSION_ID}`, sessionId);
1065
1319
  if (extraProperties) {
1066
1320
  for (const [key, value] of Object.entries(extraProperties)) {
1067
- span.setAttribute(`${_chunkGCORRK6Bcjs.BRIZZ}.${key}`, value);
1321
+ span.setAttribute(`${_chunkLIFLVFK6cjs.BRIZZ}.${key}`, value);
1068
1322
  }
1069
1323
  }
1070
1324
  const session = new Session(sessionId, span);
1071
- const contextProperties = { [_chunkGCORRK6Bcjs.SESSION_ID]: sessionId };
1325
+ const contextProperties = { [_chunkLIFLVFK6cjs.SESSION_ID]: sessionId };
1072
1326
  if (isTitle) {
1073
- contextProperties[_chunkGCORRK6Bcjs.SESSION_TITLE_GENERATION] = "true";
1327
+ contextProperties[_chunkLIFLVFK6cjs.SESSION_TITLE_GENERATION] = "true";
1074
1328
  }
1075
1329
  if (extraProperties) {
1076
1330
  for (const [key, value] of Object.entries(extraProperties)) {
@@ -1078,7 +1332,7 @@ function startSession(sessionId, callback, extraProperties, options) {
1078
1332
  }
1079
1333
  }
1080
1334
  return callWithProperties(contextProperties, () => {
1081
- const sessionCtx = _api.context.active().setValue(_chunkGCORRK6Bcjs.SESSION_OBJECT_CONTEXT_KEY, session);
1335
+ const sessionCtx = _api.context.active().setValue(_chunkLIFLVFK6cjs.SESSION_OBJECT_CONTEXT_KEY, session);
1082
1336
  return _api.context.with(sessionCtx, () => {
1083
1337
  try {
1084
1338
  const result = callback(session);
@@ -1106,16 +1360,16 @@ function startSession(sessionId, callback, extraProperties, options) {
1106
1360
  });
1107
1361
  }
1108
1362
  function startSessionTitle(callback, options) {
1109
- const resolvedSessionId = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _42 => _42.sessionId]), () => ( _optionalChain([getActiveSession, 'call', _43 => _43(), 'optionalAccess', _44 => _44.sessionId])));
1363
+ const resolvedSessionId = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _53 => _53.sessionId]), () => ( _optionalChain([getActiveSession, 'call', _54 => _54(), 'optionalAccess', _55 => _55.sessionId])));
1110
1364
  const tracer = _api.trace.getTracer("@brizz/sdk");
1111
- return tracer.startActiveSpan(_chunkGCORRK6Bcjs.SESSION_TITLE_SPAN_NAME, (span) => {
1365
+ return tracer.startActiveSpan(_chunkLIFLVFK6cjs.SESSION_TITLE_SPAN_NAME, (span) => {
1112
1366
  if (resolvedSessionId) {
1113
- span.setAttribute(`${_chunkGCORRK6Bcjs.BRIZZ}.${_chunkGCORRK6Bcjs.SESSION_ID}`, resolvedSessionId);
1367
+ span.setAttribute(`${_chunkLIFLVFK6cjs.BRIZZ}.${_chunkLIFLVFK6cjs.SESSION_ID}`, resolvedSessionId);
1114
1368
  }
1115
1369
  const sessionTitle = new SessionTitle(span);
1116
- const properties = { [_chunkGCORRK6Bcjs.SESSION_TITLE_GENERATION]: "true" };
1370
+ const properties = { [_chunkLIFLVFK6cjs.SESSION_TITLE_GENERATION]: "true" };
1117
1371
  if (resolvedSessionId) {
1118
- properties[_chunkGCORRK6Bcjs.SESSION_ID] = resolvedSessionId;
1372
+ properties[_chunkLIFLVFK6cjs.SESSION_ID] = resolvedSessionId;
1119
1373
  }
1120
1374
  return callWithProperties(properties, () => {
1121
1375
  try {
@@ -1161,32 +1415,32 @@ var MetricsModule = (_class4 = class _MetricsModule {constructor() { _class4.pro
1161
1415
  */
1162
1416
  initMetricsExporter(config) {
1163
1417
  if (this.metricsExporter) {
1164
- _chunkJB6MA2RVcjs.logger.debug("Metrics exporter already initialized, skipping re-initialization");
1418
+ _chunkWC573FCIcjs.logger.debug("Metrics exporter already initialized, skipping re-initialization");
1165
1419
  return;
1166
1420
  }
1167
1421
  const metricsUrl = config.baseUrl.replace(/\/$/, "") + "/v1/metrics";
1168
- _chunkJB6MA2RVcjs.logger.debug("Initializing metrics exporter", { url: metricsUrl });
1422
+ _chunkWC573FCIcjs.logger.debug("Initializing metrics exporter", { url: metricsUrl });
1169
1423
  this.metricsExporter = new (0, _exportermetricsotlphttp.OTLPMetricExporter)({
1170
1424
  url: metricsUrl,
1171
1425
  headers: config.headers
1172
1426
  });
1173
- _chunkJB6MA2RVcjs.logger.debug("Metrics exporter initialized successfully");
1427
+ _chunkWC573FCIcjs.logger.debug("Metrics exporter initialized successfully");
1174
1428
  }
1175
1429
  /**
1176
1430
  * Initialize the metrics reader
1177
1431
  */
1178
1432
  initMetricsReader(config) {
1179
1433
  if (this.metricsReader) {
1180
- _chunkJB6MA2RVcjs.logger.debug("Metrics reader already initialized, skipping re-initialization");
1434
+ _chunkWC573FCIcjs.logger.debug("Metrics reader already initialized, skipping re-initialization");
1181
1435
  return;
1182
1436
  }
1183
1437
  if (config.customMetricReader) {
1184
- _chunkJB6MA2RVcjs.logger.debug("Using custom metric reader");
1438
+ _chunkWC573FCIcjs.logger.debug("Using custom metric reader");
1185
1439
  this.metricsReader = config.customMetricReader;
1186
- _chunkJB6MA2RVcjs.logger.debug("Custom metric reader initialized successfully");
1440
+ _chunkWC573FCIcjs.logger.debug("Custom metric reader initialized successfully");
1187
1441
  return;
1188
1442
  }
1189
- _chunkJB6MA2RVcjs.logger.debug(
1443
+ _chunkWC573FCIcjs.logger.debug(
1190
1444
  "Using default metrics flow - creating OTLP exporter and PeriodicExportingMetricReader"
1191
1445
  );
1192
1446
  this.initMetricsExporter(config);
@@ -1196,16 +1450,16 @@ var MetricsModule = (_class4 = class _MetricsModule {constructor() { _class4.pro
1196
1450
  this.metricsReader = new (0, _sdkmetrics.PeriodicExportingMetricReader)({
1197
1451
  exporter: this.metricsExporter
1198
1452
  });
1199
- _chunkJB6MA2RVcjs.logger.debug("Default metrics reader initialized successfully");
1453
+ _chunkWC573FCIcjs.logger.debug("Default metrics reader initialized successfully");
1200
1454
  }
1201
1455
  /**
1202
1456
  * Initialize the metrics module with the provided configuration
1203
1457
  */
1204
1458
  setup(config) {
1205
- _chunkJB6MA2RVcjs.logger.info("Setting up metrics module");
1459
+ _chunkWC573FCIcjs.logger.info("Setting up metrics module");
1206
1460
  this.initMetricsReader(config);
1207
1461
  _MetricsModule.instance = this;
1208
- _chunkJB6MA2RVcjs.logger.info("Metrics module setup completed");
1462
+ _chunkWC573FCIcjs.logger.info("Metrics module setup completed");
1209
1463
  }
1210
1464
  /**
1211
1465
  * Get the metrics exporter
@@ -1229,13 +1483,13 @@ var MetricsModule = (_class4 = class _MetricsModule {constructor() { _class4.pro
1229
1483
  * Shutdown the metrics module
1230
1484
  */
1231
1485
  shutdown() {
1232
- _chunkJB6MA2RVcjs.logger.debug("Shutting down metrics module");
1486
+ _chunkWC573FCIcjs.logger.debug("Shutting down metrics module");
1233
1487
  this.metricsReader = null;
1234
1488
  this.metricsExporter = null;
1235
1489
  if (_MetricsModule.instance === this) {
1236
1490
  _MetricsModule.instance = null;
1237
1491
  }
1238
- _chunkJB6MA2RVcjs.logger.debug("Metrics module shutdown completed");
1492
+ _chunkWC573FCIcjs.logger.debug("Metrics module shutdown completed");
1239
1493
  }
1240
1494
  }, _class4.__initStatic2(), _class4);
1241
1495
  function getMetricsExporter() {
@@ -1260,7 +1514,7 @@ var BrizzSpanExporter = class {
1260
1514
  const resourceAttrs = {
1261
1515
  ...config.resourceAttributes,
1262
1516
  "service.name": config.appName,
1263
- [BRIZZ_SDK_VERSION]: _chunkJB6MA2RVcjs.getSDKVersion.call(void 0, ),
1517
+ [BRIZZ_SDK_VERSION]: _chunk3ITCDKTJcjs.getSDKVersion.call(void 0, ),
1264
1518
  [BRIZZ_SDK_LANGUAGE]: SDK_LANGUAGE
1265
1519
  };
1266
1520
  if (config.environment) {
@@ -1291,7 +1545,7 @@ var BrizzSpanExporter = class {
1291
1545
  try {
1292
1546
  return Promise.resolve(filter(span));
1293
1547
  } catch (error) {
1294
- _chunkJB6MA2RVcjs.logger.warn("beforeSendSpan threw; span will be kept", { error });
1548
+ _chunkWC573FCIcjs.logger.warn("beforeSendSpan threw; span will be kept", { error });
1295
1549
  return Promise.resolve(true);
1296
1550
  }
1297
1551
  });
@@ -1304,7 +1558,7 @@ var BrizzSpanExporter = class {
1304
1558
  this._delegate.export(filtered, resultCallback);
1305
1559
  return;
1306
1560
  }).catch((error) => {
1307
- _chunkJB6MA2RVcjs.logger.warn("beforeSendSpan rejected; all spans will be kept", { error });
1561
+ _chunkWC573FCIcjs.logger.warn("beforeSendSpan rejected; all spans will be kept", { error });
1308
1562
  this._delegate.export(patchedSpans, resultCallback);
1309
1563
  });
1310
1564
  }
@@ -1312,7 +1566,7 @@ var BrizzSpanExporter = class {
1312
1566
  return this._delegate.shutdown();
1313
1567
  }
1314
1568
  async forceFlush() {
1315
- return _optionalChain([this, 'access', _45 => _45._delegate, 'access', _46 => _46.forceFlush, 'optionalCall', _47 => _47()]);
1569
+ return _optionalChain([this, 'access', _56 => _56._delegate, 'access', _57 => _57.forceFlush, 'optionalCall', _58 => _58()]);
1316
1570
  }
1317
1571
  };
1318
1572
 
@@ -1323,10 +1577,10 @@ var BrizzSpanExporter = class {
1323
1577
 
1324
1578
  var _sdktracebase = require('@opentelemetry/sdk-trace-base');
1325
1579
  function applyContextAttributes(span) {
1326
- const sessionProperties = _api.context.active().getValue(_chunkGCORRK6Bcjs.PROPERTIES_CONTEXT_KEY);
1580
+ const sessionProperties = _api.context.active().getValue(_chunkLIFLVFK6cjs.PROPERTIES_CONTEXT_KEY);
1327
1581
  if (sessionProperties) {
1328
1582
  for (const [key, value] of Object.entries(sessionProperties)) {
1329
- span.setAttribute(`${_chunkGCORRK6Bcjs.BRIZZ}.${key}`, value);
1583
+ span.setAttribute(`${_chunkLIFLVFK6cjs.BRIZZ}.${key}`, value);
1330
1584
  }
1331
1585
  }
1332
1586
  }
@@ -1347,7 +1601,7 @@ var BrizzSimpleSpanProcessor = class extends _sdktracebase.SimpleSpanProcessor {
1347
1601
  super.onStart(span, parentContext);
1348
1602
  }
1349
1603
  onEnd(span) {
1350
- const maskingConfig = _optionalChain([this, 'access', _48 => _48.config, 'access', _49 => _49.masking, 'optionalAccess', _50 => _50.spanMasking]);
1604
+ const maskingConfig = _optionalChain([this, 'access', _59 => _59.config, 'access', _60 => _60.masking, 'optionalAccess', _61 => _61.spanMasking]);
1351
1605
  if (maskingConfig) {
1352
1606
  maskReadableSpan(span, maskingConfig);
1353
1607
  }
@@ -1365,7 +1619,7 @@ var BrizzBatchSpanProcessor = class extends _sdktracebase.BatchSpanProcessor {
1365
1619
  super.onStart(span, parentContext);
1366
1620
  }
1367
1621
  onEnd(span) {
1368
- const maskingConfig = _optionalChain([this, 'access', _51 => _51.config, 'access', _52 => _52.masking, 'optionalAccess', _53 => _53.spanMasking]);
1622
+ const maskingConfig = _optionalChain([this, 'access', _62 => _62.config, 'access', _63 => _63.masking, 'optionalAccess', _64 => _64.spanMasking]);
1369
1623
  if (maskingConfig) {
1370
1624
  maskReadableSpan(span, maskingConfig);
1371
1625
  }
@@ -1394,7 +1648,7 @@ function maskReadableSpan(span, config) {
1394
1648
  }
1395
1649
  }
1396
1650
  } catch (error) {
1397
- _chunkJB6MA2RVcjs.logger.error("Error masking span", { err: error });
1651
+ _chunkWC573FCIcjs.logger.error("Error masking span", { err: error });
1398
1652
  }
1399
1653
  }
1400
1654
 
@@ -1414,50 +1668,50 @@ var TracingModule = (_class5 = class _TracingModule {constructor() { _class5.pro
1414
1668
  */
1415
1669
  initSpanExporter(config) {
1416
1670
  if (this.spanExporter) {
1417
- _chunkJB6MA2RVcjs.logger.debug("Span exporter already initialized, skipping re-initialization");
1671
+ _chunkWC573FCIcjs.logger.debug("Span exporter already initialized, skipping re-initialization");
1418
1672
  return;
1419
1673
  }
1420
1674
  if (config.customSpanExporter) {
1421
- _chunkJB6MA2RVcjs.logger.debug("Using custom span exporter");
1675
+ _chunkWC573FCIcjs.logger.debug("Using custom span exporter");
1422
1676
  this.spanExporter = new BrizzSpanExporter(config.customSpanExporter, config);
1423
- _chunkJB6MA2RVcjs.logger.debug("Custom span exporter initialized successfully");
1677
+ _chunkWC573FCIcjs.logger.debug("Custom span exporter initialized successfully");
1424
1678
  return;
1425
1679
  }
1426
1680
  const tracesUrl = config.baseUrl.replace(/\/$/, "") + "/v1/traces";
1427
- _chunkJB6MA2RVcjs.logger.debug("Initializing default OTLP span exporter", { url: tracesUrl });
1681
+ _chunkWC573FCIcjs.logger.debug("Initializing default OTLP span exporter", { url: tracesUrl });
1428
1682
  const otlpExporter = new (0, _exportertraceotlpproto.OTLPTraceExporter)({
1429
1683
  url: tracesUrl,
1430
1684
  headers: config.headers
1431
1685
  });
1432
1686
  this.spanExporter = new BrizzSpanExporter(otlpExporter, config);
1433
- _chunkJB6MA2RVcjs.logger.debug("OTLP span exporter initialized successfully");
1687
+ _chunkWC573FCIcjs.logger.debug("OTLP span exporter initialized successfully");
1434
1688
  }
1435
1689
  /**
1436
1690
  * Initialize the span processor with masking support
1437
1691
  */
1438
1692
  initSpanProcessor(config) {
1439
1693
  if (this.spanProcessor) {
1440
- _chunkJB6MA2RVcjs.logger.debug("Span processor already initialized, skipping re-initialization");
1694
+ _chunkWC573FCIcjs.logger.debug("Span processor already initialized, skipping re-initialization");
1441
1695
  return;
1442
1696
  }
1443
1697
  if (!this.spanExporter) {
1444
1698
  throw new Error("Span exporter must be initialized before processor");
1445
1699
  }
1446
- _chunkJB6MA2RVcjs.logger.debug("Initializing span processor", {
1700
+ _chunkWC573FCIcjs.logger.debug("Initializing span processor", {
1447
1701
  disableBatch: config.disableBatch,
1448
- hasMasking: !!_optionalChain([config, 'access', _54 => _54.masking, 'optionalAccess', _55 => _55.spanMasking])
1702
+ hasMasking: !!_optionalChain([config, 'access', _65 => _65.masking, 'optionalAccess', _66 => _66.spanMasking])
1449
1703
  });
1450
1704
  const spanProcessor = config.disableBatch ? new BrizzSimpleSpanProcessor(this.spanExporter, config) : new BrizzBatchSpanProcessor(this.spanExporter, config);
1451
- _chunkJB6MA2RVcjs.logger.debug("Span processor initialized successfully");
1705
+ _chunkWC573FCIcjs.logger.debug("Span processor initialized successfully");
1452
1706
  this.spanProcessor = spanProcessor;
1453
1707
  }
1454
1708
  /**
1455
1709
  * Initialize the tracing module with the provided configuration
1456
1710
  */
1457
1711
  setup(config) {
1458
- _chunkJB6MA2RVcjs.logger.info("Setting up tracing module");
1712
+ _chunkWC573FCIcjs.logger.info("Setting up tracing module");
1459
1713
  if (config.disableSpanExporter) {
1460
- _chunkJB6MA2RVcjs.logger.info(
1714
+ _chunkWC573FCIcjs.logger.info(
1461
1715
  "Span exporter disabled via disableSpanExporter; skipping exporter and processor setup"
1462
1716
  );
1463
1717
  this.spanExporter = null;
@@ -1468,7 +1722,7 @@ var TracingModule = (_class5 = class _TracingModule {constructor() { _class5.pro
1468
1722
  this.initSpanExporter(config);
1469
1723
  this.initSpanProcessor(config);
1470
1724
  _TracingModule.instance = this;
1471
- _chunkJB6MA2RVcjs.logger.info("Tracing module setup completed");
1725
+ _chunkWC573FCIcjs.logger.info("Tracing module setup completed");
1472
1726
  }
1473
1727
  /**
1474
1728
  * Get the span exporter
@@ -1489,7 +1743,7 @@ var TracingModule = (_class5 = class _TracingModule {constructor() { _class5.pro
1489
1743
  return this.spanProcessor;
1490
1744
  }
1491
1745
  async shutdown() {
1492
- _chunkJB6MA2RVcjs.logger.debug("Shutting down tracing module");
1746
+ _chunkWC573FCIcjs.logger.debug("Shutting down tracing module");
1493
1747
  if (this.spanProcessor) {
1494
1748
  await this.spanProcessor.shutdown();
1495
1749
  this.spanProcessor = null;
@@ -1499,7 +1753,7 @@ var TracingModule = (_class5 = class _TracingModule {constructor() { _class5.pro
1499
1753
  this.spanExporter = null;
1500
1754
  }
1501
1755
  _TracingModule.instance = null;
1502
- _chunkJB6MA2RVcjs.logger.debug("Tracing module shutdown completed");
1756
+ _chunkWC573FCIcjs.logger.debug("Tracing module shutdown completed");
1503
1757
  }
1504
1758
  }, _class5.__initStatic3(), _class5);
1505
1759
  function getSpanExporter() {
@@ -1523,50 +1777,18 @@ var _instrumentation = require('@opentelemetry/instrumentation');
1523
1777
 
1524
1778
  var _sdktracenode = require('@opentelemetry/sdk-trace-node');
1525
1779
 
1526
- // src/internal/dsn.ts
1527
- var PLACEHOLDER_SERVICE = "<service-name>";
1528
- var SERVICE_NAME_HEADER = "X-Brizz-Service-Name";
1529
- function parseDSN(dsn) {
1530
- let parsed;
1531
- try {
1532
- parsed = new globalThis.URL(dsn);
1533
- } catch (e2) {
1534
- return null;
1535
- }
1536
- if (parsed.protocol !== "http:" && parsed.protocol !== "https:" || !parsed.username || !parsed.host) {
1537
- return null;
1538
- }
1539
- const scheme = parsed.protocol === "https:" ? "https" : "http";
1540
- let service;
1541
- try {
1542
- service = decodeURIComponent(parsed.pathname.replace(/^\//, ""));
1543
- } catch (e3) {
1544
- return null;
1545
- }
1546
- if (service === "" || service === PLACEHOLDER_SERVICE) {
1547
- return null;
1548
- }
1549
- return {
1550
- scheme,
1551
- host: parsed.host,
1552
- bearer: decodeURIComponent(parsed.username),
1553
- service,
1554
- baseUrl: `${scheme}://${parsed.host}`
1555
- };
1556
- }
1557
-
1558
1780
  // src/internal/config.ts
1559
1781
  function resolveConfig(options) {
1560
- const envLogLevel = process.env["BRIZZ_LOG_LEVEL"] || _optionalChain([options, 'access', _56 => _56.logLevel, 'optionalAccess', _57 => _57.toString, 'call', _58 => _58()]) || _chunkJB6MA2RVcjs.DEFAULT_LOG_LEVEL.toString();
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();
1561
1783
  let resolvedLogLevel;
1562
1784
  if (envLogLevel) {
1563
- resolvedLogLevel = _chunkJB6MA2RVcjs.parseLogLevel.call(void 0, envLogLevel);
1785
+ resolvedLogLevel = _chunkWC573FCIcjs.parseLogLevel.call(void 0, envLogLevel);
1564
1786
  } else if (typeof options.logLevel === "string") {
1565
- resolvedLogLevel = _chunkJB6MA2RVcjs.parseLogLevel.call(void 0, options.logLevel);
1787
+ resolvedLogLevel = _chunkWC573FCIcjs.parseLogLevel.call(void 0, options.logLevel);
1566
1788
  } else {
1567
- resolvedLogLevel = options.logLevel || _chunkJB6MA2RVcjs.DEFAULT_LOG_LEVEL;
1789
+ resolvedLogLevel = options.logLevel || _chunkWC573FCIcjs.DEFAULT_LOG_LEVEL;
1568
1790
  }
1569
- _chunkJB6MA2RVcjs.setLogLevel.call(void 0, resolvedLogLevel);
1791
+ _chunkWC573FCIcjs.setLogLevel.call(void 0, resolvedLogLevel);
1570
1792
  let maskingStatus;
1571
1793
  if (options.masking === true) {
1572
1794
  maskingStatus = "enabled";
@@ -1577,7 +1799,7 @@ function resolveConfig(options) {
1577
1799
  } else {
1578
1800
  maskingStatus = "default-disabled";
1579
1801
  }
1580
- _chunkJB6MA2RVcjs.logger.debug("Starting configuration resolution", {
1802
+ _chunkWC573FCIcjs.logger.debug("Starting configuration resolution", {
1581
1803
  appName: options.appName,
1582
1804
  baseUrl: options.baseUrl,
1583
1805
  hasApiKey: !!options.apiKey,
@@ -1631,14 +1853,14 @@ function resolveConfig(options) {
1631
1853
  (name) => process.env[name] !== void 0
1632
1854
  );
1633
1855
  if (envConflicts.length > 0) {
1634
- _chunkJB6MA2RVcjs.logger.warn(
1856
+ _chunkWC573FCIcjs.logger.warn(
1635
1857
  `Ignoring ${envConflicts.join(", ")} \u2014 dsn / BRIZZ_DSN takes precedence.`
1636
1858
  );
1637
1859
  }
1638
1860
  resolvedConfig.apiKey = void 0;
1639
1861
  resolvedConfig.baseUrl = "https://telemetry.brizz.dev";
1640
1862
  resolvedConfig.appName = "unknown-app";
1641
- parsedDSN = parseDSN(dsnInput);
1863
+ parsedDSN = _chunkUNLNNKZ7cjs.parseDSN.call(void 0, dsnInput);
1642
1864
  if (parsedDSN) {
1643
1865
  resolvedConfig.appName = parsedDSN.service;
1644
1866
  resolvedConfig.baseUrl = parsedDSN.baseUrl;
@@ -1651,16 +1873,16 @@ function resolveConfig(options) {
1651
1873
  try {
1652
1874
  const envHeaders = JSON.parse(process.env["BRIZZ_HEADERS"]);
1653
1875
  Object.assign(resolvedConfig.headers, envHeaders);
1654
- _chunkJB6MA2RVcjs.logger.debug("Added headers from environment variable", {
1876
+ _chunkWC573FCIcjs.logger.debug("Added headers from environment variable", {
1655
1877
  headers: Object.keys(envHeaders)
1656
1878
  });
1657
1879
  } catch (error) {
1658
- _chunkJB6MA2RVcjs.logger.error("Failed to parse BRIZZ_HEADERS environment variable", { error });
1880
+ _chunkWC573FCIcjs.logger.error("Failed to parse BRIZZ_HEADERS environment variable", { error });
1659
1881
  throw new Error("Invalid JSON in BRIZZ_HEADERS environment variable", { cause: error });
1660
1882
  }
1661
1883
  }
1662
1884
  if (dsnInput) {
1663
- const authHeaderKeys = /* @__PURE__ */ new Set(["authorization", SERVICE_NAME_HEADER.toLowerCase()]);
1885
+ const authHeaderKeys = /* @__PURE__ */ new Set(["authorization", _chunkUNLNNKZ7cjs.SERVICE_NAME_HEADER.toLowerCase()]);
1664
1886
  resolvedConfig.headers = Object.fromEntries(
1665
1887
  Object.entries(resolvedConfig.headers).filter(
1666
1888
  ([key]) => !authHeaderKeys.has(key.toLowerCase())
@@ -1668,10 +1890,10 @@ function resolveConfig(options) {
1668
1890
  );
1669
1891
  if (parsedDSN) {
1670
1892
  resolvedConfig.headers["Authorization"] = `Bearer ${parsedDSN.bearer}`;
1671
- resolvedConfig.headers[SERVICE_NAME_HEADER] = parsedDSN.service;
1893
+ resolvedConfig.headers[_chunkUNLNNKZ7cjs.SERVICE_NAME_HEADER] = parsedDSN.service;
1672
1894
  }
1673
1895
  }
1674
- _chunkJB6MA2RVcjs.logger.debug("Configuration resolved with environment variables", {
1896
+ _chunkWC573FCIcjs.logger.debug("Configuration resolved with environment variables", {
1675
1897
  appName: resolvedConfig.appName,
1676
1898
  baseUrl: resolvedConfig.baseUrl,
1677
1899
  hasApiKey: !!resolvedConfig.apiKey,
@@ -1720,7 +1942,7 @@ var _Brizz = (_class6 = class __Brizz {constructor() { _class6.prototype.__init1
1720
1942
  */
1721
1943
  createAndStartProviders(options, resolvedConfig) {
1722
1944
  if (options.disableNodeSdk) {
1723
- _chunkJB6MA2RVcjs.logger.info("NodeSDK disabled - only telemetry modules initialized");
1945
+ _chunkWC573FCIcjs.logger.info("NodeSDK disabled - only telemetry modules initialized");
1724
1946
  return;
1725
1947
  }
1726
1948
  const registry = InstrumentationRegistry.getInstance();
@@ -1728,7 +1950,7 @@ var _Brizz = (_class6 = class __Brizz {constructor() { _class6.prototype.__init1
1728
1950
  const resourceAttributes = {
1729
1951
  ...resolvedConfig.resourceAttributes,
1730
1952
  "service.name": resolvedConfig.appName,
1731
- [BRIZZ_SDK_VERSION]: _chunkJB6MA2RVcjs.getSDKVersion.call(void 0, ),
1953
+ [BRIZZ_SDK_VERSION]: _chunk3ITCDKTJcjs.getSDKVersion.call(void 0, ),
1732
1954
  [BRIZZ_SDK_LANGUAGE]: SDK_LANGUAGE
1733
1955
  };
1734
1956
  if (resolvedConfig.environment) {
@@ -1740,18 +1962,18 @@ var _Brizz = (_class6 = class __Brizz {constructor() { _class6.prototype.__init1
1740
1962
  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));
1741
1963
  this._tracerProvider = new (0, _sdktracenode.NodeTracerProvider)({
1742
1964
  resource,
1743
- spanProcessors: resolvedConfig.disableSpanExporter ? [] : [new (0, _chunkLTXMCGVQcjs.InterruptPropagator)(), getSpanProcessor()]
1965
+ spanProcessors: resolvedConfig.disableSpanExporter ? [] : [new (0, _chunkLFLYWZ6Dcjs.InterruptPropagator)(), getSpanProcessor()]
1744
1966
  });
1745
1967
  this._tracerProvider.register();
1746
1968
  this._meterProvider = new (0, _sdkmetrics.MeterProvider)({ resource, readers: [getMetricsReader()] });
1747
1969
  _api.metrics.setGlobalMeterProvider(this._meterProvider);
1748
1970
  if (manualInstrumentations.length > 0) {
1749
1971
  _instrumentation.registerInstrumentations.call(void 0, { instrumentations: manualInstrumentations });
1750
- _chunkJB6MA2RVcjs.logger.info(
1972
+ _chunkWC573FCIcjs.logger.info(
1751
1973
  `Telemetry providers started with ${manualInstrumentations.length} manual instrumentations`
1752
1974
  );
1753
1975
  } else {
1754
- _chunkJB6MA2RVcjs.logger.info(
1976
+ _chunkWC573FCIcjs.logger.info(
1755
1977
  "Telemetry providers started - using auto-instrumentations loaded at import time"
1756
1978
  );
1757
1979
  }
@@ -1766,17 +1988,17 @@ var _Brizz = (_class6 = class __Brizz {constructor() { _class6.prototype.__init1
1766
1988
  * @private
1767
1989
  */
1768
1990
  initializeModules(config) {
1769
- _chunkJB6MA2RVcjs.logger.info("Initializing telemetry modules");
1770
- _chunkJB6MA2RVcjs.logger.debug("Initializing tracing module");
1991
+ _chunkWC573FCIcjs.logger.info("Initializing telemetry modules");
1992
+ _chunkWC573FCIcjs.logger.debug("Initializing tracing module");
1771
1993
  const tracingModule = new TracingModule();
1772
1994
  tracingModule.setup(config);
1773
- _chunkJB6MA2RVcjs.logger.debug("Initializing metrics module");
1995
+ _chunkWC573FCIcjs.logger.debug("Initializing metrics module");
1774
1996
  const metricsModule = new MetricsModule();
1775
1997
  metricsModule.setup(config);
1776
- _chunkJB6MA2RVcjs.logger.debug("Initializing logging module");
1998
+ _chunkWC573FCIcjs.logger.debug("Initializing logging module");
1777
1999
  const loggingModule = new LoggingModule();
1778
2000
  loggingModule.setup(config);
1779
- _chunkJB6MA2RVcjs.logger.info("All telemetry modules initialized successfully");
2001
+ _chunkWC573FCIcjs.logger.info("All telemetry modules initialized successfully");
1780
2002
  }
1781
2003
  /**
1782
2004
  * Detect the current module system (ESM or CJS) using reliable indicators
@@ -1785,7 +2007,7 @@ var _Brizz = (_class6 = class __Brizz {constructor() { _class6.prototype.__init1
1785
2007
  * @private
1786
2008
  */
1787
2009
  detectModuleSystem() {
1788
- const inCJS = typeof module !== "undefined" && typeof exports !== "undefined" && typeof _chunkGCORRK6Bcjs.__require === "function" && typeof __filename === "string" && typeof __dirname === "string" && this === (typeof exports !== "undefined" ? exports : void 0);
2010
+ const inCJS = typeof module !== "undefined" && typeof exports !== "undefined" && typeof _chunkOBGZSXTJcjs.__require === "function" && typeof __filename === "string" && typeof __dirname === "string" && this === (typeof exports !== "undefined" ? exports : void 0);
1789
2011
  return inCJS ? "CJS" : "ESM";
1790
2012
  }
1791
2013
  /**
@@ -1793,29 +2015,29 @@ var _Brizz = (_class6 = class __Brizz {constructor() { _class6.prototype.__init1
1793
2015
  * @private
1794
2016
  */
1795
2017
  async shutdownModules() {
1796
- _chunkJB6MA2RVcjs.logger.info("Shutting down telemetry modules");
2018
+ _chunkWC573FCIcjs.logger.info("Shutting down telemetry modules");
1797
2019
  try {
1798
2020
  try {
1799
2021
  const tracingModule = TracingModule.getInstance();
1800
2022
  await tracingModule.shutdown();
1801
- } catch (e4) {
1802
- _chunkJB6MA2RVcjs.logger.debug("Tracing module already shut down or not initialized");
2023
+ } catch (e3) {
2024
+ _chunkWC573FCIcjs.logger.debug("Tracing module already shut down or not initialized");
1803
2025
  }
1804
2026
  try {
1805
2027
  const metricsModule = MetricsModule.getInstance();
1806
2028
  metricsModule.shutdown();
1807
- } catch (e5) {
1808
- _chunkJB6MA2RVcjs.logger.debug("Metrics module already shut down or not initialized");
2029
+ } catch (e4) {
2030
+ _chunkWC573FCIcjs.logger.debug("Metrics module already shut down or not initialized");
1809
2031
  }
1810
2032
  try {
1811
2033
  const loggingModule = LoggingModule.getInstance();
1812
2034
  await loggingModule.shutdown();
1813
- } catch (e6) {
1814
- _chunkJB6MA2RVcjs.logger.debug("Logging module already shut down or not initialized");
2035
+ } catch (e5) {
2036
+ _chunkWC573FCIcjs.logger.debug("Logging module already shut down or not initialized");
1815
2037
  }
1816
- _chunkJB6MA2RVcjs.logger.info("All telemetry modules shut down successfully");
2038
+ _chunkWC573FCIcjs.logger.info("All telemetry modules shut down successfully");
1817
2039
  } catch (error) {
1818
- _chunkJB6MA2RVcjs.logger.error("Error shutting down modules", { error });
2040
+ _chunkWC573FCIcjs.logger.error("Error shutting down modules", { error });
1819
2041
  throw error;
1820
2042
  }
1821
2043
  }
@@ -1836,21 +2058,21 @@ var _Brizz = (_class6 = class __Brizz {constructor() { _class6.prototype.__init1
1836
2058
  */
1837
2059
  initialize(options) {
1838
2060
  if (this._initialized) {
1839
- _chunkJB6MA2RVcjs.logger.warn("Brizz SDK already initialized");
2061
+ _chunkWC573FCIcjs.logger.warn("Brizz SDK already initialized");
1840
2062
  return;
1841
2063
  }
1842
- _chunkJB6MA2RVcjs.logger.info("Starting Brizz SDK initialization");
2064
+ _chunkWC573FCIcjs.logger.info("Starting Brizz SDK initialization");
1843
2065
  try {
1844
2066
  const resolvedConfig = resolveConfig(options);
1845
2067
  this.initializeModules(resolvedConfig);
1846
2068
  this.setupInstrumentation(options);
1847
2069
  this.createAndStartProviders(options, resolvedConfig);
1848
2070
  this._initialized = true;
1849
- _chunkJB6MA2RVcjs.logger.info("Brizz SDK initialization completed successfully", {
2071
+ _chunkWC573FCIcjs.logger.info("Brizz SDK initialization completed successfully", {
1850
2072
  moduleSystem: this.detectModuleSystem()
1851
2073
  });
1852
2074
  } catch (error) {
1853
- _chunkJB6MA2RVcjs.logger.error("Failed to initialize Brizz SDK", { error });
2075
+ _chunkWC573FCIcjs.logger.error("Failed to initialize Brizz SDK", { error });
1854
2076
  throw new Error(`Failed to initialize SDK: ${String(error)}`, { cause: error });
1855
2077
  }
1856
2078
  }
@@ -1871,25 +2093,25 @@ var _Brizz = (_class6 = class __Brizz {constructor() { _class6.prototype.__init1
1871
2093
  */
1872
2094
  async shutdown() {
1873
2095
  if (!this._initialized) {
1874
- _chunkJB6MA2RVcjs.logger.warn("Brizz SDK not initialized");
2096
+ _chunkWC573FCIcjs.logger.warn("Brizz SDK not initialized");
1875
2097
  return;
1876
2098
  }
1877
2099
  try {
1878
2100
  await this.shutdownModules();
1879
- await _optionalChain([this, 'access', _59 => _59._tracerProvider, 'optionalAccess', _60 => _60.forceFlush, 'call', _61 => _61()]);
1880
- await _optionalChain([this, 'access', _62 => _62._tracerProvider, 'optionalAccess', _63 => _63.shutdown, 'call', _64 => _64()]);
1881
- await _optionalChain([this, 'access', _65 => _65._meterProvider, 'optionalAccess', _66 => _66.forceFlush, 'call', _67 => _67()]);
1882
- await _optionalChain([this, 'access', _68 => _68._meterProvider, 'optionalAccess', _69 => _69.shutdown, 'call', _70 => _70()]);
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()]);
1883
2105
  this._initialized = false;
1884
2106
  this._tracerProvider = null;
1885
2107
  this._meterProvider = null;
1886
2108
  __Brizz.instance = null;
1887
- _chunkJB6MA2RVcjs.logger.info("Brizz SDK shut down successfully");
2109
+ _chunkWC573FCIcjs.logger.info("Brizz SDK shut down successfully");
1888
2110
  } catch (error) {
1889
2111
  if (error instanceof Error && error.message.includes("ENOTFOUND")) {
1890
- _chunkJB6MA2RVcjs.logger.debug(`Network error during shutdown (expected in tests): ${error.message}`);
2112
+ _chunkWC573FCIcjs.logger.debug(`Network error during shutdown (expected in tests): ${error.message}`);
1891
2113
  } else {
1892
- _chunkJB6MA2RVcjs.logger.error(`Failed to shutdown Brizz SDK: ${String(error)}`);
2114
+ _chunkWC573FCIcjs.logger.error(`Failed to shutdown Brizz SDK: ${String(error)}`);
1893
2115
  throw error;
1894
2116
  }
1895
2117
  }
@@ -1902,15 +2124,15 @@ function detectRuntime() {
1902
2124
  const [major, minor] = process.versions.node.split(".").map(Number);
1903
2125
  const noNodeJSGlobals = typeof __filename === "undefined" && typeof __dirname === "undefined";
1904
2126
  const noModuleSystem = typeof module === "undefined" && typeof exports === "undefined";
1905
- const hasRequire = typeof _chunkGCORRK6Bcjs.__require === "function";
2127
+ const hasRequire = typeof _chunkOBGZSXTJcjs.__require === "function";
1906
2128
  const isESM = noNodeJSGlobals && noModuleSystem;
1907
2129
  const isCJS = hasRequire && typeof module !== "undefined" && typeof exports !== "undefined" && typeof __filename === "string" && typeof __dirname === "string";
1908
2130
  const supportsLoaderAPI = (_nullishCoalesce(major, () => ( 0))) >= 21 || (_nullishCoalesce(major, () => ( 0))) === 20 && (_nullishCoalesce(minor, () => ( 0))) >= 6 || (_nullishCoalesce(major, () => ( 0))) === 18 && (_nullishCoalesce(minor, () => ( 0))) >= 19;
1909
2131
  const supportsRegister = (
1910
2132
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
1911
- !!_optionalChain([process, 'access', _71 => _71.features, 'optionalAccess', _72 => _72.typescript]) || !!_optionalChain([globalThis, 'access', _73 => _73.module, 'optionalAccess', _74 => _74.register])
2133
+ !!_optionalChain([process, 'access', _82 => _82.features, 'optionalAccess', _83 => _83.typescript]) || !!_optionalChain([globalThis, 'access', _84 => _84.module, 'optionalAccess', _85 => _85.register])
1912
2134
  );
1913
- _chunkJB6MA2RVcjs.logger.debug("Runtime detection results:", {
2135
+ _chunkWC573FCIcjs.logger.debug("Runtime detection results:", {
1914
2136
  nodeVersion: `${_nullishCoalesce(major, () => ( 0))}.${_nullishCoalesce(minor, () => ( 0))}`,
1915
2137
  isESM,
1916
2138
  isCJS,
@@ -1926,7 +2148,7 @@ function detectRuntime() {
1926
2148
  checks: {
1927
2149
  __filename: typeof __filename,
1928
2150
  __dirname: typeof __dirname,
1929
- require: typeof _chunkGCORRK6Bcjs.__require,
2151
+ require: typeof _chunkOBGZSXTJcjs.__require,
1930
2152
  module: typeof module,
1931
2153
  exports: typeof exports,
1932
2154
  "process.features": process.features,
@@ -1967,4 +2189,14 @@ function detectRuntime() {
1967
2189
 
1968
2190
 
1969
2191
 
1970
- 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;
2192
+
2193
+
2194
+
2195
+
2196
+
2197
+
2198
+
2199
+
2200
+
2201
+
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;