@brizz/sdk 0.1.51 → 0.1.53

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.
package/dist/index.cjs CHANGED
@@ -5,7 +5,7 @@ var _chunkUNLNNKZ7cjs = require('./chunk-UNLNNKZ7.cjs');
5
5
 
6
6
 
7
7
 
8
- var _chunkJSTTHMQ3cjs = require('./chunk-JSTTHMQ3.cjs');
8
+ var _chunkSTTOBCTPcjs = require('./chunk-STTOBCTP.cjs');
9
9
 
10
10
 
11
11
 
@@ -104,7 +104,7 @@ var _api = require('@opentelemetry/api');
104
104
 
105
105
  // src/internal/instrumentation/langgraph/attributes.ts
106
106
  var INSTRUMENTATION_NAME = "@brizz/sdk/langgraph";
107
- var INSTRUMENTATION_VERSION = _chunkJSTTHMQ3cjs.getSDKVersion.call(void 0, );
107
+ var INSTRUMENTATION_VERSION = _chunkSTTOBCTPcjs.getSDKVersion.call(void 0, );
108
108
  var MODULE_NAME = "@langchain/langgraph";
109
109
  var SUPPORTED_VERSIONS = [">=0.2.0 <2"];
110
110
  function isSupportedVersion(version) {
@@ -426,6 +426,217 @@ function attachRunToIteration(stream, run) {
426
426
  return iterable;
427
427
  }
428
428
 
429
+ // src/internal/instrumentation/typesafe.ts
430
+
431
+
432
+
433
+
434
+
435
+
436
+ var INSTRUMENTATION_NAME2 = "@brizz/sdk/typesafe";
437
+ var MODULE_NAME2 = "@typesafe-ai/sdk";
438
+ var SUPPORTED_VERSIONS2 = [">=0.5.7 <1"];
439
+ var SPAN_NAME = "typesafe.system_one";
440
+ var PROVIDER_NAME = "typesafe";
441
+ var OPERATION_NAME = "classify";
442
+ var ATTR_OPERATION_NAME = "gen_ai.operation.name";
443
+ var ATTR_PROVIDER_NAME = "gen_ai.provider.name";
444
+ var ATTR_REQUEST_MODEL = "gen_ai.request.model";
445
+ var ATTR_RESPONSE_MODEL = "gen_ai.response.model";
446
+ var ATTR_INPUT_TOKENS = "gen_ai.usage.input_tokens";
447
+ var ATTR_OUTPUT_TOKENS = "gen_ai.usage.output_tokens";
448
+ var ATTR_INPUT_MESSAGES = "gen_ai.input.messages";
449
+ var ATTR_QUESTIONS = "typesafe.questions";
450
+ var ATTR_ANSWERS = "typesafe.answers";
451
+ var PATCHED_FLAG2 = /* @__PURE__ */ Symbol.for("brizz.typesafe.patched");
452
+ var TypeSafeInstrumentation = class extends _instrumentation.InstrumentationBase {
453
+ constructor(config = {}) {
454
+ super(INSTRUMENTATION_NAME2, _chunkSTTOBCTPcjs.getSDKVersion.call(void 0, ), config);
455
+ }
456
+ init() {
457
+ return [
458
+ new (0, _instrumentation.InstrumentationNodeModuleDefinition)(
459
+ MODULE_NAME2,
460
+ SUPPORTED_VERSIONS2,
461
+ (moduleExports) => {
462
+ this.manuallyInstrument(moduleExports);
463
+ return moduleExports;
464
+ },
465
+ (moduleExports) => moduleExports
466
+ )
467
+ ];
468
+ }
469
+ /**
470
+ * Patch a `@typesafe-ai/sdk` module the caller already imported. The
471
+ * module-load hook above only fires for CommonJS requires, so an ESM or
472
+ * bundled consumer reaches the instrumentation through here — from
473
+ * `patchInstalledTypeSafe`, or `instrumentModules: { typesafe }`.
474
+ */
475
+ manuallyInstrument(moduleExports) {
476
+ const client = _optionalChain([moduleExports, 'optionalAccess', _19 => _19.TypeSafeClient]);
477
+ if (typeof client !== "function" || !client.prototype) {
478
+ _chunkWC573FCIcjs.logger.debug("Brizz TypeSafe: module does not expose TypeSafeClient \u2014 skipping patch");
479
+ return;
480
+ }
481
+ if (patchSystemOne(client.prototype, () => this.tracer)) {
482
+ _chunkWC573FCIcjs.logger.debug("Brizz TypeSafe: patched TypeSafeClient.systemOne");
483
+ }
484
+ }
485
+ };
486
+ function patchInstalledTypeSafe() {
487
+ let requireFromSdk;
488
+ let version;
489
+ try {
490
+ requireFromSdk = _module.createRequire.call(void 0, __filename);
491
+ version = requireFromSdk(`${MODULE_NAME2}/package.json`).version;
492
+ } catch (error) {
493
+ _chunkWC573FCIcjs.logger.debug(`TypeSafe not resolved, not patched: ${String(error)}`);
494
+ return;
495
+ }
496
+ if (!isSupportedVersion2(version)) {
497
+ _chunkWC573FCIcjs.logger.debug(`TypeSafe ${version} is outside ${SUPPORTED_VERSIONS2.join(" ")}, not patched`);
498
+ return;
499
+ }
500
+ let instrumentation;
501
+ try {
502
+ instrumentation = new TypeSafeInstrumentation({ enabled: false });
503
+ } catch (error) {
504
+ _chunkWC573FCIcjs.logger.debug(`TypeSafe instrumentation not constructed: ${String(error)}`);
505
+ return;
506
+ }
507
+ try {
508
+ const loaded = requireFromSdk.cache[requireFromSdk.resolve(MODULE_NAME2)];
509
+ if (loaded) {
510
+ instrumentation.manuallyInstrument(loaded.exports);
511
+ }
512
+ } catch (error) {
513
+ _chunkWC573FCIcjs.logger.debug(`TypeSafe CJS build not patched: ${String(error)}`);
514
+ }
515
+ void (async () => {
516
+ try {
517
+ instrumentation.manuallyInstrument(await Promise.resolve().then(() => _interopRequireWildcard(require("@typesafe-ai/sdk"))));
518
+ } catch (error) {
519
+ _chunkWC573FCIcjs.logger.debug(`TypeSafe not patched: ${String(error)}`);
520
+ }
521
+ })();
522
+ }
523
+ function isSupportedVersion2(version) {
524
+ const [major, minor, patch] = version.split(".").map((part) => Number.parseInt(part, 10));
525
+ if ([major, minor, patch].some((part) => part === void 0 || Number.isNaN(part))) {
526
+ return false;
527
+ }
528
+ return major === 0 && (minor > 5 || minor === 5 && patch >= 7);
529
+ }
530
+ function patchSystemOne(proto, getTracer) {
531
+ const target = proto;
532
+ const original = proto.systemOne;
533
+ if (target[PATCHED_FLAG2] || typeof original !== "function") {
534
+ return false;
535
+ }
536
+ proto.systemOne = function brizzSystemOne(request, ...rest) {
537
+ const span = startSpan(getTracer, request);
538
+ if (!span) {
539
+ return original.call(this, request, ...rest);
540
+ }
541
+ let pending;
542
+ try {
543
+ pending = _api.context.with(
544
+ _api.trace.setSpan(_api.context.active(), span),
545
+ () => original.call(this, request, ...rest)
546
+ );
547
+ } catch (error) {
548
+ endSpan(span, error);
549
+ throw error;
550
+ }
551
+ return observe(pending, span);
552
+ };
553
+ target[PATCHED_FLAG2] = true;
554
+ return true;
555
+ }
556
+ function observe(pending, span) {
557
+ const onError = (error) => endSpan(span, error);
558
+ try {
559
+ if (typeof _optionalChain([pending, 'optionalAccess', _20 => _20.asResponse]) === "function") {
560
+ pending.asResponse().then((response) => {
561
+ if (typeof _optionalChain([response, 'optionalAccess', _21 => _21.clone]) !== "function") {
562
+ endSpan(span);
563
+ return;
564
+ }
565
+ response.clone().json().then((body) => {
566
+ recordResult(span, body);
567
+ endSpan(span);
568
+ }, onError);
569
+ }, onError);
570
+ return pending;
571
+ }
572
+ if (typeof _optionalChain([pending, 'optionalAccess', _22 => _22.then]) === "function") {
573
+ pending.then((result) => {
574
+ recordResult(span, result);
575
+ endSpan(span);
576
+ }, onError);
577
+ return pending;
578
+ }
579
+ } catch (error) {
580
+ _chunkWC573FCIcjs.logger.debug(`Brizz TypeSafe: could not observe the call: ${String(error)}`);
581
+ }
582
+ endSpan(span);
583
+ return pending;
584
+ }
585
+ function startSpan(getTracer, request) {
586
+ try {
587
+ const model = typeof _optionalChain([request, 'optionalAccess', _23 => _23.model]) === "string" && request.model !== "" ? request.model : void 0;
588
+ const attributes = {
589
+ [ATTR_OPERATION_NAME]: OPERATION_NAME,
590
+ [ATTR_PROVIDER_NAME]: PROVIDER_NAME,
591
+ [ATTR_INPUT_MESSAGES]: JSON.stringify([
592
+ { role: "user", parts: [{ type: "text", content: text(_optionalChain([request, 'optionalAccess', _24 => _24.state])) }] }
593
+ ])
594
+ };
595
+ if (model) {
596
+ attributes[ATTR_REQUEST_MODEL] = model;
597
+ }
598
+ if (_optionalChain([request, 'optionalAccess', _25 => _25.questions]) !== void 0) {
599
+ attributes[ATTR_QUESTIONS] = JSON.stringify(request.questions);
600
+ }
601
+ return getTracer().startSpan(SPAN_NAME, { kind: _api.SpanKind.CLIENT, attributes });
602
+ } catch (error) {
603
+ _chunkWC573FCIcjs.logger.debug(`Brizz TypeSafe: could not start span: ${String(error)}`);
604
+ return void 0;
605
+ }
606
+ }
607
+ function recordResult(span, result) {
608
+ try {
609
+ const { model, usage, answers } = _nullishCoalesce(result, () => ( {}));
610
+ if (typeof model === "string" && model) {
611
+ span.setAttribute(ATTR_RESPONSE_MODEL, model);
612
+ }
613
+ if (typeof _optionalChain([usage, 'optionalAccess', _26 => _26.input_tokens]) === "number") {
614
+ span.setAttribute(ATTR_INPUT_TOKENS, usage.input_tokens);
615
+ }
616
+ if (typeof _optionalChain([usage, 'optionalAccess', _27 => _27.output_tokens]) === "number") {
617
+ span.setAttribute(ATTR_OUTPUT_TOKENS, usage.output_tokens);
618
+ }
619
+ if (answers !== void 0) {
620
+ span.setAttribute(ATTR_ANSWERS, JSON.stringify(answers));
621
+ }
622
+ } catch (error) {
623
+ _chunkWC573FCIcjs.logger.debug(`Brizz TypeSafe: could not record the answers: ${String(error)}`);
624
+ }
625
+ }
626
+ function endSpan(span, error) {
627
+ if (!span.isRecording()) {
628
+ return;
629
+ }
630
+ if (error !== void 0) {
631
+ span.recordException(error instanceof Error ? error : new Error(String(error)));
632
+ span.setStatus({ code: _api.SpanStatusCode.ERROR, message: String(error) });
633
+ }
634
+ span.end();
635
+ }
636
+ function text(value) {
637
+ return typeof value === "string" ? value : _nullishCoalesce(JSON.stringify(value), () => ( ""));
638
+ }
639
+
429
640
  // src/internal/instrumentation/auto-init.ts
430
641
  var exceptionLogger = (error) => {
431
642
  _chunkWC573FCIcjs.logger.error(`Exception in instrumentation: ${String(error)}`);
@@ -468,7 +679,7 @@ function loadGenAIInstrumentations() {
468
679
  function loadMCPInstrumentation() {
469
680
  void (async () => {
470
681
  try {
471
- const { MCPInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("./mcp-FCUYTDGN.cjs")));
682
+ const { MCPInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("./mcp-KH5LOG5H.cjs")));
472
683
  const mcp = new MCPInstrumentation({ exceptionLogger });
473
684
  _instrumentation.registerInstrumentations.call(void 0, { instrumentations: [mcp] });
474
685
  _chunkWC573FCIcjs.logger.debug("Auto-loaded MCP instrumentation");
@@ -487,6 +698,14 @@ function loadLangGraphInstrumentation() {
487
698
  _chunkWC573FCIcjs.logger.debug(`LangGraph instrumentation not loaded: ${String(error)}`);
488
699
  }
489
700
  }
701
+ function loadTypeSafeInstrumentation() {
702
+ try {
703
+ _instrumentation.registerInstrumentations.call(void 0, { instrumentations: [new TypeSafeInstrumentation()] });
704
+ _chunkWC573FCIcjs.logger.debug("Auto-loaded TypeSafe instrumentation");
705
+ } catch (error) {
706
+ _chunkWC573FCIcjs.logger.debug(`TypeSafe instrumentation not loaded: ${String(error)}`);
707
+ }
708
+ }
490
709
  function loadVertexAIInstrumentation() {
491
710
  void (async () => {
492
711
  try {
@@ -565,6 +784,7 @@ function autoInitializeInstrumentations() {
565
784
  const genAIInstrumentations = loadGenAIInstrumentations();
566
785
  loadMCPInstrumentation();
567
786
  loadLangGraphInstrumentation();
787
+ loadTypeSafeInstrumentation();
568
788
  loadVertexAIInstrumentation();
569
789
  loadGoogleGenAIInstrumentation();
570
790
  loadVercelAITelemetry();
@@ -595,7 +815,7 @@ var _sdktracenode = require('@opentelemetry/sdk-trace-node');
595
815
 
596
816
  // src/internal/config.ts
597
817
  function resolveConfig(options) {
598
- const envLogLevel = process.env["BRIZZ_LOG_LEVEL"] || _optionalChain([options, 'access', _19 => _19.logLevel, 'optionalAccess', _20 => _20.toString, 'call', _21 => _21()]) || _chunkWC573FCIcjs.DEFAULT_LOG_LEVEL.toString();
818
+ const envLogLevel = process.env["BRIZZ_LOG_LEVEL"] || _optionalChain([options, 'access', _28 => _28.logLevel, 'optionalAccess', _29 => _29.toString, 'call', _30 => _30()]) || _chunkWC573FCIcjs.DEFAULT_LOG_LEVEL.toString();
599
819
  let resolvedLogLevel;
600
820
  if (envLogLevel) {
601
821
  resolvedLogLevel = _chunkWC573FCIcjs.parseLogLevel.call(void 0, envLogLevel);
@@ -753,6 +973,9 @@ var OMITTED_KEYS = /* @__PURE__ */ new Set([
753
973
  _chunkRV7JIIDGcjs.ORGANIZATION_NAME,
754
974
  _chunkRV7JIIDGcjs.ORGANIZATION_DOMAIN
755
975
  ]);
976
+ var TOOL_CALL_ID_METADATA_KEY = "brizz_tool_call_id";
977
+ var TOOL_ID = "tool.id";
978
+ var TOOL_CALL_ID_ARG = 7;
756
979
  function runMetadataFromContext() {
757
980
  const bag = _api.context.active().getValue(_chunkRV7JIIDGcjs.PROPERTIES_CONTEXT_KEY);
758
981
  if (!bag) {
@@ -767,7 +990,7 @@ function runMetadataFromContext() {
767
990
  return Object.keys(metadata).length > 0 ? metadata : void 0;
768
991
  }
769
992
  function patchCallbackManagerModule(module2) {
770
- const callbackManager = _optionalChain([module2, 'optionalAccess', _22 => _22.CallbackManager]);
993
+ const callbackManager = _optionalChain([module2, 'optionalAccess', _31 => _31.CallbackManager]);
771
994
  if (callbackManager === null || typeof callbackManager !== "function" && typeof callbackManager !== "object") {
772
995
  return false;
773
996
  }
@@ -792,9 +1015,32 @@ function patchCallbackManagerModule(module2) {
792
1015
  }
793
1016
  return manager;
794
1017
  };
1018
+ patchToolStart(statics["prototype"]);
795
1019
  statics[PATCHED_MARKER] = true;
796
1020
  return true;
797
1021
  }
1022
+ function patchToolStart(prototype) {
1023
+ const proto = prototype;
1024
+ const original = _optionalChain([proto, 'optionalAccess', _32 => _32["handleToolStart"]]);
1025
+ if (!proto || typeof original !== "function") {
1026
+ return;
1027
+ }
1028
+ const handleToolStart = original;
1029
+ proto["handleToolStart"] = function(...args) {
1030
+ try {
1031
+ const toolCallId = args[TOOL_CALL_ID_ARG];
1032
+ if (typeof toolCallId === "string" && toolCallId !== "") {
1033
+ this.addMetadata({ [TOOL_CALL_ID_METADATA_KEY]: toolCallId }, false);
1034
+ } else if (this.metadata && TOOL_CALL_ID_METADATA_KEY in this.metadata) {
1035
+ const rest = { ...this.metadata };
1036
+ delete rest[TOOL_CALL_ID_METADATA_KEY];
1037
+ this.metadata = rest;
1038
+ }
1039
+ } catch (e3) {
1040
+ }
1041
+ return handleToolStart.apply(this, args);
1042
+ };
1043
+ }
798
1044
  function patchInstalledCallbackManager() {
799
1045
  void (async () => {
800
1046
  try {
@@ -813,23 +1059,28 @@ function patchInstalledCallbackManager() {
813
1059
  function restampLangChainSpan(span) {
814
1060
  try {
815
1061
  const scope = span.instrumentationScope;
816
- if (_optionalChain([scope, 'optionalAccess', _23 => _23.name]) !== SCOPE_NAME) {
1062
+ if (_optionalChain([scope, 'optionalAccess', _33 => _33.name]) !== SCOPE_NAME) {
817
1063
  return;
818
1064
  }
819
1065
  const attrs = span.attributes;
820
1066
  const metadata = attrs["metadata"];
821
- if (typeof metadata !== "string" || !metadata.includes(`"${_chunkRV7JIIDGcjs.BRIZZ}.`)) {
1067
+ if (typeof metadata !== "string" || !metadata.includes(`"${_chunkRV7JIIDGcjs.BRIZZ}.`) && !metadata.includes(`"${TOOL_CALL_ID_METADATA_KEY}"`)) {
822
1068
  return;
823
1069
  }
824
1070
  const parsed = JSON.parse(metadata);
825
1071
  if (typeof parsed !== "object" || parsed === null) {
826
1072
  return;
827
1073
  }
828
- for (const [key, value] of Object.entries(parsed)) {
1074
+ const entries = parsed;
1075
+ for (const [key, value] of Object.entries(entries)) {
829
1076
  if (key.startsWith(`${_chunkRV7JIIDGcjs.BRIZZ}.`) && value !== null && value !== void 0) {
830
1077
  attrs[key] = String(value);
831
1078
  }
832
1079
  }
1080
+ const toolCallId = entries[TOOL_CALL_ID_METADATA_KEY];
1081
+ if (typeof toolCallId === "string" && toolCallId !== "" && attrs[TOOL_ID] === void 0) {
1082
+ attrs[TOOL_ID] = toolCallId;
1083
+ }
833
1084
  } catch (error) {
834
1085
  _chunkWC573FCIcjs.logger.debug("Skipped LangChain span re-stamp", { err: error });
835
1086
  }
@@ -868,7 +1119,7 @@ var InstrumentationRegistry = (_class = class _InstrumentationRegistry {construc
868
1119
  * @private
869
1120
  */
870
1121
  loadManualInstrumentations(instrumentations, exceptionLogger2) {
871
- if (_optionalChain([this, 'access', _24 => _24.manualModules, 'optionalAccess', _25 => _25.openAI])) {
1122
+ if (_optionalChain([this, 'access', _34 => _34.manualModules, 'optionalAccess', _35 => _35.openAI])) {
872
1123
  try {
873
1124
  const openAIInst = new (0, _openinferenceinstrumentationopenai.OpenAIInstrumentation)();
874
1125
  openAIInst.manuallyInstrument(this.manualModules.openAI);
@@ -879,18 +1130,18 @@ var InstrumentationRegistry = (_class = class _InstrumentationRegistry {construc
879
1130
  }
880
1131
  }
881
1132
  const instrumentationConfigs = [
882
- { class: _instrumentationanthropic.AnthropicInstrumentation, name: "Anthropic", module: _optionalChain([this, 'access', _26 => _26.manualModules, 'optionalAccess', _27 => _27.anthropic]) },
883
- { class: _instrumentationcohere.CohereInstrumentation, name: "Cohere", module: _optionalChain([this, 'access', _28 => _28.manualModules, 'optionalAccess', _29 => _29.cohere]) },
884
- { class: _instrumentationbedrock.BedrockInstrumentation, name: "Bedrock", module: _optionalChain([this, 'access', _30 => _30.manualModules, 'optionalAccess', _31 => _31.bedrock]) },
885
- { class: _instrumentationpinecone.PineconeInstrumentation, name: "Pinecone", module: _optionalChain([this, 'access', _32 => _32.manualModules, 'optionalAccess', _33 => _33.pinecone]) },
1133
+ { class: _instrumentationanthropic.AnthropicInstrumentation, name: "Anthropic", module: _optionalChain([this, 'access', _36 => _36.manualModules, 'optionalAccess', _37 => _37.anthropic]) },
1134
+ { class: _instrumentationcohere.CohereInstrumentation, name: "Cohere", module: _optionalChain([this, 'access', _38 => _38.manualModules, 'optionalAccess', _39 => _39.cohere]) },
1135
+ { class: _instrumentationbedrock.BedrockInstrumentation, name: "Bedrock", module: _optionalChain([this, 'access', _40 => _40.manualModules, 'optionalAccess', _41 => _41.bedrock]) },
1136
+ { class: _instrumentationpinecone.PineconeInstrumentation, name: "Pinecone", module: _optionalChain([this, 'access', _42 => _42.manualModules, 'optionalAccess', _43 => _43.pinecone]) },
886
1137
  {
887
1138
  class: _instrumentationllamaindex.LlamaIndexInstrumentation,
888
1139
  name: "LlamaIndex",
889
- module: _optionalChain([this, 'access', _34 => _34.manualModules, 'optionalAccess', _35 => _35.llamaindex])
1140
+ module: _optionalChain([this, 'access', _44 => _44.manualModules, 'optionalAccess', _45 => _45.llamaindex])
890
1141
  },
891
- { class: _instrumentationchromadb.ChromaDBInstrumentation, name: "ChromaDB", module: _optionalChain([this, 'access', _36 => _36.manualModules, 'optionalAccess', _37 => _37.chromadb]) },
892
- { class: _instrumentationqdrant.QdrantInstrumentation, name: "Qdrant", module: _optionalChain([this, 'access', _38 => _38.manualModules, 'optionalAccess', _39 => _39.qdrant]) },
893
- { class: _instrumentationtogether.TogetherInstrumentation, name: "Together", module: _optionalChain([this, 'access', _40 => _40.manualModules, 'optionalAccess', _41 => _41.together]) }
1142
+ { class: _instrumentationchromadb.ChromaDBInstrumentation, name: "ChromaDB", module: _optionalChain([this, 'access', _46 => _46.manualModules, 'optionalAccess', _47 => _47.chromadb]) },
1143
+ { class: _instrumentationqdrant.QdrantInstrumentation, name: "Qdrant", module: _optionalChain([this, 'access', _48 => _48.manualModules, 'optionalAccess', _49 => _49.qdrant]) },
1144
+ { class: _instrumentationtogether.TogetherInstrumentation, name: "Together", module: _optionalChain([this, 'access', _50 => _50.manualModules, 'optionalAccess', _51 => _51.together]) }
894
1145
  ];
895
1146
  for (const config of instrumentationConfigs) {
896
1147
  if (!config.module) {
@@ -906,7 +1157,7 @@ var InstrumentationRegistry = (_class = class _InstrumentationRegistry {construc
906
1157
  instrumentations.push(instrumentation);
907
1158
  }
908
1159
  }
909
- if (_optionalChain([this, 'access', _42 => _42.manualModules, 'optionalAccess', _43 => _43.langchain, 'optionalAccess', _44 => _44.callbackManagerModule])) {
1160
+ if (_optionalChain([this, 'access', _52 => _52.manualModules, 'optionalAccess', _53 => _53.langchain, 'optionalAccess', _54 => _54.callbackManagerModule])) {
910
1161
  const callbackManagerModule = this.manualModules.langchain.callbackManagerModule;
911
1162
  void (async () => {
912
1163
  try {
@@ -922,7 +1173,7 @@ var InstrumentationRegistry = (_class = class _InstrumentationRegistry {construc
922
1173
  }
923
1174
  })();
924
1175
  }
925
- if (_optionalChain([this, 'access', _45 => _45.manualModules, 'optionalAccess', _46 => _46.langgraph])) {
1176
+ if (_optionalChain([this, 'access', _55 => _55.manualModules, 'optionalAccess', _56 => _56.langgraph])) {
926
1177
  try {
927
1178
  new LangGraphInstrumentation().manuallyInstrument(this.manualModules.langgraph);
928
1179
  _chunkWC573FCIcjs.logger.debug("Manual instrumentation enabled for LangGraph");
@@ -930,7 +1181,15 @@ var InstrumentationRegistry = (_class = class _InstrumentationRegistry {construc
930
1181
  _chunkWC573FCIcjs.logger.error(`Failed to apply LangGraph instrumentation: ${String(error)}`);
931
1182
  }
932
1183
  }
933
- if (_optionalChain([this, 'access', _47 => _47.manualModules, 'optionalAccess', _48 => _48.google_vertexai])) {
1184
+ if (_optionalChain([this, 'access', _57 => _57.manualModules, 'optionalAccess', _58 => _58.typesafe])) {
1185
+ try {
1186
+ new TypeSafeInstrumentation().manuallyInstrument(this.manualModules.typesafe);
1187
+ _chunkWC573FCIcjs.logger.debug("Manual instrumentation enabled for TypeSafe");
1188
+ } catch (error) {
1189
+ _chunkWC573FCIcjs.logger.error(`Failed to apply TypeSafe instrumentation: ${String(error)}`);
1190
+ }
1191
+ }
1192
+ if (_optionalChain([this, 'access', _59 => _59.manualModules, 'optionalAccess', _60 => _60.google_vertexai])) {
934
1193
  const vertexModule = this.manualModules.google_vertexai;
935
1194
  void (async () => {
936
1195
  try {
@@ -945,7 +1204,7 @@ var InstrumentationRegistry = (_class = class _InstrumentationRegistry {construc
945
1204
  }
946
1205
  })();
947
1206
  }
948
- if (_optionalChain([this, 'access', _49 => _49.manualModules, 'optionalAccess', _50 => _50.google_genai])) {
1207
+ if (_optionalChain([this, 'access', _61 => _61.manualModules, 'optionalAccess', _62 => _62.google_genai])) {
949
1208
  const genaiModule = this.manualModules.google_genai;
950
1209
  void (async () => {
951
1210
  try {
@@ -960,11 +1219,11 @@ var InstrumentationRegistry = (_class = class _InstrumentationRegistry {construc
960
1219
  }
961
1220
  })();
962
1221
  }
963
- if (_optionalChain([this, 'access', _51 => _51.manualModules, 'optionalAccess', _52 => _52.mcp])) {
1222
+ if (_optionalChain([this, 'access', _63 => _63.manualModules, 'optionalAccess', _64 => _64.mcp])) {
964
1223
  const mcpModules = this.manualModules.mcp;
965
1224
  void (async () => {
966
1225
  try {
967
- const { MCPInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("./mcp-FCUYTDGN.cjs")));
1226
+ const { MCPInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("./mcp-KH5LOG5H.cjs")));
968
1227
  const instrumentation = new MCPInstrumentation({ exceptionLogger: exceptionLogger2 });
969
1228
  instrumentation.manuallyInstrument(mcpModules);
970
1229
  _chunkWC573FCIcjs.logger.debug("Manual instrumentation enabled for MCP");
@@ -1016,7 +1275,7 @@ function setCurrentSpanCustomProperties(properties) {
1016
1275
  for (const [key, value] of Object.entries(properties)) {
1017
1276
  try {
1018
1277
  current.setAttribute(`${_chunkRV7JIIDGcjs.BRIZZ}.${key}`, value);
1019
- } catch (e3) {
1278
+ } catch (e4) {
1020
1279
  }
1021
1280
  }
1022
1281
  }
@@ -1040,15 +1299,15 @@ function withProperties(properties, fn, thisArg) {
1040
1299
  function propagatePropertiesImperatively(properties, base = _api.context.active()) {
1041
1300
  try {
1042
1301
  const manager = _api.context;
1043
- const mgr = _optionalChain([manager, 'access', _53 => _53._getContextManager, 'optionalCall', _54 => _54()]);
1044
- const store = _optionalChain([mgr, 'optionalAccess', _55 => _55._asyncLocalStorage]);
1302
+ const mgr = _optionalChain([manager, 'access', _65 => _65._getContextManager, 'optionalCall', _66 => _66()]);
1303
+ const store = _optionalChain([mgr, 'optionalAccess', _67 => _67._asyncLocalStorage]);
1045
1304
  if (!store || typeof store.enterWith !== "function") {
1046
1305
  return;
1047
1306
  }
1048
1307
  const prev = base.getValue(_chunkRV7JIIDGcjs.PROPERTIES_CONTEXT_KEY);
1049
1308
  const merged = prev ? { ...prev, ...properties } : properties;
1050
1309
  store.enterWith(base.setValue(_chunkRV7JIIDGcjs.PROPERTIES_CONTEXT_KEY, merged));
1051
- } catch (e4) {
1310
+ } catch (e5) {
1052
1311
  }
1053
1312
  }
1054
1313
  function setUser(user) {
@@ -1143,7 +1402,7 @@ function withServiceName(name, fn, thisArg) {
1143
1402
  }
1144
1403
  function resolveServiceNameFromContext() {
1145
1404
  const props = _api.context.active().getValue(_chunkRV7JIIDGcjs.PROPERTIES_CONTEXT_KEY);
1146
- return _optionalChain([props, 'optionalAccess', _56 => _56[_chunkRV7JIIDGcjs.SERVICE_NAME]]);
1405
+ return _optionalChain([props, 'optionalAccess', _68 => _68[_chunkRV7JIIDGcjs.SERVICE_NAME]]);
1147
1406
  }
1148
1407
  function userProperties(user) {
1149
1408
  const properties = { [_chunkRV7JIIDGcjs.USER_ID]: user.id };
@@ -1210,7 +1469,7 @@ function withMessageId(id, fn, thisArg) {
1210
1469
  }
1211
1470
  function inheritedMuteTools() {
1212
1471
  const properties = _api.context.active().getValue(_chunkRV7JIIDGcjs.PROPERTIES_CONTEXT_KEY);
1213
- return _optionalChain([properties, 'optionalAccess', _57 => _57[_chunkRV7JIIDGcjs.MUTE_TOOLS]]);
1472
+ return _optionalChain([properties, 'optionalAccess', _69 => _69[_chunkRV7JIIDGcjs.MUTE_TOOLS]]);
1214
1473
  }
1215
1474
  function muteProperties(options) {
1216
1475
  const { input = true, output = true, tools = output } = options;
@@ -1269,9 +1528,9 @@ var Session = (_class2 = class {
1269
1528
  * @param text - Text to append (null becomes a null/"hide marker")
1270
1529
  * @param context - Optional per-turn context bag to attach to this turn
1271
1530
  */
1272
- setInput(text, context7) {
1273
- this.inputs.push(text);
1274
- this.inputContexts.push(_nullishCoalesce(context7, () => ( {})));
1531
+ setInput(text2, context8) {
1532
+ this.inputs.push(text2);
1533
+ this.inputContexts.push(_nullishCoalesce(context8, () => ( {})));
1275
1534
  this.span.setAttribute(_chunkRV7JIIDGcjs.SESSION_INPUT, JSON.stringify(this.inputs));
1276
1535
  this.span.setAttribute(_chunkRV7JIIDGcjs.SESSION_INPUT_CONTEXT, JSON.stringify(this.inputContexts));
1277
1536
  }
@@ -1285,9 +1544,9 @@ var Session = (_class2 = class {
1285
1544
  * @param text - Text to append (null becomes a null/"hide marker")
1286
1545
  * @param context - Optional per-turn context bag to attach to this turn
1287
1546
  */
1288
- setOutput(text, context7) {
1289
- this.outputs.push(text);
1290
- this.outputContexts.push(_nullishCoalesce(context7, () => ( {})));
1547
+ setOutput(text2, context8) {
1548
+ this.outputs.push(text2);
1549
+ this.outputContexts.push(_nullishCoalesce(context8, () => ( {})));
1291
1550
  this.span.setAttribute(_chunkRV7JIIDGcjs.SESSION_OUTPUT, JSON.stringify(this.outputs));
1292
1551
  this.span.setAttribute(_chunkRV7JIIDGcjs.SESSION_OUTPUT_CONTEXT, JSON.stringify(this.outputContexts));
1293
1552
  }
@@ -1372,7 +1631,7 @@ var Session = (_class2 = class {
1372
1631
  * (free-form category, defaults to `'generic'`)
1373
1632
  */
1374
1633
  addExternalLink(url, options) {
1375
- emitExternalLink(this.sessionId, url, _optionalChain([options, 'optionalAccess', _58 => _58.title]), _optionalChain([options, 'optionalAccess', _59 => _59.linkType]));
1634
+ emitExternalLink(this.sessionId, url, _optionalChain([options, 'optionalAccess', _70 => _70.title]), _optionalChain([options, 'optionalAccess', _71 => _71.linkType]));
1376
1635
  }
1377
1636
  }, _class2);
1378
1637
  var SessionTitle = class {
@@ -1398,11 +1657,11 @@ function resolveSessionIdFromContext() {
1398
1657
  return active.sessionId;
1399
1658
  }
1400
1659
  const props = _api.context.active().getValue(_chunkRV7JIIDGcjs.PROPERTIES_CONTEXT_KEY);
1401
- return _optionalChain([props, 'optionalAccess', _60 => _60[_chunkRV7JIIDGcjs.SESSION_ID]]);
1660
+ return _optionalChain([props, 'optionalAccess', _72 => _72[_chunkRV7JIIDGcjs.SESSION_ID]]);
1402
1661
  }
1403
1662
  function resolveMessageIdFromContext() {
1404
1663
  const props = _api.context.active().getValue(_chunkRV7JIIDGcjs.PROPERTIES_CONTEXT_KEY);
1405
- return _optionalChain([props, 'optionalAccess', _61 => _61[_chunkRV7JIIDGcjs.MESSAGE_ID]]);
1664
+ return _optionalChain([props, 'optionalAccess', _73 => _73[_chunkRV7JIIDGcjs.MESSAGE_ID]]);
1406
1665
  }
1407
1666
  function emitExternalLink(sessionId, url, title, linkType) {
1408
1667
  try {
@@ -1416,30 +1675,30 @@ function emitExternalLink(sessionId, url, title, linkType) {
1416
1675
  }
1417
1676
  }
1418
1677
  function addExternalLink(url, options) {
1419
- const sessionId = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _62 => _62.sessionId]), () => ( resolveSessionIdFromContext()));
1678
+ const sessionId = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _74 => _74.sessionId]), () => ( resolveSessionIdFromContext()));
1420
1679
  if (!sessionId) {
1421
1680
  _chunkWC573FCIcjs.logger.warn(
1422
1681
  "addExternalLink called without a resolvable session id; link dropped. Pass options.sessionId or call inside a startSession/callWithSessionId scope."
1423
1682
  );
1424
1683
  return;
1425
1684
  }
1426
- emitExternalLink(sessionId, url, _optionalChain([options, 'optionalAccess', _63 => _63.title]), _optionalChain([options, 'optionalAccess', _64 => _64.linkType]));
1685
+ emitExternalLink(sessionId, url, _optionalChain([options, 'optionalAccess', _75 => _75.title]), _optionalChain([options, 'optionalAccess', _76 => _76.linkType]));
1427
1686
  }
1428
1687
  function recordFeedback(type, options) {
1429
1688
  const eventAttributes = { [_chunkRV7JIIDGcjs.FEEDBACK_TYPE]: type };
1430
- if (_optionalChain([options, 'optionalAccess', _65 => _65.score]) !== void 0) {
1689
+ if (_optionalChain([options, 'optionalAccess', _77 => _77.score]) !== void 0) {
1431
1690
  eventAttributes[_chunkRV7JIIDGcjs.FEEDBACK_SCORE] = options.score;
1432
1691
  }
1433
- if (_optionalChain([options, 'optionalAccess', _66 => _66.reason]) !== void 0) {
1692
+ if (_optionalChain([options, 'optionalAccess', _78 => _78.reason]) !== void 0) {
1434
1693
  eventAttributes[_chunkRV7JIIDGcjs.FEEDBACK_REASON] = options.reason;
1435
1694
  }
1436
- if (_optionalChain([options, 'optionalAccess', _67 => _67.comment]) !== void 0) {
1695
+ if (_optionalChain([options, 'optionalAccess', _79 => _79.comment]) !== void 0) {
1437
1696
  eventAttributes[_chunkRV7JIIDGcjs.FEEDBACK_COMMENT] = options.comment;
1438
1697
  }
1439
- if (_optionalChain([options, 'optionalAccess', _68 => _68.source]) !== void 0) {
1698
+ if (_optionalChain([options, 'optionalAccess', _80 => _80.source]) !== void 0) {
1440
1699
  eventAttributes[_chunkRV7JIIDGcjs.FEEDBACK_SOURCE] = options.source;
1441
1700
  }
1442
- if (_optionalChain([options, 'optionalAccess', _69 => _69.attributes])) {
1701
+ if (_optionalChain([options, 'optionalAccess', _81 => _81.attributes])) {
1443
1702
  for (const [key, value] of Object.entries(options.attributes)) {
1444
1703
  const k = `${_chunkRV7JIIDGcjs.FEEDBACK_ATTR_PREFIX}${key}`;
1445
1704
  if (eventAttributes[k] === void 0) {
@@ -1447,8 +1706,8 @@ function recordFeedback(type, options) {
1447
1706
  }
1448
1707
  }
1449
1708
  }
1450
- const messageId = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _70 => _70.messageId]), () => ( resolveMessageIdFromContext()));
1451
- const sessionId = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _71 => _71.sessionId]), () => ( resolveSessionIdFromContext()));
1709
+ const messageId = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _82 => _82.messageId]), () => ( resolveMessageIdFromContext()));
1710
+ const sessionId = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _83 => _83.sessionId]), () => ( resolveSessionIdFromContext()));
1452
1711
  if (messageId === void 0 && sessionId === void 0) {
1453
1712
  _chunkWC573FCIcjs.logger.warn(
1454
1713
  "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."
@@ -1479,7 +1738,7 @@ function recordMetric(options) {
1479
1738
  try {
1480
1739
  recordMetricImpl(options);
1481
1740
  } catch (error) {
1482
- _chunkWC573FCIcjs.logger.warn(`recordMetric(${JSON.stringify(_optionalChain([options, 'optionalAccess', _72 => _72.name]))}) failed; metric dropped.`, error);
1741
+ _chunkWC573FCIcjs.logger.warn(`recordMetric(${JSON.stringify(_optionalChain([options, 'optionalAccess', _84 => _84.name]))}) failed; metric dropped.`, error);
1483
1742
  }
1484
1743
  }
1485
1744
  function recordMetricImpl(options) {
@@ -1583,14 +1842,14 @@ function recordMetricImpl(options) {
1583
1842
  );
1584
1843
  continue;
1585
1844
  }
1586
- let text = typeof attrValue === "string" ? attrValue : String(attrValue);
1587
- if (text.length > METRIC_ATTRIBUTE_VALUE_MAX_LEN) {
1845
+ let text2 = typeof attrValue === "string" ? attrValue : String(attrValue);
1846
+ if (text2.length > METRIC_ATTRIBUTE_VALUE_MAX_LEN) {
1588
1847
  _chunkWC573FCIcjs.logger.warn(
1589
1848
  `recordMetric(${name}) attribute ${JSON.stringify(normalizedKey)} exceeds ${METRIC_ATTRIBUTE_VALUE_MAX_LEN} characters; truncated.`
1590
1849
  );
1591
- text = text.slice(0, METRIC_ATTRIBUTE_VALUE_MAX_LEN);
1850
+ text2 = text2.slice(0, METRIC_ATTRIBUTE_VALUE_MAX_LEN);
1592
1851
  }
1593
- eventAttributes[`${_chunkRV7JIIDGcjs.METRIC_ATTRIBUTE_PREFIX}${normalizedKey}`] = text;
1852
+ eventAttributes[`${_chunkRV7JIIDGcjs.METRIC_ATTRIBUTE_PREFIX}${normalizedKey}`] = text2;
1594
1853
  accepted += 1;
1595
1854
  }
1596
1855
  }
@@ -1599,7 +1858,7 @@ function recordMetricImpl(options) {
1599
1858
  eventAttributes[_chunkRV7JIIDGcjs.METRIC_TRACE_ID] = traceId;
1600
1859
  }
1601
1860
  if (scope === _chunkRV7JIIDGcjs.METRIC_SCOPE_TRACE && traceId === void 0) {
1602
- const spanContext = _optionalChain([_api.trace, 'access', _73 => _73.getActiveSpan, 'call', _74 => _74(), 'optionalAccess', _75 => _75.spanContext, 'call', _76 => _76()]);
1861
+ const spanContext = _optionalChain([_api.trace, 'access', _85 => _85.getActiveSpan, 'call', _86 => _86(), 'optionalAccess', _87 => _87.spanContext, 'call', _88 => _88()]);
1603
1862
  if (!spanContext || !_api.isSpanContextValid.call(void 0, spanContext)) {
1604
1863
  _chunkWC573FCIcjs.logger.warn(
1605
1864
  `recordMetric(${name}) called with scope 'trace' but no trace; metric dropped. Pass options.traceId, or call inside the span of the trace being scored.`
@@ -1637,7 +1896,7 @@ function recordMetricImpl(options) {
1637
1896
  }
1638
1897
  }
1639
1898
  function startSession(sessionId, callback, extraProperties, options) {
1640
- const isTitle = _optionalChain([options, 'optionalAccess', _77 => _77.mode]) === "title";
1899
+ const isTitle = _optionalChain([options, 'optionalAccess', _89 => _89.mode]) === "title";
1641
1900
  const spanName = isTitle ? _chunkRV7JIIDGcjs.SESSION_TITLE_SPAN_NAME : _chunkRV7JIIDGcjs.SESSION_SPAN_NAME;
1642
1901
  const tracer = _api.trace.getTracer("@brizz/sdk");
1643
1902
  return tracer.startActiveSpan(spanName, (span) => {
@@ -1686,7 +1945,7 @@ function startSession(sessionId, callback, extraProperties, options) {
1686
1945
  });
1687
1946
  }
1688
1947
  function startSessionTitle(callback, options) {
1689
- const resolvedSessionId = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _78 => _78.sessionId]), () => ( _optionalChain([getActiveSession, 'call', _79 => _79(), 'optionalAccess', _80 => _80.sessionId])));
1948
+ const resolvedSessionId = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _90 => _90.sessionId]), () => ( _optionalChain([getActiveSession, 'call', _91 => _91(), 'optionalAccess', _92 => _92.sessionId])));
1690
1949
  const tracer = _api.trace.getTracer("@brizz/sdk");
1691
1950
  return tracer.startActiveSpan(_chunkRV7JIIDGcjs.SESSION_TITLE_SPAN_NAME, (span) => {
1692
1951
  if (resolvedSessionId) {
@@ -2108,10 +2367,12 @@ function maskValue(value, rule) {
2108
2367
  return maskStringByPatternBasedRule(value, rule);
2109
2368
  }
2110
2369
  if (typeof value === "boolean" || typeof value === "number") {
2111
- return maskStringByPatternBasedRule(String(value), rule);
2370
+ const masked = maskStringByPatternBasedRule(String(value), rule);
2371
+ return masked === String(value) ? value : masked;
2112
2372
  }
2113
2373
  if (Array.isArray(value)) {
2114
- return value.map((v) => maskStringByPatternBasedRule(String(v), rule));
2374
+ const masked = value.map((v) => maskStringByPatternBasedRule(String(v), rule));
2375
+ return masked.every((m, i) => m === String(value[i])) ? value : masked;
2115
2376
  }
2116
2377
  if (value !== null && typeof value === "object") {
2117
2378
  const result = {};
@@ -2158,7 +2419,7 @@ var BrizzSimpleLogRecordProcessor = class extends _sdklogs.SimpleLogRecordProces
2158
2419
  this.config = config;
2159
2420
  }
2160
2421
  onEmit(logRecord) {
2161
- const maskingConfig = _optionalChain([this, 'access', _81 => _81.config, 'access', _82 => _82.masking, 'optionalAccess', _83 => _83.eventMasking]);
2422
+ const maskingConfig = _optionalChain([this, 'access', _93 => _93.config, 'access', _94 => _94.masking, 'optionalAccess', _95 => _95.eventMasking]);
2162
2423
  if (maskingConfig) {
2163
2424
  maskLog(logRecord, maskingConfig);
2164
2425
  }
@@ -2178,7 +2439,7 @@ var BrizzBatchLogRecordProcessor = class extends _sdklogs.BatchLogRecordProcesso
2178
2439
  this.config = config;
2179
2440
  }
2180
2441
  onEmit(logRecord) {
2181
- const maskingConfig = _optionalChain([this, 'access', _84 => _84.config, 'access', _85 => _85.masking, 'optionalAccess', _86 => _86.eventMasking]);
2442
+ const maskingConfig = _optionalChain([this, 'access', _96 => _96.config, 'access', _97 => _97.masking, 'optionalAccess', _98 => _98.eventMasking]);
2182
2443
  if (maskingConfig) {
2183
2444
  maskLog(logRecord, maskingConfig);
2184
2445
  }
@@ -2279,14 +2540,14 @@ var LoggingModule = (_class3 = class _LoggingModule {constructor() { _class3.pro
2279
2540
  _chunkWC573FCIcjs.logger.debug("Creating logger provider", {
2280
2541
  serviceName,
2281
2542
  disableBatch: config.disableBatch,
2282
- hasMasking: !!_optionalChain([config, 'access', _87 => _87.masking, 'optionalAccess', _88 => _88.eventMasking])
2543
+ hasMasking: !!_optionalChain([config, 'access', _99 => _99.masking, 'optionalAccess', _100 => _100.eventMasking])
2283
2544
  });
2284
2545
  const exporter = this.createLogExporter(config, serviceName);
2285
2546
  const processor = config.disableBatch ? new BrizzSimpleLogRecordProcessor(exporter, config) : new BrizzBatchLogRecordProcessor(exporter, config);
2286
2547
  const resourceAttributes = {
2287
2548
  ...config.resourceAttributes,
2288
2549
  "service.name": serviceName,
2289
- [BRIZZ_SDK_VERSION]: _chunkJSTTHMQ3cjs.getSDKVersion.call(void 0, ),
2550
+ [BRIZZ_SDK_VERSION]: _chunkSTTOBCTPcjs.getSDKVersion.call(void 0, ),
2290
2551
  [BRIZZ_SDK_LANGUAGE]: SDK_LANGUAGE
2291
2552
  };
2292
2553
  if (config.environment) {
@@ -2535,7 +2796,7 @@ var BrizzSpanExporter = (_class5 = class {
2535
2796
  const resourceAttrs = {
2536
2797
  ...config.resourceAttributes,
2537
2798
  "service.name": config.appName,
2538
- [BRIZZ_SDK_VERSION]: _chunkJSTTHMQ3cjs.getSDKVersion.call(void 0, ),
2799
+ [BRIZZ_SDK_VERSION]: _chunkSTTOBCTPcjs.getSDKVersion.call(void 0, ),
2539
2800
  [BRIZZ_SDK_LANGUAGE]: SDK_LANGUAGE
2540
2801
  };
2541
2802
  if (config.environment) {
@@ -2662,8 +2923,8 @@ var BrizzSpanExporter = (_class5 = class {
2662
2923
  }
2663
2924
  async forceFlush() {
2664
2925
  await Promise.all([
2665
- _optionalChain([this, 'access', _89 => _89._delegate, 'access', _90 => _90.forceFlush, 'optionalCall', _91 => _91()]),
2666
- ...[...this._delegates.values()].map(async (delegate) => _optionalChain([delegate, 'access', _92 => _92.forceFlush, 'optionalCall', _93 => _93()]))
2926
+ _optionalChain([this, 'access', _101 => _101._delegate, 'access', _102 => _102.forceFlush, 'optionalCall', _103 => _103()]),
2927
+ ...[...this._delegates.values()].map(async (delegate) => _optionalChain([delegate, 'access', _104 => _104.forceFlush, 'optionalCall', _105 => _105()]))
2667
2928
  ]);
2668
2929
  }
2669
2930
  }, _class5);
@@ -2718,7 +2979,7 @@ var BrizzSimpleSpanProcessor = class extends _sdktracebase.SimpleSpanProcessor {
2718
2979
  }
2719
2980
  onEnd(span) {
2720
2981
  restampLangChainSpan(span);
2721
- const maskingConfig = _optionalChain([this, 'access', _94 => _94.config, 'access', _95 => _95.masking, 'optionalAccess', _96 => _96.spanMasking]);
2982
+ const maskingConfig = _optionalChain([this, 'access', _106 => _106.config, 'access', _107 => _107.masking, 'optionalAccess', _108 => _108.spanMasking]);
2722
2983
  if (maskingConfig) {
2723
2984
  maskReadableSpan(span, maskingConfig);
2724
2985
  }
@@ -2737,7 +2998,7 @@ var BrizzBatchSpanProcessor = class extends _sdktracebase.BatchSpanProcessor {
2737
2998
  }
2738
2999
  onEnd(span) {
2739
3000
  restampLangChainSpan(span);
2740
- const maskingConfig = _optionalChain([this, 'access', _97 => _97.config, 'access', _98 => _98.masking, 'optionalAccess', _99 => _99.spanMasking]);
3001
+ const maskingConfig = _optionalChain([this, 'access', _109 => _109.config, 'access', _110 => _110.masking, 'optionalAccess', _111 => _111.spanMasking]);
2741
3002
  if (maskingConfig) {
2742
3003
  maskReadableSpan(span, maskingConfig);
2743
3004
  }
@@ -2754,12 +3015,12 @@ function maskReadableSpan(span, config) {
2754
3015
  for (const [k, v] of Object.entries(attrs)) {
2755
3016
  masked[k] = v;
2756
3017
  }
2757
- if (_optionalChain([config, 'access', _100 => _100.rules, 'optionalAccess', _101 => _101.length])) {
3018
+ if (_optionalChain([config, 'access', _112 => _112.rules, 'optionalAccess', _113 => _113.length])) {
2758
3019
  masked = maskAttributes(masked, config.rules);
2759
3020
  }
2760
3021
  if (!config.disableDefaultRules) {
2761
- const text = Object.fromEntries(Object.entries(masked).filter(([k]) => isText(attrs[k])));
2762
- Object.assign(masked, maskAttributes(text, DEFAULT_MASKING_RULES));
3022
+ const text2 = Object.fromEntries(Object.entries(masked).filter(([k]) => isText(attrs[k])));
3023
+ Object.assign(masked, maskAttributes(text2, DEFAULT_MASKING_RULES));
2763
3024
  }
2764
3025
  const maskedEntries = Object.entries(masked);
2765
3026
  for (const [k, v] of maskedEntries) {
@@ -2826,7 +3087,7 @@ var TracingModule = (_class6 = class _TracingModule {constructor() { _class6.pro
2826
3087
  }
2827
3088
  _chunkWC573FCIcjs.logger.debug("Initializing span processor", {
2828
3089
  disableBatch: config.disableBatch,
2829
- hasMasking: !!_optionalChain([config, 'access', _102 => _102.masking, 'optionalAccess', _103 => _103.spanMasking])
3090
+ hasMasking: !!_optionalChain([config, 'access', _114 => _114.masking, 'optionalAccess', _115 => _115.spanMasking])
2830
3091
  });
2831
3092
  const spanProcessor = config.disableBatch ? new BrizzSimpleSpanProcessor(this.spanExporter, config) : new BrizzBatchSpanProcessor(this.spanExporter, config);
2832
3093
  _chunkWC573FCIcjs.logger.debug("Span processor initialized successfully");
@@ -2913,7 +3174,7 @@ function currentTraceparent() {
2913
3174
  const carrier = {};
2914
3175
  try {
2915
3176
  _api.propagation.inject(_api.context.active(), carrier);
2916
- } catch (e5) {
3177
+ } catch (e6) {
2917
3178
  }
2918
3179
  return _nullishCoalesce(carrier["traceparent"], () => ( ""));
2919
3180
  }
@@ -2936,7 +3197,7 @@ function decodeToken(token) {
2936
3197
  try {
2937
3198
  const payload = JSON.parse(Buffer.from(token, "base64url").toString("utf8"));
2938
3199
  return payload.id ? payload : void 0;
2939
- } catch (e6) {
3200
+ } catch (e7) {
2940
3201
  return void 0;
2941
3202
  }
2942
3203
  }
@@ -2974,7 +3235,7 @@ function resolveAgent(agent) {
2974
3235
  if (decoded.traceparent) {
2975
3236
  try {
2976
3237
  parentContext = _api.propagation.extract(parentContext, { traceparent: decoded.traceparent });
2977
- } catch (e7) {
3238
+ } catch (e8) {
2978
3239
  }
2979
3240
  }
2980
3241
  }
@@ -3046,9 +3307,10 @@ var _Brizz = (_class7 = class __Brizz {constructor() { _class7.prototype.__init1
3046
3307
  */
3047
3308
  setupInstrumentation(options) {
3048
3309
  const registry = InstrumentationRegistry.getInstance();
3049
- _chunkJSTTHMQ3cjs.configure.call(void 0, resolveMcpSessionTracking(options.mcpSessionTracking));
3310
+ _chunkSTTOBCTPcjs.configure.call(void 0, resolveMcpSessionTracking(options.mcpSessionTracking));
3050
3311
  patchInstalledCallbackManager();
3051
3312
  patchInstalledLangGraph();
3313
+ patchInstalledTypeSafe();
3052
3314
  if (options.instrumentModules && Object.keys(options.instrumentModules).length > 0) {
3053
3315
  registry.setManualModules(options.instrumentModules);
3054
3316
  }
@@ -3071,7 +3333,7 @@ var _Brizz = (_class7 = class __Brizz {constructor() { _class7.prototype.__init1
3071
3333
  const resourceAttributes = {
3072
3334
  ...resolvedConfig.resourceAttributes,
3073
3335
  "service.name": resolvedConfig.appName,
3074
- [BRIZZ_SDK_VERSION]: _chunkJSTTHMQ3cjs.getSDKVersion.call(void 0, ),
3336
+ [BRIZZ_SDK_VERSION]: _chunkSTTOBCTPcjs.getSDKVersion.call(void 0, ),
3075
3337
  [BRIZZ_SDK_LANGUAGE]: SDK_LANGUAGE
3076
3338
  };
3077
3339
  if (resolvedConfig.environment) {
@@ -3141,19 +3403,19 @@ var _Brizz = (_class7 = class __Brizz {constructor() { _class7.prototype.__init1
3141
3403
  try {
3142
3404
  const tracingModule = TracingModule.getInstance();
3143
3405
  await tracingModule.shutdown();
3144
- } catch (e8) {
3406
+ } catch (e9) {
3145
3407
  _chunkWC573FCIcjs.logger.debug("Tracing module already shut down or not initialized");
3146
3408
  }
3147
3409
  try {
3148
3410
  const metricsModule = MetricsModule.getInstance();
3149
3411
  metricsModule.shutdown();
3150
- } catch (e9) {
3412
+ } catch (e10) {
3151
3413
  _chunkWC573FCIcjs.logger.debug("Metrics module already shut down or not initialized");
3152
3414
  }
3153
3415
  try {
3154
3416
  const loggingModule = LoggingModule.getInstance();
3155
3417
  await loggingModule.shutdown();
3156
- } catch (e10) {
3418
+ } catch (e11) {
3157
3419
  _chunkWC573FCIcjs.logger.debug("Logging module already shut down or not initialized");
3158
3420
  }
3159
3421
  _chunkWC573FCIcjs.logger.info("All telemetry modules shut down successfully");
@@ -3219,10 +3481,10 @@ var _Brizz = (_class7 = class __Brizz {constructor() { _class7.prototype.__init1
3219
3481
  }
3220
3482
  try {
3221
3483
  await this.shutdownModules();
3222
- await _optionalChain([this, 'access', _104 => _104._tracerProvider, 'optionalAccess', _105 => _105.forceFlush, 'call', _106 => _106()]);
3223
- await _optionalChain([this, 'access', _107 => _107._tracerProvider, 'optionalAccess', _108 => _108.shutdown, 'call', _109 => _109()]);
3224
- await _optionalChain([this, 'access', _110 => _110._meterProvider, 'optionalAccess', _111 => _111.forceFlush, 'call', _112 => _112()]);
3225
- await _optionalChain([this, 'access', _113 => _113._meterProvider, 'optionalAccess', _114 => _114.shutdown, 'call', _115 => _115()]);
3484
+ await _optionalChain([this, 'access', _116 => _116._tracerProvider, 'optionalAccess', _117 => _117.forceFlush, 'call', _118 => _118()]);
3485
+ await _optionalChain([this, 'access', _119 => _119._tracerProvider, 'optionalAccess', _120 => _120.shutdown, 'call', _121 => _121()]);
3486
+ await _optionalChain([this, 'access', _122 => _122._meterProvider, 'optionalAccess', _123 => _123.forceFlush, 'call', _124 => _124()]);
3487
+ await _optionalChain([this, 'access', _125 => _125._meterProvider, 'optionalAccess', _126 => _126.shutdown, 'call', _127 => _127()]);
3226
3488
  this._initialized = false;
3227
3489
  this._tracerProvider = null;
3228
3490
  this._meterProvider = null;