@glasstrace/sdk 1.2.0 → 1.3.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 (43) hide show
  1. package/README.md +47 -0
  2. package/dist/{chunk-JKI4OCFV.js → chunk-A63WX7NR.js} +3 -3
  3. package/dist/{chunk-6RNBUUBR.js → chunk-AGCYKZFY.js} +2 -2
  4. package/dist/{chunk-4EZ6JTDG.js → chunk-AKZGMT33.js} +2 -2
  5. package/dist/{chunk-TWTWRJ25.js → chunk-AYUL5QMZ.js} +2 -2
  6. package/dist/{chunk-DST4UBXU.js → chunk-FMEWG3FY.js} +2 -2
  7. package/dist/{chunk-TWHCJKRS.js → chunk-FVHVDBGX.js} +3 -3
  8. package/dist/{chunk-X5MAXP5T.js → chunk-GTPTKN5A.js} +6 -3
  9. package/dist/{chunk-X5MAXP5T.js.map → chunk-GTPTKN5A.js.map} +1 -1
  10. package/dist/{chunk-6RIH6SFM.js → chunk-JMYKR5Z3.js} +89 -17
  11. package/dist/chunk-JMYKR5Z3.js.map +1 -0
  12. package/dist/cli/init.cjs +5 -3
  13. package/dist/cli/init.cjs.map +1 -1
  14. package/dist/cli/init.js +6 -6
  15. package/dist/cli/mcp-add.cjs +4 -2
  16. package/dist/cli/mcp-add.cjs.map +1 -1
  17. package/dist/cli/mcp-add.js +2 -2
  18. package/dist/cli/uninit.js +3 -3
  19. package/dist/cli/validate.cjs +4 -2
  20. package/dist/cli/validate.cjs.map +1 -1
  21. package/dist/cli/validate.js +2 -2
  22. package/dist/edge-entry.cjs +5 -2
  23. package/dist/edge-entry.cjs.map +1 -1
  24. package/dist/edge-entry.js +2 -2
  25. package/dist/index.cjs +92 -14
  26. package/dist/index.cjs.map +1 -1
  27. package/dist/index.js +5 -5
  28. package/dist/node-entry.cjs +92 -14
  29. package/dist/node-entry.cjs.map +1 -1
  30. package/dist/node-entry.js +7 -7
  31. package/dist/node-subpath.cjs +4 -2
  32. package/dist/node-subpath.cjs.map +1 -1
  33. package/dist/node-subpath.js +3 -3
  34. package/dist/{source-map-uploader-DPUUCLNW.js → source-map-uploader-M2P5CDOB.js} +3 -3
  35. package/package.json +1 -1
  36. package/dist/chunk-6RIH6SFM.js.map +0 -1
  37. /package/dist/{chunk-JKI4OCFV.js.map → chunk-A63WX7NR.js.map} +0 -0
  38. /package/dist/{chunk-6RNBUUBR.js.map → chunk-AGCYKZFY.js.map} +0 -0
  39. /package/dist/{chunk-4EZ6JTDG.js.map → chunk-AKZGMT33.js.map} +0 -0
  40. /package/dist/{chunk-TWTWRJ25.js.map → chunk-AYUL5QMZ.js.map} +0 -0
  41. /package/dist/{chunk-DST4UBXU.js.map → chunk-FMEWG3FY.js.map} +0 -0
  42. /package/dist/{chunk-TWHCJKRS.js.map → chunk-FVHVDBGX.js.map} +0 -0
  43. /package/dist/{source-map-uploader-DPUUCLNW.js.map → source-map-uploader-M2P5CDOB.js.map} +0 -0
package/README.md CHANGED
@@ -199,6 +199,53 @@ body data. If your account enables the flag but a span never carries
199
199
  the internal attribute (no adapter set it), the public attribute is
200
200
  still absent. The default is "off, twice".
201
201
 
