@glasstrace/sdk 1.15.0 → 1.16.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 (74) hide show
  1. package/README.md +117 -8
  2. package/dist/async-context/index.cjs +21 -2
  3. package/dist/async-context/index.cjs.map +1 -1
  4. package/dist/async-context/index.js +2 -2
  5. package/dist/{capture-error-03qDnC5v.d.cts → capture-error-B0txjNut.d.cts} +2 -2
  6. package/dist/{capture-error-CAfFUyIU.d.ts → capture-error-Dc01rYNR.d.ts} +2 -2
  7. package/dist/{chunk-F7A3QXCT.js → chunk-774XIOZG.js} +2 -2
  8. package/dist/{chunk-VMK2G6QR.js → chunk-AFTCLH77.js} +2 -2
  9. package/dist/{chunk-XMD5OYD6.js → chunk-BGJKEFBN.js} +2 -2
  10. package/dist/{chunk-LQZRGBN5.js → chunk-DW3CZDS6.js} +2 -2
  11. package/dist/{chunk-PSMSSLQY.js → chunk-EWW3TZ52.js} +123 -12
  12. package/dist/{chunk-PSMSSLQY.js.map → chunk-EWW3TZ52.js.map} +1 -1
  13. package/dist/{chunk-7LE2O4ZJ.js → chunk-GBVMPMVV.js} +54 -5
  14. package/dist/{chunk-7LE2O4ZJ.js.map → chunk-GBVMPMVV.js.map} +1 -1
  15. package/dist/{chunk-HMEHYSTS.js → chunk-KM4UNN3Q.js} +2 -2
  16. package/dist/{chunk-MP3QNDXQ.js → chunk-OHSX224U.js} +2 -2
  17. package/dist/{chunk-6ST4QV7T.js → chunk-T7B752NF.js} +3 -3
  18. package/dist/{chunk-ZIYT2Y4B.js → chunk-WOYJAG7H.js} +3 -3
  19. package/dist/cli/init.cjs +18 -5
  20. package/dist/cli/init.cjs.map +1 -1
  21. package/dist/cli/init.js +7 -7
  22. package/dist/cli/mcp-add.cjs +15 -2
  23. package/dist/cli/mcp-add.cjs.map +1 -1
  24. package/dist/cli/mcp-add.js +3 -3
  25. package/dist/cli/uninit.js +3 -3
  26. package/dist/cli/upgrade-instructions.cjs +1 -1
  27. package/dist/cli/upgrade-instructions.js +3 -3
  28. package/dist/cli/validate.cjs +14 -1
  29. package/dist/cli/validate.cjs.map +1 -1
  30. package/dist/cli/validate.js +2 -2
  31. package/dist/{correlation-id-YcfcqOru.d.ts → correlation-id-B9YYmoZw.d.ts} +1 -1
  32. package/dist/{correlation-id-CZ2bstzA.d.cts → correlation-id-CelUvw7j.d.cts} +1 -1
  33. package/dist/edge-entry.cjs +21 -2
  34. package/dist/edge-entry.cjs.map +1 -1
  35. package/dist/edge-entry.d.cts +2 -2
  36. package/dist/edge-entry.d.ts +2 -2
  37. package/dist/edge-entry.js +4 -4
  38. package/dist/import-graph-DBLGNjcI.d.cts +238 -0
  39. package/dist/import-graph-Dka_Fm7j.d.ts +238 -0
  40. package/dist/index.cjs +165 -12
  41. package/dist/index.cjs.map +1 -1
  42. package/dist/{index.d-BQIJ5Dvc.d.cts → index.d-3-cJoY8y.d.cts} +10 -2
  43. package/dist/{index.d-BQIJ5Dvc.d.ts → index.d-3-cJoY8y.d.ts} +10 -2
  44. package/dist/index.d.cts +28 -4
  45. package/dist/index.d.ts +28 -4
  46. package/dist/index.js +5 -5
  47. package/dist/middleware/index.cjs +21 -2
  48. package/dist/middleware/index.cjs.map +1 -1
  49. package/dist/middleware/index.js +2 -2
  50. package/dist/node-entry.cjs +56 -9
  51. package/dist/node-entry.cjs.map +1 -1
  52. package/dist/node-entry.d.cts +4 -4
  53. package/dist/node-entry.d.ts +4 -4
  54. package/dist/node-entry.js +7 -7
  55. package/dist/node-subpath.cjs +27 -1
  56. package/dist/node-subpath.cjs.map +1 -1
  57. package/dist/node-subpath.d.cts +51 -235
  58. package/dist/node-subpath.d.ts +51 -235
  59. package/dist/node-subpath.js +16 -3
  60. package/dist/node-subpath.js.map +1 -1
  61. package/dist/{source-map-uploader-NUONOEJG.js → source-map-uploader-UJPZCUFN.js} +3 -3
  62. package/dist/trpc/index.cjs +21 -2
  63. package/dist/trpc/index.cjs.map +1 -1
  64. package/dist/trpc/index.js +1 -1
  65. package/package.json +1 -1
  66. /package/dist/{chunk-F7A3QXCT.js.map → chunk-774XIOZG.js.map} +0 -0
  67. /package/dist/{chunk-VMK2G6QR.js.map → chunk-AFTCLH77.js.map} +0 -0
  68. /package/dist/{chunk-XMD5OYD6.js.map → chunk-BGJKEFBN.js.map} +0 -0
  69. /package/dist/{chunk-LQZRGBN5.js.map → chunk-DW3CZDS6.js.map} +0 -0
  70. /package/dist/{chunk-HMEHYSTS.js.map → chunk-KM4UNN3Q.js.map} +0 -0
  71. /package/dist/{chunk-MP3QNDXQ.js.map → chunk-OHSX224U.js.map} +0 -0
  72. /package/dist/{chunk-6ST4QV7T.js.map → chunk-T7B752NF.js.map} +0 -0
  73. /package/dist/{chunk-ZIYT2Y4B.js.map → chunk-WOYJAG7H.js.map} +0 -0
  74. /package/dist/{source-map-uploader-NUONOEJG.js.map → source-map-uploader-UJPZCUFN.js.map} +0 -0
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  _resetForTesting,
3
3
  tracedRequestMiddleware
