@glasstrace/sdk 1.9.1 → 1.10.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 (65) hide show
  1. package/dist/async-context/index.cjs +44 -0
  2. package/dist/async-context/index.cjs.map +1 -1
  3. package/dist/async-context/index.js +2 -2
  4. package/dist/{chunk-JHUNLPSS.js → chunk-6RKS3DNA.js} +45 -1
  5. package/dist/{chunk-JHUNLPSS.js.map → chunk-6RKS3DNA.js.map} +1 -1
  6. package/dist/{chunk-HD6JIFKN.js → chunk-BSVWJSVX.js} +2 -2
  7. package/dist/{chunk-QOHKZOKB.js → chunk-D54FMQHF.js} +2 -2
  8. package/dist/chunk-I2DVVSKW.js +419 -0
  9. package/dist/chunk-I2DVVSKW.js.map +1 -0
  10. package/dist/{chunk-H6WJ63X2.js → chunk-M5GO2SSO.js} +2 -2
  11. package/dist/{chunk-2F2MGFLO.js → chunk-OXA4IHQX.js} +39 -405
  12. package/dist/chunk-OXA4IHQX.js.map +1 -0
  13. package/dist/{chunk-QEXRCXSY.js → chunk-OXM2BZMF.js} +2 -2
  14. package/dist/{chunk-M6EWJCAT.js → chunk-QVTONMVZ.js} +2 -2
  15. package/dist/{chunk-DKV53A2C.js → chunk-RL43PU2X.js} +2 -2
  16. package/dist/{chunk-GWIEUBFR.js → chunk-UMGZJYC4.js} +3 -3
  17. package/dist/{chunk-QXITSNYM.js → chunk-XG6WR2KS.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/init.js.map +1 -1
  22. package/dist/cli/mcp-add.cjs +1 -1
  23. package/dist/cli/mcp-add.cjs.map +1 -1
  24. package/dist/cli/mcp-add.js +3 -3
  25. package/dist/cli/mcp-add.js.map +1 -1
  26. package/dist/cli/uninit.js +3 -3
  27. package/dist/cli/upgrade-instructions.cjs +1 -1
  28. package/dist/cli/upgrade-instructions.cjs.map +1 -1
  29. package/dist/cli/upgrade-instructions.js +3 -3
  30. package/dist/cli/upgrade-instructions.js.map +1 -1
  31. package/dist/cli/validate.cjs.map +1 -1
  32. package/dist/cli/validate.js +2 -2
  33. package/dist/edge-entry.cjs +44 -0
  34. package/dist/edge-entry.cjs.map +1 -1
  35. package/dist/edge-entry.js +4 -4
  36. package/dist/index.cjs +58 -5
  37. package/dist/index.cjs.map +1 -1
  38. package/dist/index.js +10 -8
  39. package/dist/index.js.map +1 -1
  40. package/dist/middleware/index.cjs +44 -0
  41. package/dist/middleware/index.cjs.map +1 -1
  42. package/dist/middleware/index.js +2 -2
  43. package/dist/node-entry.cjs +58 -5
  44. package/dist/node-entry.cjs.map +1 -1
  45. package/dist/node-entry.js +12 -10
  46. package/dist/node-subpath.cjs.map +1 -1
  47. package/dist/node-subpath.js +3 -3
  48. package/dist/{source-map-uploader-MMJ2WCL4.js → source-map-uploader-CLYCE2TZ.js} +3 -3
  49. package/dist/trpc/index.cjs +15164 -503
  50. package/dist/trpc/index.cjs.map +1 -1
  51. package/dist/trpc/index.d.cts +62 -1
  52. package/dist/trpc/index.d.ts +62 -1
  53. package/dist/trpc/index.js +200 -1
  54. package/dist/trpc/index.js.map +1 -1
  55. package/package.json +1 -1
  56. package/dist/chunk-2F2MGFLO.js.map +0 -1
  57. /package/dist/{chunk-HD6JIFKN.js.map → chunk-BSVWJSVX.js.map} +0 -0
  58. /package/dist/{chunk-QOHKZOKB.js.map → chunk-D54FMQHF.js.map} +0 -0
  59. /package/dist/{chunk-H6WJ63X2.js.map → chunk-M5GO2SSO.js.map} +0 -0
  60. /package/dist/{chunk-QEXRCXSY.js.map → chunk-OXM2BZMF.js.map} +0 -0
  61. /package/dist/{chunk-M6EWJCAT.js.map → chunk-QVTONMVZ.js.map} +0 -0
  62. /package/dist/{chunk-DKV53A2C.js.map → chunk-RL43PU2X.js.map} +0 -0
  63. /package/dist/{chunk-GWIEUBFR.js.map → chunk-UMGZJYC4.js.map} +0 -0
  64. /package/dist/{chunk-QXITSNYM.js.map → chunk-XG6WR2KS.js.map} +0 -0
  65. /package/dist/{source-map-uploader-MMJ2WCL4.js.map → source-map-uploader-CLYCE2TZ.js.map} +0 -0
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  _resetForTesting,
3
3
  tracedRequestMiddleware
4
- } from "../chunk-QOHKZOKB.js";
4
+ } from "../chunk-D54FMQHF.js";
5
5
  import "../chunk-CL3OVHPO.js";