202
+ ## Source maps
203
+
204
+ Glasstrace uploads server-side source maps at build time and resolves
205
+ compiled-output stack frames back to original source on the dashboard
206
+ and in agent prompts. Three span attributes connect the runtime trace
207
+ to the build-time manifest:
208
+
209
+ | Attribute | When stamped | Source |
210
+ |---|---|---|
211
+ | `glasstrace.build.hash` | every server span | `process.env.GLASSTRACE_BUILD_HASH` (read once at module load) |
212
+ | `glasstrace.source.file` | error spans only | top user-attributable frame of `Error.stack` |
213
+ | `glasstrace.source.line` | error spans only | top user-attributable frame of `Error.stack` |
214
+
215
+ The build hash links a runtime span to the source maps uploaded
216
+ during the same build. Set the env var in your deploy step:
217
+
218
+ ```bash
219
+ # Vercel / GitHub Actions / any CI
220
+ GLASSTRACE_BUILD_HASH=$(git rev-parse HEAD) npm run start
221
+ ```
222
+
223
+ The Glasstrace `next.config.ts` wrapper (`withGlasstraceConfig`) and
224
+ the `@glasstrace/sdk/node` upload helpers compute the same hash via
225
+ `computeBuildHash()` (preferring `git rev-parse HEAD`, falling back
226
+ to a deterministic content hash). When the runtime env var is unset,
227
+ the SDK silently omits the attribute — no crash, no diagnostic — so
228
+ projects that have not adopted the convention behave exactly as
229
+ before; their stored traces simply do not render mapped frames in
230
+ the dashboard.
231
+
232
+ The error-source attributes are stamped only by the manual
233
+ `captureError()` API, on the `glasstrace.error` span event. They
234
+ report the compiled-output `file:line` from the top user-attributable
235
+ frame; ingestion's resolver then maps that pair back to original
236
+ source via the uploaded source map manifest. The SDK skips frames
237
+ inside Node's built-in modules (`node:internal/*`, `node:fs`, etc.)
238
+ and inside its own `node_modules/@glasstrace/sdk/` closure, so the
239
+ reported frame is always the caller of `captureError()`. If
240
+ `Error.stack` is absent, malformed, or contains only internal frames,
241
+ the attributes are silently omitted and only the existing
242
+ `error.message` / `error.type` / `error.stack` event attributes are
243
+ recorded.
244
+
245
+ These attributes are additive: any consumer that does not understand
246
+ them ignores them. Existing trace pipelines and dashboards continue
247
+ to work unchanged.
248
+
202
249
  ## Browser-extension discovery
203
250
 
204
251
  `glasstrace init` writes a small static file at
@@ -2,12 +2,12 @@ import {
2
2
  atomicWriteFile,
3
3
  refreshGenericMcpConfigAtRuntime,
4
4
  resolveEffectiveMcpCredential
5
- } from "./chunk-TWTWRJ25.js";
5
+ } from "./chunk-AYUL5QMZ.js";
6
6
  import {
7
7
  DEFAULT_CAPTURE_CONFIG,
8
8
  SdkCachedConfigSchema,
9
9
  SdkInitResponseSchema
10
- } from "./chunk-X5MAXP5T.js";
10
+ } from "./chunk-GTPTKN5A.js";
11
11
  import {
12
12
  __require
13
13
  } from "./chunk-NSBPE2FW.js";
@@ -692,4 +692,4 @@ export {
692
692
  didLastInitSucceed,
693
693
  verifyInitReachable
694
694
  };
695
- //# sourceMappingURL=chunk-JKI4OCFV.js.map
695
+ //# sourceMappingURL=chunk-A63WX7NR.js.map
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-DQ25VOKK.js";
4
4
  import {
5
5
  GLASSTRACE_ATTRIBUTE_NAMES
6
- } from "./chunk-X5MAXP5T.js";
6
+ } from "./chunk-GTPTKN5A.js";
7
7
 
8
8
  // src/errors.ts
9
9
  var SdkError = class extends Error {
@@ -102,4 +102,4 @@ export {
102
102
  GlasstraceSpanProcessor,
103
103
  captureCorrelationId
104
104
  };
105
- //# sourceMappingURL=chunk-6RNBUUBR.js.map
105
+ //# sourceMappingURL=chunk-AGCYKZFY.js.map
@@ -5,7 +5,7 @@ import {
5
5
  PresignedUploadResponseSchema,
6
6
  SourceMapManifestResponseSchema,
7
7
  SourceMapUploadResponseSchema
8
- } from "./chunk-X5MAXP5T.js";
8
+ } from "./chunk-GTPTKN5A.js";
9
9
 
10
10
  // src/source-map-uploader.ts
11
11
  import * as fs from "node:fs/promises";
@@ -331,4 +331,4 @@ export {
331
331
  uploadSourceMapsPresigned,
332
332
  uploadSourceMapsAuto
333
333
  };
