@glasstrace/sdk 1.3.2 → 1.3.3

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 (49) hide show
  1. package/README.md +38 -0
  2. package/dist/{chunk-REEU6CNO.js → chunk-3HWBR7XM.js} +3 -3
  3. package/dist/chunk-3HWBR7XM.js.map +1 -0
  4. package/dist/{chunk-XS3BO7RY.js → chunk-BQKPRFLF.js} +3 -3
  5. package/dist/{chunk-GCFOY7T2.js → chunk-E62DL2H4.js} +3 -3
  6. package/dist/{chunk-UFZEISZB.js → chunk-LQKJ27LO.js} +2 -2
  7. package/dist/chunk-LQKJ27LO.js.map +1 -0
  8. package/dist/{chunk-MQHLWSIX.js → chunk-M4ZI7J3N.js} +100 -62
  9. package/dist/{chunk-MQHLWSIX.js.map → chunk-M4ZI7J3N.js.map} +1 -1
  10. package/dist/{chunk-JFR42QG5.js → chunk-QJVAKVQJ.js} +2 -2
  11. package/dist/{chunk-CRM3EYOL.js → chunk-WKOQJCFN.js} +2 -2
  12. package/dist/{chunk-DQGNUENK.js → chunk-XNKG4WNQ.js} +30 -14
  13. package/dist/chunk-XNKG4WNQ.js.map +1 -0
  14. package/dist/{chunk-3TU62WD6.js → chunk-YG3X7TUI.js} +1 -1
  15. package/dist/chunk-YG3X7TUI.js.map +1 -0
  16. package/dist/cli/init.cjs +51 -13
  17. package/dist/cli/init.cjs.map +1 -1
  18. package/dist/cli/init.js +6 -6
  19. package/dist/cli/mcp-add.cjs +49 -11
  20. package/dist/cli/mcp-add.cjs.map +1 -1
  21. package/dist/cli/mcp-add.js +2 -2
  22. package/dist/cli/uninit.cjs.map +1 -1
  23. package/dist/cli/uninit.js +3 -3
  24. package/dist/cli/validate.cjs +49 -11
  25. package/dist/cli/validate.cjs.map +1 -1
  26. package/dist/cli/validate.js +2 -2
  27. package/dist/edge-entry.cjs +88 -50
  28. package/dist/edge-entry.cjs.map +1 -1
  29. package/dist/edge-entry.js +2 -2
  30. package/dist/index.cjs +123 -68
  31. package/dist/index.cjs.map +1 -1
  32. package/dist/index.js +6 -6
  33. package/dist/node-entry.cjs +123 -68
  34. package/dist/node-entry.cjs.map +1 -1
  35. package/dist/node-entry.js +8 -8
  36. package/dist/node-subpath.cjs +49 -11
  37. package/dist/node-subpath.cjs.map +1 -1
  38. package/dist/node-subpath.js +4 -4
  39. package/dist/{source-map-uploader-LACAGKIW.js → source-map-uploader-JAD3XM4F.js} +4 -4
  40. package/package.json +1 -1
  41. package/dist/chunk-3TU62WD6.js.map +0 -1
  42. package/dist/chunk-DQGNUENK.js.map +0 -1
  43. package/dist/chunk-REEU6CNO.js.map +0 -1
  44. package/dist/chunk-UFZEISZB.js.map +0 -1
  45. /package/dist/{chunk-XS3BO7RY.js.map → chunk-BQKPRFLF.js.map} +0 -0
  46. /package/dist/{chunk-GCFOY7T2.js.map → chunk-E62DL2H4.js.map} +0 -0
  47. /package/dist/{chunk-JFR42QG5.js.map → chunk-QJVAKVQJ.js.map} +0 -0
  48. /package/dist/{chunk-CRM3EYOL.js.map → chunk-WKOQJCFN.js.map} +0 -0
  49. /package/dist/{source-map-uploader-LACAGKIW.js.map → source-map-uploader-JAD3XM4F.js.map} +0 -0
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createBuildHash
3
- } from "./chunk-MQHLWSIX.js";
3
+ } from "./chunk-M4ZI7J3N.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-JFR42QG5.js.map
178
+ //# sourceMappingURL=chunk-QJVAKVQJ.js.map
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-DQ25VOKK.js";
4
4
  import {
5
5
  GLASSTRACE_ATTRIBUTE_NAMES
6
- } from "./chunk-MQHLWSIX.js";
6
+ } from "./chunk-M4ZI7J3N.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-CRM3EYOL.js.map
105
+ //# sourceMappingURL=chunk-WKOQJCFN.js.map
@@ -20,7 +20,7 @@ import {
20
20
  maybeShowMcpNudge,
21
21
  maybeShowServerActionNudge,
22
22
  sdkLog
23
- } from "./chunk-3TU62WD6.js";
23
+ } from "./chunk-YG3X7TUI.js";
24
24
  import {
25
25
  _setCurrentConfig,
26
26
  collectHealthReport,
@@ -33,7 +33,7 @@ import {
33
33
  performInit,
34
34
  recordSpansDropped,
35
35
  recordSpansExported
36
- } from "./chunk-REEU6CNO.js";
36
+ } from "./chunk-3HWBR7XM.js";
37
37
  import {
38
38
  isAnonymousMode,
39
39
  isProductionDisabled,
@@ -44,11 +44,11 @@ import {
44
44
  getOrCreateAnonKey,
45
45
  isSyncFsAvailable,
46
46
  readAnonKey
47
- } from "./chunk-UFZEISZB.js";
47
+ } from "./chunk-LQKJ27LO.js";
48
48
  import {
49
49
  GLASSTRACE_ATTRIBUTE_NAMES,
50
50
  deriveSessionId
51
- } from "./chunk-MQHLWSIX.js";
51
+ } from "./chunk-M4ZI7J3N.js";
52
52
  import {
53
53
  __require
54
54
  } from "./chunk-NSBPE2FW.js";
