@glasstrace/sdk 1.9.1 → 1.10.1

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 (68) 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-QEXRCXSY.js → chunk-OXM2BZMF.js} +2 -2
  12. package/dist/{chunk-M6EWJCAT.js → chunk-QVTONMVZ.js} +2 -2
  13. package/dist/{chunk-DKV53A2C.js → chunk-RL43PU2X.js} +2 -2
  14. package/dist/{chunk-KI7YJ7XD.js → chunk-TJ46YOGJ.js} +42 -22
  15. package/dist/chunk-TJ46YOGJ.js.map +1 -0
  16. package/dist/{chunk-GWIEUBFR.js → chunk-UMGZJYC4.js} +3 -3
  17. package/dist/{chunk-2F2MGFLO.js → chunk-WQF7ZQOM.js} +39 -405
  18. package/dist/chunk-WQF7ZQOM.js.map +1 -0
  19. package/dist/{chunk-QXITSNYM.js → chunk-XG6WR2KS.js} +3 -3
  20. package/dist/cli/init.cjs +51 -25
  21. package/dist/cli/init.cjs.map +1 -1
  22. package/dist/cli/init.js +8 -8
  23. package/dist/cli/init.js.map +1 -1
  24. package/dist/cli/mcp-add.cjs +42 -22
  25. package/dist/cli/mcp-add.cjs.map +1 -1
  26. package/dist/cli/mcp-add.js +4 -4
  27. package/dist/cli/mcp-add.js.map +1 -1
  28. package/dist/cli/uninit.js +3 -3
  29. package/dist/cli/upgrade-instructions.cjs +39 -21
  30. package/dist/cli/upgrade-instructions.cjs.map +1 -1
  31. package/dist/cli/upgrade-instructions.js +4 -4
  32. package/dist/cli/upgrade-instructions.js.map +1 -1
  33. package/dist/cli/validate.cjs.map +1 -1
  34. package/dist/cli/validate.js +2 -2
  35. package/dist/edge-entry.cjs +44 -0
  36. package/dist/edge-entry.cjs.map +1 -1
  37. package/dist/edge-entry.js +4 -4
  38. package/dist/index.cjs +58 -5
  39. package/dist/index.cjs.map +1 -1
  40. package/dist/index.js +10 -8
  41. package/dist/index.js.map +1 -1
  42. package/dist/middleware/index.cjs +44 -0
  43. package/dist/middleware/index.cjs.map +1 -1
  44. package/dist/middleware/index.js +2 -2
  45. package/dist/node-entry.cjs +58 -5
  46. package/dist/node-entry.cjs.map +1 -1
  47. package/dist/node-entry.js +12 -10
  48. package/dist/node-subpath.cjs.map +1 -1
  49. package/dist/node-subpath.js +3 -3
  50. package/dist/{source-map-uploader-MMJ2WCL4.js → source-map-uploader-CLYCE2TZ.js} +3 -3
  51. package/dist/trpc/index.cjs +15164 -503
  52. package/dist/trpc/index.cjs.map +1 -1
  53. package/dist/trpc/index.d.cts +62 -1
  54. package/dist/trpc/index.d.ts +62 -1
  55. package/dist/trpc/index.js +200 -1
  56. package/dist/trpc/index.js.map +1 -1
  57. package/package.json +1 -1
  58. package/dist/chunk-2F2MGFLO.js.map +0 -1
  59. package/dist/chunk-KI7YJ7XD.js.map +0 -1
  60. /package/dist/{chunk-HD6JIFKN.js.map → chunk-BSVWJSVX.js.map} +0 -0
  61. /package/dist/{chunk-QOHKZOKB.js.map → chunk-D54FMQHF.js.map} +0 -0
  62. /package/dist/{chunk-H6WJ63X2.js.map → chunk-M5GO2SSO.js.map} +0 -0
  63. /package/dist/{chunk-QEXRCXSY.js.map → chunk-OXM2BZMF.js.map} +0 -0
  64. /package/dist/{chunk-M6EWJCAT.js.map → chunk-QVTONMVZ.js.map} +0 -0
  65. /package/dist/{chunk-DKV53A2C.js.map → chunk-RL43PU2X.js.map} +0 -0
  66. /package/dist/{chunk-GWIEUBFR.js.map → chunk-UMGZJYC4.js.map} +0 -0
  67. /package/dist/{chunk-QXITSNYM.js.map → chunk-XG6WR2KS.js.map} +0 -0
  68. /package/dist/{source-map-uploader-MMJ2WCL4.js.map → source-map-uploader-CLYCE2TZ.js.map} +0 -0
