@brizz/sdk 0.1.27 → 0.1.29

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/preload.cjs CHANGED
@@ -472,6 +472,7 @@ var SESSION_ID = "session.id";
472
472
  var PROPERTIES_CONTEXT_KEY = (0, import_api3.createContextKey)(PROPERTIES);
473
473
  var SESSION_OBJECT_CONTEXT_KEY = (0, import_api3.createContextKey)("brizz.session.object");
474
474
  var INTERRUPT_TOOLS = "brizz.internal.interrupt";
475
+ var INTERNAL_EVENT_PREFIX = "brizz.internal.";
475
476
 
476
477
  // src/internal/instrumentation/mcp/session.ts
477
478
  function stampAndPropagateSession(span, sessionId, baseContext = import_api4.context.active()) {
@@ -909,7 +910,7 @@ function safeEnd(span) {
909
910
 
910
911
  // src/internal/version.ts
911
912
  function getSDKVersion() {
912
- return "0.1.27";
913
+ return "0.1.29";
913
914
  }
914
915
 
915
916
  // src/internal/instrumentation/mcp/version.ts
@@ -1211,8 +1212,11 @@ var import_exporter_logs_otlp_http = require("@opentelemetry/exporter-logs-otlp-
1211
1212
  var import_resources = require("@opentelemetry/resources");
1212
1213
  var import_sdk_logs2 = require("@opentelemetry/sdk-logs");
1213
1214
 
1214
- // src/internal/log/processors/log-processor.ts
1215
+ // src/internal/trace/session.ts
1215
1216
  var import_api9 = require("@opentelemetry/api");
1217
+
1218
+ // src/internal/log/processors/log-processor.ts
1219
+ var import_api10 = require("@opentelemetry/api");
1216
1220
  var import_sdk_logs = require("@opentelemetry/sdk-logs");
1217
1221
 
1218
1222
  // src/internal/masking/patterns.ts
@@ -1304,10 +1308,6 @@ var DEFAULT_PII_PATTERNS = [
1304
1308
  name: "pgp_private_keys",
1305
1309
  pattern: "-----BEGIN PGP PRIVATE KEY BLOCK-----"
1306
1310
  },
1307
- {
1308
- name: "certificates",
1309
- pattern: "-----BEGIN CERTIFICATE-----"
1310
- },
1311
1311
  // Additional API Keys and Tokens
1312
1312
  {
1313
1313
  name: "google_oauth",
@@ -1356,7 +1356,7 @@ var DEFAULT_PII_PATTERNS = [
1356
1356
  },
1357
1357
  {
1358
1358
  name: "ssl_certificates",
1359
- pattern: String.raw`-----BEGIN CERTIFICATE-----(?:.|\n)+?\s-----END CERTIFICATE-----`
1359
+ pattern: String.raw`-----BEGIN CERTIFICATE-----(?:.|\n)+?\s*-----END CERTIFICATE-----`
1360
1360
  },
1361
1361
  {
1362
1362
  name: "ssh_dss_public",
@@ -1414,8 +1414,9 @@ function isLikelyReDoSPattern(pattern) {
1414
1414
  const dangerousPatterns = [
1415
1415
  // Nested quantifiers like (a+)+, (a*)+, (a+)*
1416
1416
  /\([^)]*[+*]\)[+*]/,
1417
- // Alternation with overlapping groups like (a|a)*
1418
- /\([^)]*\|[^)]*\)[+*]/,
1417
+ // Overlapping alternation under an outer quantifier like (a|a)+, (\w|\d)+. Scoped to
1418
+ // capturing groups so the lazy (?:…)+? built-ins aren't false-flagged.
1419
+ /\((?!\?)[^)]*\|[^)]*\)[+*]/,
1419
1420
  // Complex backtracking patterns - but more specific
1420
1421
  /\([^)]*[+*][^)]*[+*][^)]*\)[+*]/
1421
1422
  ];
@@ -1484,6 +1485,16 @@ function compilePatternEntries(patternEntries) {
1484
1485
  return null;
1485
1486
  }
1486
1487
  }