@@ -267,14 +267,30 @@ function prepareErrorResponseBody(body) {
267
267
 
268
268
  // src/build-info.ts
269
269
  var UNSET = "";
270
+ var SHA_SHAPE = /^[0-9a-f]{7,64}$/i;
271
+ function redactBuildHash(value) {
272
+ const sanitize = (s) => s.replace(/[\x00-\x1F\x7F]/g, "?");
273
+ if (value.length <= 12) return sanitize(value.slice(0, 4)) + "...";
274
+ return sanitize(value.slice(0, 8)) + "..." + sanitize(value.slice(-4));
275
+ }
270
276
  function readBuildHashFromEnv() {
271
277
  const raw = process.env.GLASSTRACE_BUILD_HASH;
272
278
  if (typeof raw !== "string") return UNSET;
273
279
  const trimmed = raw.trim();
274
- return trimmed.length > 0 ? trimmed : UNSET;
280
+ if (trimmed.length === 0) return UNSET;
281
+ if (!SHA_SHAPE.test(trimmed)) {
282
+ sdkLog(
283
+ "warn",
284
+ `[glasstrace] warning: GLASSTRACE_BUILD_HASH=${redactBuildHash(trimmed)} does not match expected SHA shape (7-64 hex characters); source-map enrichment may not work as expected.`
285
+ );
286
+ }
287
+ return trimmed;
275
288
  }
276
- var cachedBuildHash = readBuildHashFromEnv();
289
+ var cachedBuildHash = null;
277
290
  function getBuildHash() {
291
+ if (cachedBuildHash === null) {
292
+ cachedBuildHash = readBuildHashFromEnv();
293
+ }
278
294
  return cachedBuildHash === UNSET ? void 0 : cachedBuildHash;
279
295
  }
280
296
 
@@ -4229,7 +4245,7 @@ function registerGlasstrace(options) {
4229
4245
  setCoreState(CoreState.REGISTERING);
4230
4246
  startRuntimeStateWriter({
4231
4247
  projectRoot: process.cwd(),
4232
- sdkVersion: "1.3.2"
4248
+ sdkVersion: "1.3.3"
4233
4249
  });
4234
4250
  const config = resolveConfig(options);
4235
4251
  if (config.verbose) {
@@ -4395,8 +4411,8 @@ async function backgroundInit(config, anonKeyForInit, generation) {
4395
4411
  if (config.verbose) {
4396
4412
  console.info("[glasstrace] Background init firing.");
4397
4413
  }
4398
- const healthReport = collectHealthReport("1.3.2");
4399
- const initResult = await performInit(config, anonKeyForInit, "1.3.2", healthReport);
4414
+ const healthReport = collectHealthReport("1.3.3");
4415
+ const initResult = await performInit(config, anonKeyForInit, "1.3.3", healthReport);
4400
4416
  if (generation !== registrationGeneration) return;
4401
4417
  const currentState = getCoreState();
4402
4418
  if (currentState === CoreState.SHUTTING_DOWN || currentState === CoreState.SHUTDOWN) {
@@ -4419,7 +4435,7 @@ async function backgroundInit(config, anonKeyForInit, generation) {
4419
4435
  }
4420
4436
  maybeInstallConsoleCapture();
4421
4437
  if (didLastInitSucceed()) {
4422
- startHeartbeat(config, anonKeyForInit, "1.3.2", generation, (newApiKey, accountId) => {
4438
+ startHeartbeat(config, anonKeyForInit, "1.3.3", generation, (newApiKey, accountId) => {
4423
4439
  setAuthState(AuthState.CLAIMING);
4424
4440
  emitLifecycleEvent("auth:claim_started", { accountId });
4425
4441
  setResolvedApiKey(newApiKey);
@@ -4714,7 +4730,7 @@ async function handleSourceMapUpload(distDir) {
4714
4730
  );
4715
4731
  return;
4716
4732
  }
4717
- const { discoverSourceMapFiles, computeBuildHash, uploadSourceMaps } = await import("./source-map-uploader-LACAGKIW.js");
4733
+ const { discoverSourceMapFiles, computeBuildHash, uploadSourceMaps } = await import("./source-map-uploader-JAD3XM4F.js");
4718
4734
  const files = await discoverSourceMapFiles(distDir);
4719
4735
  if (files.length === 0) {
4720
4736
  console.info("[glasstrace] No source map files found. Skipping upload.");
@@ -4734,8 +4750,8 @@ async function handleSourceMapUpload(distDir) {
4734
4750
  }
4735
4751
 
4736
4752
  // src/stack-frame.ts
4737
- var PAREN_FRAME = /^\s*at\s+(?:[^()]+\s+)?\(([^()\s]+):(\d+):(\d+)\)\s*$/;
4738
- var BARE_FRAME = /^\s*at\s+(?:async\s+)?([^()\s]+):(\d+):(\d+)\s*$/;
4753
+ var PAREN_FRAME = /^\s*at\s+(?!eval\s+\(eval\s+at\b)(?:[^()]+\s+)?\(([^()\s]+(?:\([A-Za-z0-9_.-]+\)[^()\s]*)*):(\d+):(\d+)\)\s*$/;
4754
+ var BARE_FRAME = /^\s*at\s+(?:async\s+)?([^()\s]+(?:\([A-Za-z0-9_.-]+\)[^()\s]*)*):(\d+):(\d+)\s*$/;
4739
4755
  var INTERNAL_FRAME_PATTERNS = [
4740
4756
  /^node:/,
4741
4757
  /^node:internal\//,
@@ -4817,4 +4833,4 @@ export {
4817
4833
  withGlasstraceConfig,
4818
4834
  captureError
4819
4835
  };
4820
- //# sourceMappingURL=chunk-DQGNUENK.js.map
4836
+ //# sourceMappingURL=chunk-XNKG4WNQ.js.map