@@ -1,17 +1,17 @@
1
1
  import {
2
2
  tracedRequestMiddleware
3
- } from "./chunk-QOHKZOKB.js";
3
+ } from "./chunk-D54FMQHF.js";
4
4
  import {
5
5
  withAsyncCausality
6
- } from "./chunk-QEXRCXSY.js";
6
+ } from "./chunk-OXM2BZMF.js";
7
7
  import {
8
8
  GlasstraceSpanProcessor,
9
9
  SdkError,
10
10
  captureCorrelationId
11
- } from "./chunk-H6WJ63X2.js";
11
+ } from "./chunk-M5GO2SSO.js";
12
12
  import "./chunk-CL3OVHPO.js";
13
13
  import "./chunk-DQ25VOKK.js";
14
- import "./chunk-JHUNLPSS.js";
14
+ import "./chunk-6RKS3DNA.js";
15
15
  import "./chunk-NSBPE2FW.js";
16
16
  export {
17
17
  GlasstraceSpanProcessor,
package/dist/index.cjs CHANGED
@@ -14635,6 +14635,21 @@ var init_dist = __esm({
14635
14635
  HTTP_METHOD: "glasstrace.http.method",
14636
14636
  HTTP_STATUS_CODE: "glasstrace.http.status_code",
14637
14637
  HTTP_DURATION_MS: "glasstrace.http.duration_ms",
14638
+ /**
14639
+ * Boolean audit attribute set to `true` only when the SDK's
14640
+ * boundary-masked-error heuristic at `enriching-exporter.ts`
14641
+ * fires (SDK-051 / DISC-1125 — same-span scope; descendant-traversal
14642
+ * scope is tracked in a follow-up DISC).
14643
+ *
14644
+ * Strict additivity: backend ingestion ignores unknown attributes
14645
+ * today; this attribute is for audit/observability. Downstream
14646
+ * tooling MAY surface heuristic activation rates by querying for
14647
+ * spans with this attribute set; the backend's status-handling
14648
+ * pipeline does NOT depend on it.
14649
+ *
14650
+ * Absent on spans where the heuristic did not fire.
14651
+ */
14652
+ HTTP_BOUNDARY_MASKED: "glasstrace.http.boundary_masked",
14638
14653
  ERROR_MESSAGE: "glasstrace.error.message",
14639
14654
  ERROR_CODE: "glasstrace.error.code",
14640
14655
  ERROR_CATEGORY: "glasstrace.error.category",
@@ -14674,6 +14689,35 @@ var init_dist = __esm({
14674
14689
  SOURCE_LINE: "glasstrace.source.line",
14675
14690
  SOURCE_MAPPED: "glasstrace.source.mapped",
14676
14691
  TRPC_PROCEDURE: "glasstrace.trpc.procedure",
14692
+ /**
14693
+ * Zero-based positional index of the current member within a tRPC
14694
+ * HTTP-batch dispatch (SDK-052 / DISC-1534 SDK-side slice). Set on
14695
+ * member spans by `tracedMiddleware` when the SDK's
14696
+ * `wrapBatchedHttpHandler` envelope is in scope. Numeric.
14697
+ *
14698
+ * Load-bearing for batches that include the same procedure name
14699
+ * more than once — name-only matching cannot disambiguate, so the
14700
+ * positional index is the canonical disambiguator. Absent on
14701
+ * non-batched spans and on apps not using `wrapBatchedHttpHandler`.
14702
+ */
14703
+ TRPC_BATCH_MEMBER_INDEX: "glasstrace.trpc.batch.member_index",
14704
+ /**
14705
+ * Ordered list of all procedure names in the current tRPC HTTP
14706
+ * batch (SDK-052 / DISC-1534 SDK-side slice). Stored as an OTel
14707
+ * typed string array (`string[]`), NOT a JSON-encoded string —
14708
+ * the typed-array form preserves first-class queryability in the
14709
+ * OTel ingest pipeline.
14710
+ *
14711
+ * Set on each member span that `tracedMiddleware` produces when a
14712
+ * `wrapBatchedHttpHandler` envelope is in scope. Absent on
14713
+ * non-batched spans, on the root HTTP server span (today's
14714
+ * release ships strict-additive scope only — per-root-span
14715
+ * attribution is deferred to a follow-up wave because changing
14716
+ * the root span's existing `glasstrace.trpc.procedure` shape from
14717
+ * comma-joined to first-member representative is non-additive),
14718
+ * and on apps not using `wrapBatchedHttpHandler`.
14719
+ */
14720
+ TRPC_BATCH_MEMBER_PROCEDURES: "glasstrace.trpc.batch.member_procedures",
14677
14721
  ERROR_RESPONSE_BODY: "glasstrace.error.response_body",
14678
14722
  NEXT_ACTION_DETECTED: "glasstrace.next.action.detected",
14679
14723
  // Client-side attributes
@@ -19568,6 +19612,15 @@ var GlasstraceExporter = class {
19568
19612
  } else {
19569
19613
  extra[ATTR.HTTP_STATUS_CODE] = 500;
19570
19614
  }
19615
+ extra[ATTR.HTTP_BOUNDARY_MASKED] = true;
19616
+ const inferredStatus = extra[ATTR.HTTP_STATUS_CODE];
19617
+ const eventDetails2 = getExceptionEventDetails(span);
19618
+ const exceptionMessage = eventDetails2.message ?? (typeof attrs["exception.message"] === "string" ? attrs["exception.message"] : void 0);
19619
+ emitLifecycleEvent("core:error_boundary_detected", {
19620
+ spanId: span.spanContext().spanId,
19621
+ inferredStatus,
19622
+ ...exceptionMessage !== void 0 ? { exceptionMessage: exceptionMessage.slice(0, 256) } : {}
19623
+ });
19571
19624
  if (this.verbose) {
19572
19625
  sdkLog(
19573
19626
  "info",
@@ -23523,11 +23576,11 @@ function registerGlasstrace(options) {
23523
23576
  setCoreState(CoreState.REGISTERING);
23524
23577
  maybeWarnStaleAgentInstructions({
23525
23578
  projectRoot: process.cwd(),
23526
- sdkVersion: "1.9.1"
23579
+ sdkVersion: "1.10.1"
23527
23580
  });
23528
23581
  startRuntimeStateWriter({
23529
23582
  projectRoot: process.cwd(),
23530
- sdkVersion: "1.9.1"
23583
+ sdkVersion: "1.10.1"
23531
23584
  });
23532
23585
  const config2 = resolveConfig(options);
23533
23586
  if (config2.verbose) {
@@ -23694,8 +23747,8 @@ async function backgroundInit(config2, anonKeyForInit, generation) {
23694
23747
  if (config2.verbose) {
23695
23748
  console.info("[glasstrace] Background init firing.");
23696
23749
  }
23697
- const healthReport = collectHealthReport("1.9.1");
23698
- const initResult = await performInit(config2, anonKeyForInit, "1.9.1", healthReport);
23750
+ const healthReport = collectHealthReport("1.10.1");
23751
+ const initResult = await performInit(config2, anonKeyForInit, "1.10.1", healthReport);
23699
23752
  if (generation !== registrationGeneration) return;
23700
23753
  const currentState = getCoreState();
23701
23754
  if (currentState === CoreState.SHUTTING_DOWN || currentState === CoreState.SHUTDOWN) {
@@ -23718,7 +23771,7 @@ async function backgroundInit(config2, anonKeyForInit, generation) {
23718
23771
  }
23719
23772
  maybeInstallConsoleCapture();
23720
23773
  if (didLastInitSucceed()) {
23721
- startHeartbeat(config2, anonKeyForInit, "1.9.1", generation, (newApiKey, accountId) => {
23774
+ startHeartbeat(config2, anonKeyForInit, "1.10.1", generation, (newApiKey, accountId) => {
23722
23775
  setAuthState(AuthState.CLAIMING);
23723
23776
  emitLifecycleEvent("auth:claim_started", { accountId });
23724
23777
  setResolvedApiKey(newApiKey);