334
- //# sourceMappingURL=chunk-4EZ6JTDG.js.map
334
+ //# sourceMappingURL=chunk-AKZGMT33.js.map
@@ -2,7 +2,7 @@ import {
2
2
  AnonApiKeySchema,
3
3
  DevApiKeySchema,
4
4
  createAnonApiKey
5
- } from "./chunk-X5MAXP5T.js";
5
+ } from "./chunk-GTPTKN5A.js";
6
6
  import {
7
7
  __require
8
8
  } from "./chunk-NSBPE2FW.js";
@@ -605,4 +605,4 @@ export {
605
605
  writeMcpMarker,
606
606
  refreshGenericMcpConfigAtRuntime
607
607
  };
608
- //# sourceMappingURL=chunk-TWTWRJ25.js.map
608
+ //# sourceMappingURL=chunk-AYUL5QMZ.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createBuildHash
3
- } from "./chunk-X5MAXP5T.js";
3
+ } from "./chunk-GTPTKN5A.js";
4
4
 
5
5
  // src/import-graph.ts
6
6
  import * as fs from "node:fs/promises";
@@ -175,4 +175,4 @@ export {
175
175
  extractImports,
176
176
  buildImportGraph
177
177
  };
178
- //# sourceMappingURL=chunk-DST4UBXU.js.map
178
+ //# sourceMappingURL=chunk-FMEWG3FY.js.map
@@ -5,10 +5,10 @@ import {
5
5
  isDevApiKey,
6
6
  readEnvLocalApiKey,
7
7
  writeAndFsyncTempSync
8
- } from "./chunk-TWTWRJ25.js";
8
+ } from "./chunk-AYUL5QMZ.js";
9
9
  import {
10
10
  AnonApiKeySchema
11
- } from "./chunk-X5MAXP5T.js";
11
+ } from "./chunk-GTPTKN5A.js";
12
12
  import {
13
13
  NEXT_CONFIG_NAMES
14
14
  } from "./chunk-NB7GJE4S.js";
@@ -914,4 +914,4 @@ export {
914
914
  writeShutdownMarker,
915
915
  runUninit
916
916
  };
917
- //# sourceMappingURL=chunk-TWHCJKRS.js.map
917
+ //# sourceMappingURL=chunk-FVHVDBGX.js.map
@@ -13878,13 +13878,15 @@ var PresignedUploadRequestSchema = external_exports.object({
13878
13878
  });
13879
13879
  var PresignedUploadResponseSchema = external_exports.object({
13880
13880
  uploadId: external_exports.string().uuid(),
13881
- expiresAt: external_exports.number().int().positive(),
13881
+ expiresAt: external_exports.number().int().nonnegative(),
13882
13882
  files: external_exports.array(
13883
13883
  external_exports.object({
13884
13884
  filePath: external_exports.string().min(1),
13885
13885
  clientToken: external_exports.string().min(1),
13886
13886
  pathname: external_exports.string().min(1),
13887
- maxBytes: external_exports.number().int().positive()
13887
+ maxBytes: external_exports.number().int().positive(),
13888
+ /** Vercel Blob access mode — explicit in the contract per DISC-756. */
13889
+ access: external_exports.enum(["public"])
13888
13890
  })
13889
13891
  ).min(1).max(100)
13890
13892
  });
@@ -13930,6 +13932,7 @@ var GLASSTRACE_ATTRIBUTE_NAMES = {
13930
13932
  FETCH_DURATION_MS: "glasstrace.fetch.duration_ms",
13931
13933
  FETCH_TARGET: "glasstrace.fetch.target",
13932
13934
  ENV_REFERENCED: "glasstrace.env.referenced",
13935
+ BUILD_HASH: "glasstrace.build.hash",
13933
13936
  SOURCE_FILE: "glasstrace.source.file",
13934
13937
  SOURCE_LINE: "glasstrace.source.line",
13935
13938
  SOURCE_MAPPED: "glasstrace.source.mapped",
@@ -14111,4 +14114,4 @@ export {
14111
14114
  DEFAULT_CAPTURE_CONFIG,
14112
14115
  deriveSessionId
14113
14116
  };
14114
- //# sourceMappingURL=chunk-X5MAXP5T.js.map
14117
+ //# sourceMappingURL=chunk-GTPTKN5A.js.map