@glasstrace/sdk 1.12.0 → 1.14.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 (67) hide show
  1. package/README.md +55 -20
  2. package/dist/async-context/index.cjs.map +1 -1
  3. package/dist/async-context/index.js +2 -2
  4. package/dist/{capture-error-CRQSqKgd.d.cts → capture-error-03qDnC5v.d.cts} +2 -2
  5. package/dist/{capture-error-CqCbjoMq.d.ts → capture-error-CAfFUyIU.d.ts} +2 -2
  6. package/dist/{chunk-6NKMAKMI.js → chunk-6ST4QV7T.js} +3 -3
  7. package/dist/{chunk-BN5DVIUO.js → chunk-7LE2O4ZJ.js} +12 -7
  8. package/dist/{chunk-BN5DVIUO.js.map → chunk-7LE2O4ZJ.js.map} +1 -1
  9. package/dist/{chunk-CZQN6G4I.js → chunk-E2F4S5IJ.js} +362 -11
  10. package/dist/chunk-E2F4S5IJ.js.map +1 -0
  11. package/dist/{chunk-J3ZCVE67.js → chunk-F7A3QXCT.js} +2 -2
  12. package/dist/{chunk-M3ZTG4P5.js → chunk-HMEHYSTS.js} +2 -2
  13. package/dist/{chunk-4YRYR32D.js → chunk-LQZRGBN5.js} +2 -2
  14. package/dist/{chunk-ZIL2IY4C.js → chunk-MP3QNDXQ.js} +2 -2
  15. package/dist/{chunk-FFNGE5RR.js → chunk-VMK2G6QR.js} +2 -2
  16. package/dist/{chunk-KBHGPQZ2.js → chunk-XMD5OYD6.js} +2 -2
  17. package/dist/{chunk-V75ZB4G4.js → chunk-ZIYT2Y4B.js} +3 -3
  18. package/dist/cli/init.cjs +4 -4
  19. package/dist/cli/init.cjs.map +1 -1
  20. package/dist/cli/init.js +7 -7
  21. package/dist/cli/mcp-add.cjs +1 -1
  22. package/dist/cli/mcp-add.cjs.map +1 -1
  23. package/dist/cli/mcp-add.js +3 -3
  24. package/dist/cli/uninit.js +3 -3
  25. package/dist/cli/upgrade-instructions.cjs +1 -1
  26. package/dist/cli/upgrade-instructions.js +3 -3
  27. package/dist/cli/validate.cjs.map +1 -1
  28. package/dist/cli/validate.js +2 -2
  29. package/dist/{correlation-id-CFpyJsKv.d.cts → correlation-id-CZ2bstzA.d.cts} +1 -1
  30. package/dist/{correlation-id-DPXyY9-3.d.ts → correlation-id-YcfcqOru.d.ts} +1 -1
  31. package/dist/edge-entry.cjs.map +1 -1
  32. package/dist/edge-entry.d.cts +2 -2
  33. package/dist/edge-entry.d.ts +2 -2
  34. package/dist/edge-entry.js +4 -4
  35. package/dist/index.cjs +1033 -960
  36. package/dist/index.cjs.map +1 -1
  37. package/dist/{index.d-D-jdiIPU.d.cts → index.d-BQIJ5Dvc.d.cts} +44 -9
  38. package/dist/{index.d-D-jdiIPU.d.ts → index.d-BQIJ5Dvc.d.ts} +44 -9
  39. package/dist/index.d.cts +4 -4
  40. package/dist/index.d.ts +4 -4
  41. package/dist/index.js +10 -297
  42. package/dist/index.js.map +1 -1
  43. package/dist/middleware/index.cjs.map +1 -1
  44. package/dist/middleware/index.js +2 -2
  45. package/dist/node-entry.cjs +12 -5
  46. package/dist/node-entry.cjs.map +1 -1
  47. package/dist/node-entry.d.cts +3 -3
  48. package/dist/node-entry.d.ts +3 -3
  49. package/dist/node-entry.js +7 -7
  50. package/dist/node-subpath.cjs.map +1 -1
  51. package/dist/node-subpath.d.cts +1 -1
  52. package/dist/node-subpath.d.ts +1 -1
  53. package/dist/node-subpath.js +3 -3
  54. package/dist/{source-map-uploader-K67LTPBG.js → source-map-uploader-NUONOEJG.js} +3 -3
  55. package/dist/trpc/index.cjs.map +1 -1
  56. package/dist/trpc/index.js +1 -1
  57. package/package.json +1 -1
  58. package/dist/chunk-CZQN6G4I.js.map +0 -1
  59. /package/dist/{chunk-6NKMAKMI.js.map → chunk-6ST4QV7T.js.map} +0 -0
  60. /package/dist/{chunk-J3ZCVE67.js.map → chunk-F7A3QXCT.js.map} +0 -0
  61. /package/dist/{chunk-M3ZTG4P5.js.map → chunk-HMEHYSTS.js.map} +0 -0
  62. /package/dist/{chunk-4YRYR32D.js.map → chunk-LQZRGBN5.js.map} +0 -0
  63. /package/dist/{chunk-ZIL2IY4C.js.map → chunk-MP3QNDXQ.js.map} +0 -0
  64. /package/dist/{chunk-FFNGE5RR.js.map → chunk-VMK2G6QR.js.map} +0 -0
  65. /package/dist/{chunk-KBHGPQZ2.js.map → chunk-XMD5OYD6.js.map} +0 -0
  66. /package/dist/{chunk-V75ZB4G4.js.map → chunk-ZIYT2Y4B.js.map} +0 -0
  67. /package/dist/{source-map-uploader-K67LTPBG.js.map → source-map-uploader-NUONOEJG.js.map} +0 -0
package/README.md CHANGED
@@ -522,27 +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`, `recipientClass`, `participantCount`,
530
- `activeParticipantCount`. Each value is bounded to compact tokens
531
- IANA timezones, BCP-47 locales, identifier-shaped enum tokens, or
532
- non-negative integer strings for the count fields. The per-span
533
- operation budget is five.
534
-
535
- `recipientClass`, `participantCount`, and `activeParticipantCount`
536
- let you record concise causal evidence about which recipient class
537
- was targeted and how many domain entities were included. The two
538
- count fields validate strictly as non-negative integer strings —
539
- `"0"`, `"1"`, `"12"` are accepted; `"-1"`, `"1.5"`, `"many"`, or
540
- any value with a non-digit character is rejected and counted under
541
- the `raw_payload` omission reason. `recipientClass` uses the
542
- identifier-shaped compact-token validator and preserves case
543
- verbatim, so normalize labels at the call site —
544
- `recipientClass="removed-participant"` (lowercase-kebab) is the
545
- recommended convention.
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`.
546
574
 
547
575
  What the SDK does not capture: recipient email addresses, sender or
548
576
  recipient names, rendered email subjects or bodies, calendar links,
@@ -574,13 +602,20 @@ recordSideEffect({
574
602
  status: "succeeded",
575
603
  phase: "request",
576
604
  fields: {
605
+ // Stable core
577
606
  templateKey: "EventCanceledEmail",
578
607
  role: "invitee",
579
608
  locale: "en-US",
580
609
  timezone: "Europe/Paris",
610
+ // Pattern: *Class
581
611
  recipientClass: "removed-participant",
612
+ // Pattern: *Count (non-negative integer string)
582
613
  participantCount: "2",
583
614
  activeParticipantCount: "1",
615
+ // Pattern: *Kind
616
+ notificationKind: "transactional",
617
+ // Pattern: *Role
618
+ actorRole: "system-bot",
584
619
  },
585
620
  });
586
621
  ```