@brizz/sdk 0.1.28 → 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/README.md CHANGED
@@ -331,6 +331,20 @@ await startSession('session-456', async (session) => {
331
331
  });
332
332
  ```
333
333
 
334
+ **External link example:**
335
+
336
+ ```typescript
337
+ import { addExternalLink, startSession } from '@brizz/sdk';
338
+
339
+ startSession('session-123', (session) => {
340
+ // Top-level function — resolves the active session from context.
341
+ addExternalLink('https://app.datadoghq.com/trace/abc', { title: 'Datadog trace' });
342
+ });
343
+
344
+ // Outside a session — pass the id explicitly.
345
+ addExternalLink('https://sentry.io/issues/456', { sessionId: 'session-123', linkType: 'sentry' });
346
+ ```
347
+
334
348
  ### Session Title Generation
335
349
 
336
350
  If you use an LLM call to generate session titles, wrap it so those spans don't appear as part of
package/dist/index.cjs CHANGED
@@ -798,7 +798,7 @@ var init_protocol = __esm({
798
798
 
799
799
  // src/internal/version.ts
800
800
  function getSDKVersion() {
801
- return "0.1.28";
801
+ return "0.1.29";
802
802
  }
803
803
  var init_version = __esm({
804
804
  "src/internal/version.ts"() {
@@ -1910,10 +1910,6 @@ var DEFAULT_PII_PATTERNS = [
1910
1910
  name: "pgp_private_keys",
1911
1911
  pattern: "-----BEGIN PGP PRIVATE KEY BLOCK-----"
1912
1912
  },
1913
- {
1914
- name: "certificates",
1915
- pattern: "-----BEGIN CERTIFICATE-----"
1916
- },
1917
1913
  // Additional API Keys and Tokens
1918
1914
  {
1919
1915
  name: "google_oauth",
@@ -1962,7 +1958,7 @@ var DEFAULT_PII_PATTERNS = [
1962
1958
  },
1963
1959
  {
1964
1960
  name: "ssl_certificates",
1965
- pattern: String.raw`-----BEGIN CERTIFICATE-----(?:.|\n)+?\s-----END CERTIFICATE-----`
1961
+ pattern: String.raw`-----BEGIN CERTIFICATE-----(?:.|\n)+?\s*-----END CERTIFICATE-----`
1966
1962
  },
1967
1963
  {
1968
1964
  name: "ssh_dss_public",
@@ -2021,8 +2017,9 @@ function isLikelyReDoSPattern(pattern) {
2021
2017
  const dangerousPatterns = [
2022
2018
  // Nested quantifiers like (a+)+, (a*)+, (a+)*
2023
2019
  /\([^)]*[+*]\)[+*]/,
2024
- // Alternation with overlapping groups like (a|a)*
2025
- /\([^)]*\|[^)]*\)[+*]/,
2020
+ // Overlapping alternation under an outer quantifier like (a|a)+, (\w|\d)+. Scoped to
2021
+ // capturing groups so the lazy (?:…)+? built-ins aren't false-flagged.
2022
+ /\((?!\?)[^)]*\|[^)]*\)[+*]/,
2026
2023
  // Complex backtracking patterns - but more specific
2027
2024
  /\([^)]*[+*][^)]*[+*][^)]*\)[+*]/
2028
2025
  ];
@@ -2091,6 +2088,16 @@ function compilePatternEntries(patternEntries) {
2091
2088
  return null;
2092
2089
  }
2093
2090
  }
2091
+ var compiledPatternCache = /* @__PURE__ */ new WeakMap();
2092
+ function getCompiledPatternsForRule(rule) {
2093
+ const key = rule.patterns;
2094
+ if (compiledPatternCache.has(key)) {
2095
+ return compiledPatternCache.get(key) ?? null;
2096
+ }
2097
+ const compiled = compilePatternEntries(convertPatternsToPatternEntries(rule.patterns));
2098
+ compiledPatternCache.set(key, compiled);
2099
+ return compiled;
2100
+ }
2094
2101
  function getCompiledAttributeNamePattern(rule) {
2095
2102
  if (!rule.attributePattern) {
2096
2103
  logger.debug("No attribute pattern provided, using default .*");
@@ -2184,7 +2191,7 @@ function maskStringByPatternBasedRule(value, rule) {
2184
2191
  if (!patternEntries || patternEntries.length === 0) {
2185
2192
  return mode === "partial" && value ? value[0] + "*****" : "*****";
2186
2193
  }
2187
- const compiledPatterns = compilePatternEntries(patternEntries);
2194
+ const compiledPatterns = getCompiledPatternsForRule(rule);
2188
2195
  if (!compiledPatterns) {
2189
2196
  return value;
2190
2197
  }
package/dist/index.js CHANGED
@@ -780,7 +780,7 @@ var init_protocol = __esm({
780
780
 
781
781
  // src/internal/version.ts
782
782
  function getSDKVersion() {
783
- return "0.1.28";
783
+ return "0.1.29";
784
784
  }
785
785
  var init_version = __esm({
786
786
  "src/internal/version.ts"() {
@@ -1858,10 +1858,6 @@ var DEFAULT_PII_PATTERNS = [
1858
1858
  name: "pgp_private_keys",
1859
1859
  pattern: "-----BEGIN PGP PRIVATE KEY BLOCK-----"
1860
1860
  },
1861
- {
1862
- name: "certificates",
1863
- pattern: "-----BEGIN CERTIFICATE-----"
1864
- },
1865
1861
  // Additional API Keys and Tokens
1866
1862
  {
1867
1863
  name: "google_oauth",
@@ -1910,7 +1906,7 @@ var DEFAULT_PII_PATTERNS = [
1910
1906
  },
1911
1907
  {
1912
1908
  name: "ssl_certificates",
1913
- pattern: String.raw`-----BEGIN CERTIFICATE-----(?:.|\n)+?\s-----END CERTIFICATE-----`
1909
+ pattern: String.raw`-----BEGIN CERTIFICATE-----(?:.|\n)+?\s*-----END CERTIFICATE-----`
1914
1910
  },
1915
1911
  {
1916
1912
  name: "ssh_dss_public",
@@ -1969,8 +1965,9 @@ function isLikelyReDoSPattern(pattern) {
1969
1965
  const dangerousPatterns = [
1970
1966
  // Nested quantifiers like (a+)+, (a*)+, (a+)*
1971
1967
  /\([^)]*[+*]\)[+*]/,
1972
- // Alternation with overlapping groups like (a|a)*
1973
- /\([^)]*\|[^)]*\)[+*]/,
1968
+ // Overlapping alternation under an outer quantifier like (a|a)+, (\w|\d)+. Scoped to
1969
+ // capturing groups so the lazy (?:…)+? built-ins aren't false-flagged.
1970
+ /\((?!\?)[^)]*\|[^)]*\)[+*]/,
1974
1971
  // Complex backtracking patterns - but more specific
1975
1972
  /\([^)]*[+*][^)]*[+*][^)]*\)[+*]/
1976
1973
  ];
@@ -2039,6 +2036,16 @@ function compilePatternEntries(patternEntries) {
2039
2036
  return null;
2040
2037
  }
2041
2038
  }
2039
+ var compiledPatternCache = /* @__PURE__ */ new WeakMap();
2040
+ function getCompiledPatternsForRule(rule) {
2041
+ const key = rule.patterns;
2042
+ if (compiledPatternCache.has(key)) {
2043
+ return compiledPatternCache.get(key) ?? null;
2044
+ }
2045
+ const compiled = compilePatternEntries(convertPatternsToPatternEntries(rule.patterns));
2046
+ compiledPatternCache.set(key, compiled);
2047
+ return compiled;
2048
+ }
2042
2049
  function getCompiledAttributeNamePattern(rule) {
2043
2050
  if (!rule.attributePattern) {
2044
2051
  logger.debug("No attribute pattern provided, using default .*");
@@ -2132,7 +2139,7 @@ function maskStringByPatternBasedRule(value, rule) {
2132
2139
  if (!patternEntries || patternEntries.length === 0) {
2133
2140
  return mode === "partial" && value ? value[0] + "*****" : "*****";
2134
2141
  }
2135
- const compiledPatterns = compilePatternEntries(patternEntries);
2142
+ const compiledPatterns = getCompiledPatternsForRule(rule);
2136
2143
  if (!compiledPatterns) {
2137
2144
  return value;
2138
2145
  }
package/dist/preload.cjs CHANGED
@@ -910,7 +910,7 @@ function safeEnd(span) {
910
910
 
911
911
  // src/internal/version.ts
912
912
  function getSDKVersion() {
913
- return "0.1.28";
913
+ return "0.1.29";
914
914
  }
915
915
 
916
916
  // src/internal/instrumentation/mcp/version.ts
@@ -1308,10 +1308,6 @@ var DEFAULT_PII_PATTERNS = [
1308
1308
  name: "pgp_private_keys",
1309
1309
  pattern: "-----BEGIN PGP PRIVATE KEY BLOCK-----"
1310
1310
  },
1311
- {
1312
- name: "certificates",
1313
- pattern: "-----BEGIN CERTIFICATE-----"
1314
- },
1315
1311
  // Additional API Keys and Tokens
1316
1312
  {
1317
1313
  name: "google_oauth",
@@ -1360,7 +1356,7 @@ var DEFAULT_PII_PATTERNS = [
1360
1356
  },
1361
1357
  {
1362
1358
  name: "ssl_certificates",
1363
- pattern: String.raw`-----BEGIN CERTIFICATE-----(?:.|\n)+?\s-----END CERTIFICATE-----`
1359
+ pattern: String.raw`-----BEGIN CERTIFICATE-----(?:.|\n)+?\s*-----END CERTIFICATE-----`
1364
1360
  },
1365
1361
  {
1366
1362
  name: "ssh_dss_public",
@@ -1418,8 +1414,9 @@ function isLikelyReDoSPattern(pattern) {
1418
1414
  const dangerousPatterns = [
1419
1415
  // Nested quantifiers like (a+)+, (a*)+, (a+)*
1420
1416
  /\([^)]*[+*]\)[+*]/,
1421
- // Alternation with overlapping groups like (a|a)*
1422
- /\([^)]*\|[^)]*\)[+*]/,
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
+ /\((?!\?)[^)]*\|[^)]*\)[+*]/,
1423
1420
  // Complex backtracking patterns - but more specific
1424
1421
  /\([^)]*[+*][^)]*[+*][^)]*\)[+*]/
1425
1422
  ];
@@ -1488,6 +1485,16 @@ function compilePatternEntries(patternEntries) {
1488
1485
  return null;
1489
1486
  }
1490
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
+ }
1491
1498
  function getCompiledAttributeNamePattern(rule) {
1492
1499
  if (!rule.attributePattern) {
1493
1500
  logger.debug("No attribute pattern provided, using default .*");
@@ -1581,7 +1588,7 @@ function maskStringByPatternBasedRule(value, rule) {
1581
1588
  if (!patternEntries || patternEntries.length === 0) {
1582
1589
  return mode === "partial" && value ? value[0] + "*****" : "*****";
1583
1590
  }
1584
- const compiledPatterns = compilePatternEntries(patternEntries);
1591
+ const compiledPatterns = getCompiledPatternsForRule(rule);
1585
1592
  if (!compiledPatterns) {
1586
1593
  return value;
1587
1594
  }
package/dist/preload.js CHANGED
@@ -893,7 +893,7 @@ function safeEnd(span) {
893
893
 
894
894
  // src/internal/version.ts
895
895
  function getSDKVersion() {
896
- return "0.1.28";
896
+ return "0.1.29";
897
897
  }
898
898
 
899
899
  // src/internal/instrumentation/mcp/version.ts
@@ -1293,10 +1293,6 @@ var DEFAULT_PII_PATTERNS = [
1293
1293
  name: "pgp_private_keys",
1294
1294
  pattern: "-----BEGIN PGP PRIVATE KEY BLOCK-----"
1295
1295
  },
1296
- {
1297
- name: "certificates",
1298
- pattern: "-----BEGIN CERTIFICATE-----"
1299
- },
1300
1296
  // Additional API Keys and Tokens
1301
1297
  {
1302
1298
  name: "google_oauth",
@@ -1345,7 +1341,7 @@ var DEFAULT_PII_PATTERNS = [
1345
1341
  },
1346
1342
  {
1347
1343
  name: "ssl_certificates",
1348
- pattern: String.raw`-----BEGIN CERTIFICATE-----(?:.|\n)+?\s-----END CERTIFICATE-----`
1344
+ pattern: String.raw`-----BEGIN CERTIFICATE-----(?:.|\n)+?\s*-----END CERTIFICATE-----`
1349
1345
  },
1350
1346
  {
1351
1347
  name: "ssh_dss_public",
@@ -1403,8 +1399,9 @@ function isLikelyReDoSPattern(pattern) {
1403
1399
  const dangerousPatterns = [
1404
1400
  // Nested quantifiers like (a+)+, (a*)+, (a+)*
1405
1401
  /\([^)]*[+*]\)[+*]/,
1406
- // Alternation with overlapping groups like (a|a)*
1407
- /\([^)]*\|[^)]*\)[+*]/,
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
+ /\((?!\?)[^)]*\|[^)]*\)[+*]/,
1408
1405
  // Complex backtracking patterns - but more specific
1409
1406
  /\([^)]*[+*][^)]*[+*][^)]*\)[+*]/
1410
1407
  ];
@@ -1473,6 +1470,16 @@ function compilePatternEntries(patternEntries) {
1473
1470
  return null;
1474
1471
  }
1475
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
+ }
1476
1483
  function getCompiledAttributeNamePattern(rule) {
1477
1484
  if (!rule.attributePattern) {
1478
1485
  logger.debug("No attribute pattern provided, using default .*");
@@ -1566,7 +1573,7 @@ function maskStringByPatternBasedRule(value, rule) {
1566
1573
  if (!patternEntries || patternEntries.length === 0) {
1567
1574
  return mode === "partial" && value ? value[0] + "*****" : "*****";
1568
1575
  }
1569
- const compiledPatterns = compilePatternEntries(patternEntries);
1576
+ const compiledPatterns = getCompiledPatternsForRule(rule);
1570
1577
  if (!compiledPatterns) {
1571
1578
  return value;
1572
1579
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brizz/sdk",
3
- "version": "0.1.28",
3
+ "version": "0.1.29",
4
4
  "type": "module",
5
5
  "description": "OpenTelemetry-based observability SDK for AI applications",
6
6
  "keywords": [
@@ -94,14 +94,14 @@
94
94
  "@modelcontextprotocol/sdk": "^1.29.0",
95
95
  "@types/jest": "^30.0.0",
96
96
  "@types/node": "^25.9.2",
97
- "@typescript-eslint/eslint-plugin": "^8.60.1",
98
- "@typescript-eslint/parser": "^8.60.1",
99
- "ai": "^6.0.197",
97
+ "@typescript-eslint/eslint-plugin": "^8.61.0",
98
+ "@typescript-eslint/parser": "^8.61.0",
99
+ "ai": "^6.0.198",
100
100
  "eslint": "^10.4.1",
101
101
  "eslint-config-prettier": "^10.1.8",
102
102
  "eslint-plugin-import": "^2.32.0",
103
103
  "eslint-plugin-promise": "^7.3.0",
104
- "eslint-plugin-unicorn": "^65.0.0",
104
+ "eslint-plugin-unicorn": "^65.0.1",
105
105
  "jest": "^30.4.2",
106
106
  "jest-environment-jsdom": "^30.4.1",
107
107
  "openai": "^6.42.0",
@@ -159,7 +159,7 @@
159
159
  "@traceloop/instrumentation-qdrant": "^0.27.0",
160
160
  "@traceloop/instrumentation-together": "^0.27.0",
161
161
  "@traceloop/instrumentation-vertexai": "^0.27.0",
162
- "import-in-the-middle": "^3.0.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"