@glasstrace/sdk 1.11.0 → 1.13.0

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.
Files changed (74) hide show
  1. package/README.md +58 -6
  2. package/dist/async-context/index.cjs +1189 -440
  3. package/dist/async-context/index.cjs.map +1 -1
  4. package/dist/async-context/index.js +2 -2
  5. package/dist/{capture-error-BeuEXXJO.d.cts → capture-error-03qDnC5v.d.cts} +2 -2
  6. package/dist/{capture-error-D02pzB7q.d.ts → capture-error-CAfFUyIU.d.ts} +2 -2
  7. package/dist/{chunk-XG6WR2KS.js → chunk-6ST4QV7T.js} +3 -3
  8. package/dist/{chunk-6RKS3DNA.js → chunk-7LE2O4ZJ.js} +1153 -396
  9. package/dist/chunk-7LE2O4ZJ.js.map +1 -0
  10. package/dist/{chunk-RL43PU2X.js → chunk-F7A3QXCT.js} +2 -2
  11. package/dist/{chunk-M5GO2SSO.js → chunk-HMEHYSTS.js} +2 -2
  12. package/dist/{chunk-OXM2BZMF.js → chunk-LQZRGBN5.js} +2 -2
  13. package/dist/{chunk-QVTONMVZ.js → chunk-MP3QNDXQ.js} +2 -2
  14. package/dist/{chunk-D54FMQHF.js → chunk-VMK2G6QR.js} +2 -2
  15. package/dist/{chunk-DQFGNX3H.js → chunk-VWZMG3W2.js} +21 -20
  16. package/dist/chunk-VWZMG3W2.js.map +1 -0
  17. package/dist/{chunk-BSVWJSVX.js → chunk-XMD5OYD6.js} +2 -2
  18. package/dist/{chunk-FQ4SEG6Y.js → chunk-ZIYT2Y4B.js} +3 -3
  19. package/dist/cli/init.cjs +1266 -497
  20. package/dist/cli/init.cjs.map +1 -1
  21. package/dist/cli/init.js +7 -7
  22. package/dist/cli/mcp-add.cjs +1171 -425
  23. package/dist/cli/mcp-add.cjs.map +1 -1
  24. package/dist/cli/mcp-add.js +3 -3
  25. package/dist/cli/uninit.js +3 -3
  26. package/dist/cli/upgrade-instructions.cjs +1 -1
  27. package/dist/cli/upgrade-instructions.js +3 -3
  28. package/dist/cli/validate.cjs +1168 -422
  29. package/dist/cli/validate.cjs.map +1 -1
  30. package/dist/cli/validate.js +2 -2
  31. package/dist/{correlation-id-NAapJ5jn.d.cts → correlation-id-CZ2bstzA.d.cts} +1 -1
  32. package/dist/{correlation-id-B_K8adD6.d.ts → correlation-id-YcfcqOru.d.ts} +1 -1
  33. package/dist/edge-entry.cjs +1197 -448
  34. package/dist/edge-entry.cjs.map +1 -1
  35. package/dist/edge-entry.d.cts +2 -2
  36. package/dist/edge-entry.d.ts +2 -2
  37. package/dist/edge-entry.js +4 -4
  38. package/dist/index.cjs +1352 -555
  39. package/dist/index.cjs.map +1 -1
  40. package/dist/{index.d-CkTf_boH.d.ts → index.d-BQIJ5Dvc.d.cts} +44 -9
  41. package/dist/{index.d-CkTf_boH.d.cts → index.d-BQIJ5Dvc.d.ts} +44 -9
  42. package/dist/index.d.cts +4 -4
  43. package/dist/index.d.ts +4 -4
  44. package/dist/index.js +26 -14
  45. package/dist/index.js.map +1 -1
  46. package/dist/middleware/index.cjs +1192 -443
  47. package/dist/middleware/index.cjs.map +1 -1
  48. package/dist/middleware/index.js +2 -2
  49. package/dist/node-entry.cjs +1323 -550
  50. package/dist/node-entry.cjs.map +1 -1
  51. package/dist/node-entry.d.cts +3 -3
  52. package/dist/node-entry.d.ts +3 -3
  53. package/dist/node-entry.js +7 -7
  54. package/dist/node-subpath.cjs +1168 -422
  55. package/dist/node-subpath.cjs.map +1 -1
  56. package/dist/node-subpath.d.cts +1 -1
  57. package/dist/node-subpath.d.ts +1 -1
  58. package/dist/node-subpath.js +3 -3
  59. package/dist/{source-map-uploader-CLYCE2TZ.js → source-map-uploader-NUONOEJG.js} +3 -3
  60. package/dist/trpc/index.cjs +1187 -438
  61. package/dist/trpc/index.cjs.map +1 -1
  62. package/dist/trpc/index.js +1 -1
  63. package/package.json +2 -2
  64. package/dist/chunk-6RKS3DNA.js.map +0 -1
  65. package/dist/chunk-DQFGNX3H.js.map +0 -1
  66. /package/dist/{chunk-XG6WR2KS.js.map → chunk-6ST4QV7T.js.map} +0 -0
  67. /package/dist/{chunk-RL43PU2X.js.map → chunk-F7A3QXCT.js.map} +0 -0
  68. /package/dist/{chunk-M5GO2SSO.js.map → chunk-HMEHYSTS.js.map} +0 -0
  69. /package/dist/{chunk-OXM2BZMF.js.map → chunk-LQZRGBN5.js.map} +0 -0
  70. /package/dist/{chunk-QVTONMVZ.js.map → chunk-MP3QNDXQ.js.map} +0 -0
  71. /package/dist/{chunk-D54FMQHF.js.map → chunk-VMK2G6QR.js.map} +0 -0
  72. /package/dist/{chunk-BSVWJSVX.js.map → chunk-XMD5OYD6.js.map} +0 -0
  73. /package/dist/{chunk-FQ4SEG6Y.js.map → chunk-ZIYT2Y4B.js.map} +0 -0
  74. /package/dist/{source-map-uploader-CLYCE2TZ.js.map → source-map-uploader-NUONOEJG.js.map} +0 -0