4
- } from "../chunk-VMK2G6QR.js";
4
+ } from "../chunk-AFTCLH77.js";
5
5
  import "../chunk-CL3OVHPO.js";
6
6
  import "../chunk-DQ25VOKK.js";
7
- import "../chunk-7LE2O4ZJ.js";
7
+ import "../chunk-GBVMPMVV.js";
8
8
  import "../chunk-NSBPE2FW.js";
9
9
  export {
10
10
  _resetForTesting,
@@ -15374,7 +15374,20 @@ var init_dist = __esm({
15374
15374
  * client-side allowlist enforcement layered with the product's
15375
15375
  * storage-time filter as defense-in-depth.
15376
15376
  */
15377
- sideEffectEvidence: external_exports.boolean().optional().default(false)
15377
+ sideEffectEvidence: external_exports.boolean().optional().default(false),
15378
+ /**
15379
+ * Per-account value-fidelity capture posture (server-pushed).
15380
+ *
15381
+ * `strict` (default) is fail-closed: the SDK rejects raw wall-clock
15382
+ * timestamps and unhashed identifiers from the `scalar.*` channel at
15383
+ * emit time. `full` relaxes those rejections so raw magnitudes can be
15384
+ * surfaced — but only in conjunction with an explicit producer opt-in
15385
+ * (so a `full`-configured account still emits strict-shaped scalars
15386
+ * unless the producer also opts in). The operator owns this flag; it
15387
+ * is never derived from producer or request input. Absent on the wire
15388
+ * ⇒ `strict`.
15389
+ */
15390
+ captureFidelity: external_exports.enum(["strict", "full"]).optional().default("strict")
15378
15391
  });
15379
15392
  SdkCachedConfigSchema = external_exports.object({
15380
15393
  response: external_exports.record(external_exports.string(), external_exports.unknown()),
@@ -15565,7 +15578,13 @@ var init_dist = __esm({
15565
15578
  SIDE_EFFECT_OMITTED_UNSUPPORTED_KEY: "glasstrace.side_effect.omitted.unsupported_key",
15566
15579
  SIDE_EFFECT_OMITTED_VALUE_TOO_LONG: "glasstrace.side_effect.omitted.value_too_long",
15567
15580
  SIDE_EFFECT_OMITTED_NOT_EMITTED: "glasstrace.side_effect.omitted.not_emitted",
15568
- SIDE_EFFECT_OMITTED_CAPTURE_DISABLED: "glasstrace.side_effect.omitted.capture_disabled"
15581
+ SIDE_EFFECT_OMITTED_CAPTURE_DISABLED: "glasstrace.side_effect.omitted.capture_disabled",
15582
+ // Value-fidelity scalar-channel omission reasons. Counts only; the
15583
+ // rejected raw value (timestamp, unhashed id, non-finite number) is
15584
+ // never echoed. Mirror the product omission enum verbatim.
15585
+ SIDE_EFFECT_OMITTED_RAW_TIMESTAMP: "glasstrace.side_effect.omitted.raw_timestamp",
15586
+ SIDE_EFFECT_OMITTED_UNHASHED_ID: "glasstrace.side_effect.omitted.unhashed_id",
15587
+ SIDE_EFFECT_OMITTED_NON_FINITE: "glasstrace.side_effect.omitted.non_finite"
15569
15588
  };
15570
15589
  DEFAULT_CAPTURE_CONFIG = {
15571
15590
  requestBodies: false,
@@ -15575,7 +15594,8 @@ var init_dist = __esm({
15575
15594
  importGraph: false,
15576
15595
  consoleErrors: false,
15577
15596
  errorResponseBodies: false,
15578
- sideEffectEvidence: false
15597
+ sideEffectEvidence: false,
15598
+ captureFidelity: "strict"
15579
15599
  };
15580
15600
  MAX_SOURCE_MAP_FILE_PATH_LENGTH = 512;
15581
15601
  MAX_SOURCE_MAP_FILE_SIZE = 50 * 1024 * 1024;
@@ -23712,6 +23732,13 @@ async function tryImport(moduleId) {
23712
23732
  return null;
23713
23733
  }
23714
23734
  }
23735
+ function warnPrismaInstrumentationUnavailable(verbose, detail) {
23736
+ if (!verbose) return;
23737
+ sdkLog(
23738
+ "warn",
23739
+ `[glasstrace] @prisma/instrumentation ${detail}; Prisma query spans will not be captured. If you use Prisma and expect database spans, add @prisma/instrumentation as a direct dependency (some package managers, e.g. pnpm, do not expose transitive copies).`
23740
+ );
23741
+ }
23715
23742
  async function configureOtel(config2, sessionManager) {
23716
23743
  setOtelState(OtelState.CONFIGURING);
23717
23744
  await new Promise((resolve3) => {
@@ -23819,7 +23846,14 @@ async function runRegistrationPath(config2, sessionManager) {
23819
23846
  const PrismaInstrumentation = prismaModule2.PrismaInstrumentation;
23820
23847
  if (PrismaInstrumentation) {
23821
23848
  otelConfig.instrumentations = [new PrismaInstrumentation()];
23849
+ } else {
23850
+ warnPrismaInstrumentationUnavailable(
23851
+ config2.verbose,
23852
+ "was loaded but did not export PrismaInstrumentation"
23853
+ );
23822
23854
  }
23855
+ } else {
23856
+ warnPrismaInstrumentationUnavailable(config2.verbose, "could not be loaded");
23823
23857
  }
23824
23858
  vercelOtel.registerOTel(otelConfig);
23825
23859
  const vercelProxy = trace.getTracerProvider();
@@ -23874,9 +23908,22 @@ async function runRegistrationPath(config2, sessionManager) {
23874
23908
  const inst = new PrismaInstrumentation();
23875
23909
  inst.setTracerProvider(provider);
23876
23910
  inst.enable();
23877
- } catch {
23911
+ } catch (err) {
23912
+ if (config2.verbose) {
23913
+ sdkLog(
23914
+ "warn",
23915
+ `[glasstrace] @prisma/instrumentation failed to initialize: ${err instanceof Error ? err.message : String(err)}. Prisma query spans will not be captured.`
23916
+ );
23917
+ }
23878
23918
  }
23919
+ } else {
23920
+ warnPrismaInstrumentationUnavailable(
23921
+ config2.verbose,
23922
+ "was loaded but did not export PrismaInstrumentation"
23923
+ );
23879
23924
  }
23925
+ } else {
23926
+ warnPrismaInstrumentationUnavailable(config2.verbose, "could not be loaded");
23880
23927
  }
23881
23928
  setOtelState(OtelState.OWNS_PROVIDER);
23882
23929
  emitLifecycleEvent("otel:configured", { state: OtelState.OWNS_PROVIDER, scenario: "A" });
@@ -24396,11 +24443,11 @@ function registerGlasstrace(options) {
24396
24443
  setCoreState(CoreState.REGISTERING);
24397
24444
  maybeWarnStaleAgentInstructions({
24398
24445
  projectRoot: process.cwd(),
24399
- sdkVersion: "1.15.0"
24446
+ sdkVersion: "1.16.0"
24400
24447
  });
24401
24448
  startRuntimeStateWriter({
24402
24449
  projectRoot: process.cwd(),
24403
- sdkVersion: "1.15.0"
24450
+ sdkVersion: "1.16.0"
24404
24451
  });
24405
24452
  const config2 = resolveConfig(options);
24406
24453
  setSideEffectVerboseFlag(config2.verbose);
@@ -24568,8 +24615,8 @@ async function backgroundInit(config2, anonKeyForInit, generation) {
24568
24615
  if (config2.verbose) {
24569
24616
  console.info("[glasstrace] Background init firing.");
24570
24617
  }
24571
- const healthReport = collectHealthReport("1.15.0");
24572
- const initResult = await performInit(config2, anonKeyForInit, "1.15.0", healthReport);
24618
+ const healthReport = collectHealthReport("1.16.0");
24619
+ const initResult = await performInit(config2, anonKeyForInit, "1.16.0", healthReport);
24573
24620
  if (generation !== registrationGeneration) return;
24574
24621
  const currentState = getCoreState();
24575
24622
  if (currentState === CoreState.SHUTTING_DOWN || currentState === CoreState.SHUTDOWN) {
@@ -24592,7 +24639,7 @@ async function backgroundInit(config2, anonKeyForInit, generation) {
24592
24639
  }
24593
24640
  maybeInstallConsoleCapture();
24594
24641
  if (didLastInitSucceed()) {
24595
- startHeartbeat(config2, anonKeyForInit, "1.15.0", generation, (newApiKey, accountId) => {
24642
+ startHeartbeat(config2, anonKeyForInit, "1.16.0", generation, (newApiKey, accountId) => {
24596
24643
  setAuthState(AuthState.CLAIMING);
24597
24644
  emitLifecycleEvent("auth:claim_started", { accountId });
24598
24645
  setResolvedApiKey(newApiKey);