1488
+ var compiledPatternCache = /* @__PURE__ */ new WeakMap();
1489
+ function getCompiledPatternsForRule(rule) {
1490
+ const key = rule.patterns;
1491
+ if (compiledPatternCache.has(key)) {
1492
+ return compiledPatternCache.get(key) ?? null;
1493
+ }
1494
+ const compiled = compilePatternEntries(convertPatternsToPatternEntries(rule.patterns));
1495
+ compiledPatternCache.set(key, compiled);
1496
+ return compiled;
1497
+ }
1487
1498
  function getCompiledAttributeNamePattern(rule) {
1488
1499
  if (!rule.attributePattern) {
1489
1500
  logger.debug("No attribute pattern provided, using default .*");
@@ -1577,7 +1588,7 @@ function maskStringByPatternBasedRule(value, rule) {
1577
1588
  if (!patternEntries || patternEntries.length === 0) {
1578
1589
  return mode === "partial" && value ? value[0] + "*****" : "*****";
1579
1590
  }
1580
- const compiledPatterns = compilePatternEntries(patternEntries);
1591
+ const compiledPatterns = getCompiledPatternsForRule(rule);
1581
1592
  if (!compiledPatterns) {
1582
1593
  return value;
1583
1594
  }
@@ -1641,7 +1652,7 @@ var BrizzSimpleLogRecordProcessor = class extends import_sdk_logs.SimpleLogRecor
1641
1652
  if (maskingConfig) {
1642
1653
  maskLog(logRecord, maskingConfig);
1643
1654
  }
1644
- const associationProperties = import_api9.context.active().getValue(PROPERTIES_CONTEXT_KEY);
1655
+ const associationProperties = import_api10.context.active().getValue(PROPERTIES_CONTEXT_KEY);
1645
1656
  if (associationProperties) {
1646
1657
  for (const [key, value] of Object.entries(associationProperties)) {
1647
1658
  logRecord.setAttribute(`${BRIZZ}.${key}`, value);
@@ -1661,7 +1672,7 @@ var BrizzBatchLogRecordProcessor = class extends import_sdk_logs.BatchLogRecordP
1661
1672
  if (maskingConfig) {
1662
1673
  maskLog(logRecord, maskingConfig);
1663
1674
  }
1664
- const associationProperties = import_api9.context.active().getValue(PROPERTIES_CONTEXT_KEY);
1675
+ const associationProperties = import_api10.context.active().getValue(PROPERTIES_CONTEXT_KEY);
1665
1676
  if (associationProperties) {
1666
1677
  for (const [key, value] of Object.entries(associationProperties)) {
1667
1678
  logRecord.setAttribute(`${BRIZZ}.${key}`, value);
@@ -1690,6 +1701,11 @@ function maskLog(logRecord, config) {
1690
1701
  for (const [key, value] of Object.entries(maskedAttributes)) {
1691
1702
  newAttributes[key] = value;
1692
1703
  }
1704
+ for (const [key, value] of Object.entries(logRecord.attributes)) {
1705
+ if (key.startsWith(INTERNAL_EVENT_PREFIX)) {
1706
+ newAttributes[key] = value;
1707
+ }
1708
+ }
1693
1709
  logRecord.setAttributes(newAttributes);
1694
1710
  }
1695
1711
  }
@@ -2048,10 +2064,10 @@ var BrizzSpanExporter = class {
2048
2064
  };
2049
2065
 
2050
2066
  // src/internal/trace/processors/span-processor.ts
2051
- var import_api10 = require("@opentelemetry/api");
2067
+ var import_api11 = require("@opentelemetry/api");
2052
2068
  var import_sdk_trace_base = require("@opentelemetry/sdk-trace-base");
2053
2069
  function applyContextAttributes(span) {
2054
- const sessionProperties = import_api10.context.active().getValue(PROPERTIES_CONTEXT_KEY);
2070
+ const sessionProperties = import_api11.context.active().getValue(PROPERTIES_CONTEXT_KEY);
2055
2071
  if (sessionProperties) {
2056
2072
  for (const [key, value] of Object.entries(sessionProperties)) {
2057
2073
  span.setAttribute(`${BRIZZ}.${key}`, value);
@@ -2233,9 +2249,6 @@ function getSpanProcessor() {
2233
2249
  return TracingModule.getInstance().getSpanProcessor();
2234
2250
  }
2235
2251
 
2236
- // src/internal/trace/session.ts
2237
- var import_api11 = require("@opentelemetry/api");
2238
-
2239
2252
  // src/internal/sdk.ts
2240
2253
  var _Brizz = class __Brizz {
2241
2254
  static instance = null;
package/dist/preload.js CHANGED
@@ -455,6 +455,7 @@ var SESSION_ID = "session.id";
455
455
  var PROPERTIES_CONTEXT_KEY = createContextKey(PROPERTIES);
456
456
  var SESSION_OBJECT_CONTEXT_KEY = createContextKey("brizz.session.object");
457
457
  var INTERRUPT_TOOLS = "brizz.internal.interrupt";
458
+ var INTERNAL_EVENT_PREFIX = "brizz.internal.";
458
459
 
459
460
  // src/internal/instrumentation/mcp/session.ts
460
461
  function stampAndPropagateSession(span, sessionId, baseContext = context.active()) {
@@ -892,7 +893,7 @@ function safeEnd(span) {
892
893
 
893
894
  // src/internal/version.ts
894
895
  function getSDKVersion() {
895
- return "0.1.27";
896
+ return "0.1.29";
896
897
  }
897
898
 
898
899
  // src/internal/instrumentation/mcp/version.ts
@@ -1196,8 +1197,11 @@ import {
1196
1197
  LoggerProvider
1197
1198
  } from "@opentelemetry/sdk-logs";
1198
1199
 
1200
+ // src/internal/trace/session.ts
1201
+ import { context as context3, trace as trace4, SpanStatusCode as SpanStatusCode3 } from "@opentelemetry/api";
1202
+
1199
1203
  // src/internal/log/processors/log-processor.ts
1200
- import { context as context3 } from "@opentelemetry/api";
1204
+ import { context as context4 } from "@opentelemetry/api";
1201
1205
  import { BatchLogRecordProcessor, SimpleLogRecordProcessor } from "@opentelemetry/sdk-logs";
1202
1206
 
1203
1207
  // src/internal/masking/patterns.ts
@@ -1289,10 +1293,6 @@ var DEFAULT_PII_PATTERNS = [
1289
1293
  name: "pgp_private_keys",
1290
1294
  pattern: "-----BEGIN PGP PRIVATE KEY BLOCK-----"
1291
1295
  },
1292
- {
1293
- name: "certificates",
1294
- pattern: "-----BEGIN CERTIFICATE-----"
1295
- },
1296
1296
  // Additional API Keys and Tokens
1297
1297
  {
1298
1298
  name: "google_oauth",
@@ -1341,7 +1341,7 @@ var DEFAULT_PII_PATTERNS = [
1341
1341
  },
1342
1342
  {
1343
1343
  name: "ssl_certificates",
1344
- pattern: String.raw`-----BEGIN CERTIFICATE-----(?:.|\n)+?\s-----END CERTIFICATE-----`
1344
+ pattern: String.raw`-----BEGIN CERTIFICATE-----(?:.|\n)+?\s*-----END CERTIFICATE-----`
1345
1345
  },
1346
1346
  {
1347
1347
  name: "ssh_dss_public",
@@ -1399,8 +1399,9 @@ function isLikelyReDoSPattern(pattern) {
1399
1399
  const dangerousPatterns = [
1400
1400
  // Nested quantifiers like (a+)+, (a*)+, (a+)*
1401
1401
  /\([^)]*[+*]\)[+*]/,
1402
- // Alternation with overlapping groups like (a|a)*
1403
- /\([^)]*\|[^)]*\)[+*]/,
1402
+ // Overlapping alternation under an outer quantifier like (a|a)+, (\w|\d)+. Scoped to
1403
+ // capturing groups so the lazy (?:…)+? built-ins aren't false-flagged.
1404
+ /\((?!\?)[^)]*\|[^)]*\)[+*]/,
1404
1405
  // Complex backtracking patterns - but more specific
1405
1406
  /\([^)]*[+*][^)]*[+*][^)]*\)[+*]/
1406
1407
  ];
@@ -1469,6 +1470,16 @@ function compilePatternEntries(patternEntries) {
1469
1470
  return null;
1470
1471
  }
1471
1472
  }
1473
+ var compiledPatternCache = /* @__PURE__ */ new WeakMap();
1474
+ function getCompiledPatternsForRule(rule) {
1475
+ const key = rule.patterns;
1476
+ if (compiledPatternCache.has(key)) {
1477
+ return compiledPatternCache.get(key) ?? null;
1478
+ }
1479
+ const compiled = compilePatternEntries(convertPatternsToPatternEntries(rule.patterns));
1480
+ compiledPatternCache.set(key, compiled);
1481
+ return compiled;
1482
+ }
1472
1483
  function getCompiledAttributeNamePattern(rule) {
1473
1484
  if (!rule.attributePattern) {
1474
1485
  logger.debug("No attribute pattern provided, using default .*");
@@ -1562,7 +1573,7 @@ function maskStringByPatternBasedRule(value, rule) {
1562
1573
  if (!patternEntries || patternEntries.length === 0) {
1563
1574
  return mode === "partial" && value ? value[0] + "*****" : "*****";
1564
1575
  }
1565
- const compiledPatterns = compilePatternEntries(patternEntries);
1576
+ const compiledPatterns = getCompiledPatternsForRule(rule);
1566
1577
  if (!compiledPatterns) {
1567
1578
  return value;
1568
1579
  }
@@ -1626,7 +1637,7 @@ var BrizzSimpleLogRecordProcessor = class extends SimpleLogRecordProcessor {
1626
1637
  if (maskingConfig) {
1627
1638
  maskLog(logRecord, maskingConfig);
1628
1639
  }
1629
- const associationProperties = context3.active().getValue(PROPERTIES_CONTEXT_KEY);
1640
+ const associationProperties = context4.active().getValue(PROPERTIES_CONTEXT_KEY);
1630
1641
  if (associationProperties) {
1631
1642
  for (const [key, value] of Object.entries(associationProperties)) {
1632
1643
  logRecord.setAttribute(`${BRIZZ}.${key}`, value);
@@ -1646,7 +1657,7 @@ var BrizzBatchLogRecordProcessor = class extends BatchLogRecordProcessor {
1646
1657
  if (maskingConfig) {
1647
1658
  maskLog(logRecord, maskingConfig);
1648
1659
  }
1649
- const associationProperties = context3.active().getValue(PROPERTIES_CONTEXT_KEY);
1660
+ const associationProperties = context4.active().getValue(PROPERTIES_CONTEXT_KEY);
1650
1661
  if (associationProperties) {
1651
1662
  for (const [key, value] of Object.entries(associationProperties)) {
1652
1663
  logRecord.setAttribute(`${BRIZZ}.${key}`, value);
@@ -1675,6 +1686,11 @@ function maskLog(logRecord, config) {
1675
1686
  for (const [key, value] of Object.entries(maskedAttributes)) {
1676
1687
  newAttributes[key] = value;
1677
1688
  }
1689
+ for (const [key, value] of Object.entries(logRecord.attributes)) {
1690
+ if (key.startsWith(INTERNAL_EVENT_PREFIX)) {
1691
+ newAttributes[key] = value;
1692
+ }
1693
+ }
1678
1694
  logRecord.setAttributes(newAttributes);
1679
1695
  }
1680
1696
  }
@@ -2033,13 +2049,13 @@ var BrizzSpanExporter = class {
2033
2049
  };
2034
2050
 
2035
2051
  // src/internal/trace/processors/span-processor.ts
2036
- import { context as context4 } from "@opentelemetry/api";
2052
+ import { context as context5 } from "@opentelemetry/api";
2037
2053
  import {
2038
2054
  BatchSpanProcessor,
2039
2055
  SimpleSpanProcessor
2040
2056
  } from "@opentelemetry/sdk-trace-base";
2041
2057
  function applyContextAttributes(span) {
2042
- const sessionProperties = context4.active().getValue(PROPERTIES_CONTEXT_KEY);
2058
+ const sessionProperties = context5.active().getValue(PROPERTIES_CONTEXT_KEY);
2043
2059
  if (sessionProperties) {
2044
2060
  for (const [key, value] of Object.entries(sessionProperties)) {
2045
2061
  span.setAttribute(`${BRIZZ}.${key}`, value);
@@ -2221,9 +2237,6 @@ function getSpanProcessor() {
2221
2237
  return TracingModule.getInstance().getSpanProcessor();
2222
2238
  }
2223
2239
 
2224
- // src/internal/trace/session.ts
2225
- import { context as context5, trace as trace4, SpanStatusCode as SpanStatusCode3 } from "@opentelemetry/api";
2226
-
2227
2240
  // src/internal/sdk.ts
2228
2241
  var _Brizz = class __Brizz {
2229
2242
  static instance = null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brizz/sdk",
3
- "version": "0.1.27",
3
+ "version": "0.1.29",
4
4
  "type": "module",
5
5
  "description": "OpenTelemetry-based observability SDK for AI applications",
6
6
  "keywords": [
@@ -85,32 +85,32 @@
85
85
  "registry": "https://registry.npmjs.org/"
86
86
  },
87
87
  "devDependencies": {
88
- "@ai-sdk/anthropic": "^3.0.63",
89
- "@ai-sdk/openai": "^3.0.47",
88
+ "@ai-sdk/anthropic": "^3.0.81",
89
+ "@ai-sdk/openai": "^3.0.68",
90
90
  "@arizeai/openinference-instrumentation-mcp": "^0.2.14",
91
- "@changesets/changelog-github": "^0.6.0",
91
+ "@changesets/changelog-github": "^0.7.0",
92
92
  "@changesets/cli": "^2.30.0",
93
93
  "@eslint/js": "^10.0.1",
94
94
  "@modelcontextprotocol/sdk": "^1.29.0",
95
95
  "@types/jest": "^30.0.0",
96
- "@types/node": "^25.5.0",
97
- "@typescript-eslint/eslint-plugin": "^8.57.1",
98
- "@typescript-eslint/parser": "^8.57.1",
99
- "ai": "^6.0.134",
100
- "eslint": "^10.1.0",
96
+ "@types/node": "^25.9.2",
97
+ "@typescript-eslint/eslint-plugin": "^8.61.0",
98
+ "@typescript-eslint/parser": "^8.61.0",
99
+ "ai": "^6.0.198",
100
+ "eslint": "^10.4.1",
101
101
  "eslint-config-prettier": "^10.1.8",
102
102
  "eslint-plugin-import": "^2.32.0",
103
- "eslint-plugin-promise": "^7.2.1",
104
- "eslint-plugin-unicorn": "^63.0.0",
105
- "jest": "^30.3.0",
106
- "jest-environment-jsdom": "^30.3.0",
107
- "openai": "^6.32.0",
103
+ "eslint-plugin-promise": "^7.3.0",
104
+ "eslint-plugin-unicorn": "^65.0.1",
105
+ "jest": "^30.4.2",
106
+ "jest-environment-jsdom": "^30.4.1",
107
+ "openai": "^6.42.0",
108
108
  "prettier": "^3.8.1",
109
- "ts-jest": "^29.4.6",
109
+ "ts-jest": "^29.4.11",
110
110
  "tsup": "^8.5.1",
111
- "typescript": "^5.9.3",
112
- "vitest": "^4.1.0",
113
- "zod": "^4.3.6"
111
+ "typescript": "^6.0.3",
112
+ "vitest": "^4.1.8",
113
+ "zod": "^4.4.3"
114
114
  },
115
115
  "peerDependencies": {
116
116
  "@langchain/core": "^0.3.0 || ^1.0.0",
@@ -129,37 +129,37 @@
129
129
  }
130
130
  },
131
131
  "dependencies": {
132
- "@arizeai/openinference-instrumentation-langchain": "^4.0.6",
133
- "@arizeai/openinference-instrumentation-mcp": "^0.2.14",
132
+ "@arizeai/openinference-instrumentation-langchain": "^4.0.12",
133
+ "@arizeai/openinference-instrumentation-mcp": "^0.2.18",
134
134
  "@modelcontextprotocol/sdk": "^1.29.0",
135
135
  "@opentelemetry/api": "^1.9.0",
136
- "@opentelemetry/api-logs": "^0.213.0",
137
- "@opentelemetry/auto-instrumentations-node": "^0.75.0",
136
+ "@opentelemetry/api-logs": "^0.218.0",
137
+ "@opentelemetry/auto-instrumentations-node": "^0.76.0",
138
138
  "@opentelemetry/core": "^2.6.0",
139
- "@opentelemetry/exporter-logs-otlp-http": "^0.213.0",
140
- "@opentelemetry/exporter-metrics-otlp-http": "^0.213.0",
141
- "@opentelemetry/exporter-trace-otlp-http": "^0.213.0",
142
- "@opentelemetry/exporter-trace-otlp-proto": "^0.213.0",
143
- "@opentelemetry/instrumentation": "^0.213.0",
139
+ "@opentelemetry/exporter-logs-otlp-http": "^0.218.0",
140
+ "@opentelemetry/exporter-metrics-otlp-http": "^0.218.0",
141
+ "@opentelemetry/exporter-trace-otlp-http": "^0.218.0",
142
+ "@opentelemetry/exporter-trace-otlp-proto": "^0.218.0",
143
+ "@opentelemetry/instrumentation": "^0.218.0",
144
144
  "@opentelemetry/resources": "^2.6.0",
145
- "@opentelemetry/sdk-logs": "^0.213.0",
145
+ "@opentelemetry/sdk-logs": "^0.218.0",
146
146
  "@opentelemetry/sdk-metrics": "^2.6.0",
147
- "@opentelemetry/sdk-node": "^0.217.0",
147
+ "@opentelemetry/sdk-node": "^0.218.0",
148
148
  "@opentelemetry/sdk-trace-base": "^2.6.0",
149
149
  "@opentelemetry/sdk-trace-node": "^2.6.0",
150
- "@opentelemetry/semantic-conventions": "^1.40.0",
151
- "@traceloop/ai-semantic-conventions": "^0.22.5",
152
- "@traceloop/instrumentation-anthropic": "^0.22.6",
153
- "@traceloop/instrumentation-bedrock": "^0.22.6",
154
- "@traceloop/instrumentation-chromadb": "^0.22.5",
155
- "@traceloop/instrumentation-cohere": "^0.22.6",
156
- "@traceloop/instrumentation-llamaindex": "^0.22.6",
157
- "@traceloop/instrumentation-openai": "^0.26.0",
158
- "@traceloop/instrumentation-pinecone": "^0.22.5",
159
- "@traceloop/instrumentation-qdrant": "^0.22.6",
160
- "@traceloop/instrumentation-together": "^0.22.5",
161
- "@traceloop/instrumentation-vertexai": "^0.22.5",
162
- "import-in-the-middle": "^3.0.0",
150
+ "@opentelemetry/semantic-conventions": "^1.41.1",
151
+ "@traceloop/ai-semantic-conventions": "^0.27.0",
152
+ "@traceloop/instrumentation-anthropic": "^0.27.0",
153
+ "@traceloop/instrumentation-bedrock": "^0.27.0",
154
+ "@traceloop/instrumentation-chromadb": "^0.27.0",
155
+ "@traceloop/instrumentation-cohere": "^0.27.0",
156
+ "@traceloop/instrumentation-llamaindex": "^0.27.0",
157
+ "@traceloop/instrumentation-openai": "^0.27.0",
158
+ "@traceloop/instrumentation-pinecone": "^0.27.0",
159
+ "@traceloop/instrumentation-qdrant": "^0.27.0",
160
+ "@traceloop/instrumentation-together": "^0.27.0",
161
+ "@traceloop/instrumentation-vertexai": "^0.27.0",
162
+ "import-in-the-middle": "^3.0.2",
163
163
  "pino": "^10.3.1",
164
164
  "pino-pretty": "^13.1.3",
165
165
  "tslib": "^2.8.1"