6
6
  import "../chunk-DQ25VOKK.js";
7
- import "../chunk-JHUNLPSS.js";
7
+ import "../chunk-6RKS3DNA.js";
8
8
  import "../chunk-NSBPE2FW.js";
9
9
  export {
10
10
  _resetForTesting,
@@ -14638,6 +14638,21 @@ var init_dist = __esm({
14638
14638
  HTTP_METHOD: "glasstrace.http.method",
14639
14639
  HTTP_STATUS_CODE: "glasstrace.http.status_code",
14640
14640
  HTTP_DURATION_MS: "glasstrace.http.duration_ms",
14641
+ /**
14642
+ * Boolean audit attribute set to `true` only when the SDK's
14643
+ * boundary-masked-error heuristic at `enriching-exporter.ts`
14644
+ * fires (SDK-051 / DISC-1125 — same-span scope; descendant-traversal
14645
+ * scope is tracked in a follow-up DISC).
14646
+ *
14647
+ * Strict additivity: backend ingestion ignores unknown attributes
14648
+ * today; this attribute is for audit/observability. Downstream
14649
+ * tooling MAY surface heuristic activation rates by querying for
14650
+ * spans with this attribute set; the backend's status-handling
14651
+ * pipeline does NOT depend on it.
14652
+ *
14653
+ * Absent on spans where the heuristic did not fire.
14654
+ */
14655
+ HTTP_BOUNDARY_MASKED: "glasstrace.http.boundary_masked",
14641
14656
  ERROR_MESSAGE: "glasstrace.error.message",
14642
14657
  ERROR_CODE: "glasstrace.error.code",
14643
14658
  ERROR_CATEGORY: "glasstrace.error.category",
@@ -14677,6 +14692,35 @@ var init_dist = __esm({
14677
14692
  SOURCE_LINE: "glasstrace.source.line",
14678
14693
  SOURCE_MAPPED: "glasstrace.source.mapped",
14679
14694
  TRPC_PROCEDURE: "glasstrace.trpc.procedure",
14695
+ /**
14696
+ * Zero-based positional index of the current member within a tRPC
14697
+ * HTTP-batch dispatch (SDK-052 / DISC-1534 SDK-side slice). Set on
14698
+ * member spans by `tracedMiddleware` when the SDK's
14699
+ * `wrapBatchedHttpHandler` envelope is in scope. Numeric.
14700
+ *
14701
+ * Load-bearing for batches that include the same procedure name
14702
+ * more than once — name-only matching cannot disambiguate, so the
14703
+ * positional index is the canonical disambiguator. Absent on
14704
+ * non-batched spans and on apps not using `wrapBatchedHttpHandler`.
14705
+ */
14706
+ TRPC_BATCH_MEMBER_INDEX: "glasstrace.trpc.batch.member_index",
14707
+ /**
14708
+ * Ordered list of all procedure names in the current tRPC HTTP
14709
+ * batch (SDK-052 / DISC-1534 SDK-side slice). Stored as an OTel
14710
+ * typed string array (`string[]`), NOT a JSON-encoded string —
14711
+ * the typed-array form preserves first-class queryability in the
14712
+ * OTel ingest pipeline.
14713
+ *
14714
+ * Set on each member span that `tracedMiddleware` produces when a
14715
+ * `wrapBatchedHttpHandler` envelope is in scope. Absent on
14716
+ * non-batched spans, on the root HTTP server span (today's
14717
+ * release ships strict-additive scope only — per-root-span
14718
+ * attribution is deferred to a follow-up wave because changing
14719
+ * the root span's existing `glasstrace.trpc.procedure` shape from
14720
+ * comma-joined to first-member representative is non-additive),
14721
+ * and on apps not using `wrapBatchedHttpHandler`.
14722
+ */
14723
+ TRPC_BATCH_MEMBER_PROCEDURES: "glasstrace.trpc.batch.member_procedures",
14680
14724
  ERROR_RESPONSE_BODY: "glasstrace.error.response_body",
14681
14725
  NEXT_ACTION_DETECTED: "glasstrace.next.action.detected",
14682
14726
  // Client-side attributes
@@ -19604,6 +19648,15 @@ var GlasstraceExporter = class {
19604
19648
  } else {
19605
19649
  extra[ATTR2.HTTP_STATUS_CODE] = 500;
19606
19650
  }
19651
+ extra[ATTR2.HTTP_BOUNDARY_MASKED] = true;
19652
+ const inferredStatus = extra[ATTR2.HTTP_STATUS_CODE];
19653
+ const eventDetails2 = getExceptionEventDetails(span);
19654
+ const exceptionMessage = eventDetails2.message ?? (typeof attrs["exception.message"] === "string" ? attrs["exception.message"] : void 0);
19655
+ emitLifecycleEvent("core:error_boundary_detected", {
19656
+ spanId: span.spanContext().spanId,
19657
+ inferredStatus,
19658
+ ...exceptionMessage !== void 0 ? { exceptionMessage: exceptionMessage.slice(0, 256) } : {}
19659
+ });
19607
19660
  if (this.verbose) {
19608
19661
  sdkLog(
19609
19662
  "info",
@@ -23559,11 +23612,11 @@ function registerGlasstrace(options) {
23559
23612
  setCoreState(CoreState.REGISTERING);
23560
23613
  maybeWarnStaleAgentInstructions({
23561
23614
  projectRoot: process.cwd(),
23562
- sdkVersion: "1.9.1"
23615
+ sdkVersion: "1.10.0"
23563
23616
  });
23564
23617
  startRuntimeStateWriter({
23565
23618
  projectRoot: process.cwd(),
23566
- sdkVersion: "1.9.1"
23619
+ sdkVersion: "1.10.0"
23567
23620
  });
23568
23621
  const config2 = resolveConfig(options);
23569
23622
  if (config2.verbose) {
@@ -23730,8 +23783,8 @@ async function backgroundInit(config2, anonKeyForInit, generation) {
23730
23783
  if (config2.verbose) {
23731
23784
  console.info("[glasstrace] Background init firing.");
23732
23785
  }
23733
- const healthReport = collectHealthReport("1.9.1");
23734
- const initResult = await performInit(config2, anonKeyForInit, "1.9.1", healthReport);
23786
+ const healthReport = collectHealthReport("1.10.0");
23787
+ const initResult = await performInit(config2, anonKeyForInit, "1.10.0", healthReport);
23735
23788
  if (generation !== registrationGeneration) return;
23736
23789
  const currentState = getCoreState();
23737
23790
  if (currentState === CoreState.SHUTTING_DOWN || currentState === CoreState.SHUTDOWN) {
@@ -23754,7 +23807,7 @@ async function backgroundInit(config2, anonKeyForInit, generation) {
23754
23807
  }
23755
23808
  maybeInstallConsoleCapture();
23756
23809
  if (didLastInitSucceed()) {
23757
- startHeartbeat(config2, anonKeyForInit, "1.9.1", generation, (newApiKey, accountId) => {
23810
+ startHeartbeat(config2, anonKeyForInit, "1.10.0", generation, (newApiKey, accountId) => {
23758
23811
  setAuthState(AuthState.CLAIMING);
23759
23812
  emitLifecycleEvent("auth:claim_started", { accountId });
23760
23813
  setResolvedApiKey(newApiKey);