package/README.md CHANGED
@@ -522,13 +522,55 @@ flag.
522
522
  What the SDK captures: a compact, normalized operation label, the
523
523
  operation kind (`email`, `calendar_link`, `webhook`, `external_api`,
524
524
  `queue`, `after_callback`), an optional lifecycle status
525
- (`scheduled`, `started`, `succeeded`, `failed`, `unknown`), an
525
+ (`scheduled`, `started`, `succeeded`, `failed`, `unknown`), and an
526
526
  optional execution phase (`request`, `post_response`, `background`,
527
- `unknown`), and a small set of allowlisted semantic fields:
528
- `templateKey`, `providerOperation`, `role`, `locale`, `timezone`,
529
- `status`, `phase`. Each value is bounded to compact tokens — IANA
530
- timezones, BCP-47 locales, identifier-shaped enum tokens. The
531
- per-trace operation budget is five.
527
+ `unknown`). Per-span operation budget is five.
528
+
529
+ Semantic fields are admitted by **named-pattern admission**: a
530
+ stable-core literal set plus an open suffix family. Both halves are
531
+ valid; specialized validators on stable-core keys win over the
532
+ default suffix routing.
533
+
534
+ **Stable core** (7 keys, specialized validators): `templateKey`,
535
+ `providerOperation`, `role`, `locale`, `timezone`, `status`, `phase`.
536
+ Values are bounded to identifier-shaped compact tokens, with
537
+ specialized BCP-47 validation for `locale` and IANA validation for
538
+ `timezone`.
539
+
540
+ **Open pattern** (4 canonical suffixes): keys matching
541
+ `^[a-z][A-Za-z0-9]*(Class|Count|Kind|Role)$` are admitted alongside
542
+ the stable core. Value shapes are suffix-routed:
543
+
544
+ | Suffix | Value shape | Max length | Casing convention | Examples |
545
+ |---|---|---|---|---|
546
+ | `*Class` | identifier-shaped compact token | 80 | lowercase-kebab | `recipientClass=removed-participant`, `attachmentClass=no-timezone-ics` |
547
+ | `*Count` | non-negative integer string | 16 | digits only (no `-`, `.`, or letters) | `participantCount="2"`, `attemptCount="3"` |
548
+ | `*Kind` | identifier-shaped compact token | 80 | lowerCamel or `UPPERCASE-CONST` | `notificationKind=transactional` |
549
+ | `*Role` | identifier-shaped compact token | 80 | lowercase-kebab | `actorRole=operator` |
550
+
551
+ Value casing is preserved verbatim; normalize at the call site so
552
+ cross-trace comparisons collapse to the same identity. Non-digit
553
+ `*Count` values (`"many"`, `"1.5"`, `"-1"`) are rejected and counted
554
+ under the `raw_payload` omission reason. Keys that don't match the
555
+ pattern (snake_case, uppercase lead, no canonical suffix) are
556
+ rejected and counted under `unsupported_key`.
557
+
558
+ Forbidden values, regardless of suffix: identifiers (UUIDs,
559
+ account/request/message IDs), bearer tokens, API keys, secrets,
560
+ hashes, version strings, raw payloads, recipient PII (emails, names,
561
+ phone numbers), URLs, and free-form prose. The compact-token regex
562
+ admits these shapes syntactically; the SDK's privacy filter
563
+ (`detectUnsafePattern`) rejects email-shaped and bearer-shaped
564
+ values at the runtime layer, but semantic violations (a UUID-shaped
565
+ value passing the unsafe-pattern check) are the caller's
566
+ responsibility to avoid. Coerce sensitive shapes to a normalized
567
+ `*Class` vocabulary instead (e.g., `payloadClass=non-empty` rather
568
+ than `payloadHash=abc123`).
569
+
570
+ For compile-time autocomplete on the stable-core subset, import the
571
+ narrower type `SideEffectSemanticFieldStableCoreKey`. For runtime
572
+ validation of producer-supplied key names, use the exported guard
573
+ `isSideEffectSemanticFieldKey(key: string): boolean`.
532
574
 
533
575
  What the SDK does not capture: recipient email addresses, sender or
534
576
  recipient names, rendered email subjects or bodies, calendar links,
@@ -560,10 +602,20 @@ recordSideEffect({
560
602
  status: "succeeded",
561
603
  phase: "request",
562
604
  fields: {
605
+ // Stable core
563
606
  templateKey: "EventCanceledEmail",
564
607
  role: "invitee",
565
608
  locale: "en-US",
566
609
  timezone: "Europe/Paris",
610
+ // Pattern: *Class
611
+ recipientClass: "removed-participant",
612
+ // Pattern: *Count (non-negative integer string)
613
+ participantCount: "2",
614
+ activeParticipantCount: "1",
615
+ // Pattern: *Kind
616
+ notificationKind: "transactional",
617
+ // Pattern: *Role
618
+ actorRole: "system-bot",
567
619
  },
568
620
  });
569
621
  ```