@glasstrace/sdk 1.0.1 → 1.1.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 (60) hide show
  1. package/README.md +3 -2
  2. package/dist/{chunk-KE7MCPO5.js → chunk-4EZ6JTDG.js} +2 -2
  3. package/dist/{chunk-67RIOAXV.js → chunk-6RNBUUBR.js} +2 -2
  4. package/dist/{chunk-DXRZKKSO.js → chunk-7SZQN6IU.js} +1 -3
  5. package/dist/chunk-7SZQN6IU.js.map +1 -0
  6. package/dist/{chunk-55FBXXER.js → chunk-DIM4JRXM.js} +2 -2
  7. package/dist/{chunk-UGJ3X4CT.js → chunk-DST4UBXU.js} +2 -2
  8. package/dist/{chunk-DO2YPMQ5.js → chunk-MXDZHFJQ.js} +23 -5
  9. package/dist/chunk-MXDZHFJQ.js.map +1 -0
  10. package/dist/chunk-P22UQ2OJ.js +384 -0
  11. package/dist/chunk-P22UQ2OJ.js.map +1 -0
  12. package/dist/{chunk-HAU66QBQ.js → chunk-P4OYPFQ5.js} +9 -9
  13. package/dist/chunk-P4OYPFQ5.js.map +1 -0
  14. package/dist/{chunk-TQ54WLCZ.js → chunk-X5MAXP5T.js} +2 -1
  15. package/dist/{chunk-MV3F7HVX.js → chunk-Y26HJUPD.js} +49 -27
  16. package/dist/{chunk-MV3F7HVX.js.map → chunk-Y26HJUPD.js.map} +1 -1
  17. package/dist/{chunk-LU3PPAOQ.js → chunk-ZRDQ6ZKI.js} +474 -93
  18. package/dist/chunk-ZRDQ6ZKI.js.map +1 -0
  19. package/dist/cli/init.cjs +1118 -946
  20. package/dist/cli/init.cjs.map +1 -1
  21. package/dist/cli/init.js +42 -29
  22. package/dist/cli/init.js.map +1 -1
  23. package/dist/cli/mcp-add.cjs +243 -83
  24. package/dist/cli/mcp-add.cjs.map +1 -1
  25. package/dist/cli/mcp-add.d.cts +35 -4
  26. package/dist/cli/mcp-add.d.ts +35 -4
  27. package/dist/cli/mcp-add.js +48 -24
  28. package/dist/cli/mcp-add.js.map +1 -1
  29. package/dist/cli/status.cjs.map +1 -1
  30. package/dist/cli/status.js +3 -1
  31. package/dist/cli/status.js.map +1 -1
  32. package/dist/cli/uninit.cjs +4 -4
  33. package/dist/cli/uninit.cjs.map +1 -1
  34. package/dist/cli/uninit.js +4 -4
  35. package/dist/edge-entry.js +2 -2
  36. package/dist/index.cjs +423 -118
  37. package/dist/index.cjs.map +1 -1
  38. package/dist/index.js +5 -5
  39. package/dist/{monorepo-N5Z63XP7.js → monorepo-GSL6JD3G.js} +5 -3
  40. package/dist/node-entry.cjs +423 -118
  41. package/dist/node-entry.cjs.map +1 -1
  42. package/dist/node-entry.js +7 -7
  43. package/dist/node-subpath.js +3 -3
  44. package/dist/{source-map-uploader-BJIXRLJ6.js → source-map-uploader-DPUUCLNW.js} +3 -3
  45. package/package.json +6 -6
  46. package/dist/chunk-DO2YPMQ5.js.map +0 -1
  47. package/dist/chunk-DXRZKKSO.js.map +0 -1
  48. package/dist/chunk-HAU66QBQ.js.map +0 -1
  49. package/dist/chunk-IP4NMDJK.js +0 -98
  50. package/dist/chunk-IP4NMDJK.js.map +0 -1
  51. package/dist/chunk-LU3PPAOQ.js.map +0 -1
  52. package/dist/chunk-O63DJKIJ.js +0 -460
  53. package/dist/chunk-O63DJKIJ.js.map +0 -1
  54. /package/dist/{chunk-KE7MCPO5.js.map → chunk-4EZ6JTDG.js.map} +0 -0
  55. /package/dist/{chunk-67RIOAXV.js.map → chunk-6RNBUUBR.js.map} +0 -0
  56. /package/dist/{chunk-55FBXXER.js.map → chunk-DIM4JRXM.js.map} +0 -0
  57. /package/dist/{chunk-UGJ3X4CT.js.map → chunk-DST4UBXU.js.map} +0 -0
  58. /package/dist/{chunk-TQ54WLCZ.js.map → chunk-X5MAXP5T.js.map} +0 -0
  59. /package/dist/{monorepo-N5Z63XP7.js.map → monorepo-GSL6JD3G.js.map} +0 -0
  60. /package/dist/{source-map-uploader-BJIXRLJ6.js.map → source-map-uploader-DPUUCLNW.js.map} +0 -0
@@ -33,7 +33,7 @@ import {
33
33
  performInit,
34
34
  recordSpansDropped,
35
35
  recordSpansExported
36
- } from "./chunk-DO2YPMQ5.js";
36
+ } from "./chunk-MXDZHFJQ.js";
37
37
  import {
38
38
  isAnonymousMode,
39
39
  isProductionDisabled,
@@ -42,11 +42,11 @@ import {
42
42
  import {
43
43
  getOrCreateAnonKey,
44
44
  readAnonKey
45
- } from "./chunk-IP4NMDJK.js";
45
+ } from "./chunk-P22UQ2OJ.js";
46
46
  import {
47
47
  GLASSTRACE_ATTRIBUTE_NAMES,
48
48
  deriveSessionId
49
- } from "./chunk-TQ54WLCZ.js";
49
+ } from "./chunk-X5MAXP5T.js";
50
50
  import {
51
51
  __require
52
52
  } from "./chunk-NSBPE2FW.js";
@@ -1090,7 +1090,7 @@ function getStringFromEnv(key) {
1090
1090
  }
1091
1091
 
1092
1092
  // ../../node_modules/@opentelemetry/core/build/esm/version.js
1093
- var VERSION = "2.6.1";
1093
+ var VERSION = "2.7.0";
1094
1094
 
1095
1095
  // ../../node_modules/@opentelemetry/semantic-conventions/build/esm/stable_attributes.js
1096
1096
  var ATTR_EXCEPTION_MESSAGE = "exception.message";
@@ -1254,6 +1254,9 @@ function mergeTwoObjects(one, two, level = 0, objects) {
1254
1254
  const keys = Object.keys(two);
1255
1255
  for (let i = 0, j = keys.length; i < j; i++) {
1256
1256
  const key = keys[i];
1257
+ if (key === "__proto__" || key === "constructor" || key === "prototype") {
1258
+ continue;
1259
+ }
1257
1260
  result[key] = takeValue(two[key]);
1258
1261
  }
1259
1262
  }
@@ -1266,6 +1269,9 @@ function mergeTwoObjects(one, two, level = 0, objects) {
1266
1269
  const keys = Object.keys(two);
1267
1270
  for (let i = 0, j = keys.length; i < j; i++) {
1268
1271
  const key = keys[i];
1272
+ if (key === "__proto__" || key === "constructor" || key === "prototype") {
1273
+ continue;
1274
+ }
1269
1275
  const twoValue = two[key];
1270
1276
  if (isPrimitive(twoValue)) {
1271
1277
  if (typeof twoValue === "undefined") {
@@ -2326,7 +2332,7 @@ function samplingDecisionToString(decision) {
2326
2332
  }
2327
2333
 
2328
2334
  // ../../node_modules/@opentelemetry/sdk-trace-base/build/esm/version.js
2329
- var VERSION2 = "2.6.1";
2335
+ var VERSION2 = "2.7.0";
2330
2336
 
2331
2337
  // ../../node_modules/@opentelemetry/sdk-trace-base/build/esm/Tracer.js
2332
2338
  var Tracer = class {
@@ -2972,7 +2978,12 @@ var JsonTraceSerializer = {
2972
2978
  return {};
2973
2979
  }
2974
2980
  const decoder = new TextDecoder();
2975
- return JSON.parse(decoder.decode(arg));
2981
+ try {
2982
+ return JSON.parse(decoder.decode(arg));
2983
+ } catch (err) {
2984
+ diag.warn(`Failed to parse trace export response: ${err.message}. Returning empty response`);
2985
+ return {};
2986
+ }
2976
2987
  }
2977
2988
  };
2978
2989
 
@@ -3082,10 +3093,11 @@ function parseRetryAfterToMills(retryAfter) {
3082
3093
  }
3083
3094
 
3084
3095
  // ../../node_modules/@opentelemetry/otlp-exporter-base/build/esm/version.js
3085
- var VERSION3 = "0.214.0";
3096
+ var VERSION3 = "0.215.0";
3086
3097
 
3087
3098
  // ../../node_modules/@opentelemetry/otlp-exporter-base/build/esm/transport/http-transport-utils.js
3088
3099
  var DEFAULT_USER_AGENT = `OTel-OTLP-Exporter-JavaScript/${VERSION3}`;
3100
+ var MAX_RESPONSE_BODY_SIZE = 4 * 1024 * 1024;
3089
3101
  function sendWithHttp(request, url, headers, compression, userAgent, agent, data, timeoutMillis) {
3090
3102
  return new Promise((resolve2) => {
3091
3103
  const parsedUrl = new URL(url);
@@ -3104,7 +3116,17 @@ function sendWithHttp(request, url, headers, compression, userAgent, agent, data
3104
3116
  };
3105
3117
  const req = request(options, (res) => {
3106
3118
  const responseData = [];
3107
- res.on("data", (chunk) => responseData.push(chunk));
3119
+ let responseSize = 0;
3120
+ res.on("data", (chunk) => {
3121
+ responseSize += chunk.length;
3122
+ if (responseSize > MAX_RESPONSE_BODY_SIZE) {
3123
+ const sizeError = new Error(`OTLP export response body exceeded size limit of ${MAX_RESPONSE_BODY_SIZE} bytes`);
3124
+ resolve2({ status: "failure", error: sizeError });
3125
+ res.destroy();
3126
+ return;
3127
+ }
3128
+ responseData.push(chunk);
3129
+ });
3108
3130
  res.on("end", () => {
3109
3131
  if (res.statusCode && res.statusCode <= 299) {
3110
3132
  resolve2({
@@ -3482,24 +3504,24 @@ var OTLPTraceExporter = class extends OTLPExporterBase {
3482
3504
  };
3483
3505
 
3484
3506
  // src/otel-config.ts
3485
- var _resolvedApiKey = API_KEY_PENDING;
3486
- var _activeExporter = null;
3487
- var _additionalExporters = [];
3488
- var _injectedProcessor = null;
3507
+ var resolvedApiKey = API_KEY_PENDING;
3508
+ var activeExporter = null;
3509
+ var additionalExporters = [];
3510
+ var injectedProcessor = null;
3489
3511
  function setResolvedApiKey(key) {
3490
- _resolvedApiKey = key;
3512
+ resolvedApiKey = key;
3491
3513
  }
3492
3514
  function getResolvedApiKey() {
3493
- return _resolvedApiKey;
3515
+ return resolvedApiKey;
3494
3516
  }
3495
3517
  function notifyApiKeyResolved() {
3496
- _activeExporter?.notifyKeyResolved();
3497
- for (const exporter of _additionalExporters) {
3518
+ activeExporter?.notifyKeyResolved();
3519
+ for (const exporter of additionalExporters) {
3498
3520
  exporter.notifyKeyResolved();
3499
3521
  }
3500
3522
  }
3501
3523
  function registerExporterForKeyNotification(exporter) {
3502
- _additionalExporters.push(exporter);
3524
+ additionalExporters.push(exporter);
3503
3525
  }
3504
3526
  async function tryImport(moduleId) {
3505
3527
  try {
@@ -3542,7 +3564,7 @@ async function runCoexistencePath(existingProvider, config) {
3542
3564
  return;
3543
3565
  }
3544
3566
  if (result !== null) {
3545
- _injectedProcessor = result.processor;
3567
+ injectedProcessor = result.processor;
3546
3568
  if (config.verbose) {
3547
3569
  sdkLog(
3548
3570
  "info",
@@ -3553,8 +3575,8 @@ async function runCoexistencePath(existingProvider, config) {
3553
3575
  name: "coexistence-flush",
3554
3576
  priority: 5,
3555
3577
  fn: async () => {
3556
- if (_injectedProcessor) {
3557
- await _injectedProcessor.forceFlush();
3578
+ if (injectedProcessor) {
3579
+ await injectedProcessor.forceFlush();
3558
3580
  }
3559
3581
  }
3560
3582
  });
@@ -3590,7 +3612,7 @@ async function runRegistrationPath(config, sessionManager) {
3590
3612
  createDelegate: createOtlpExporter,
3591
3613
  verbose: config.verbose
3592
3614
  });
3593
- _activeExporter = glasstraceExporter;
3615
+ activeExporter = glasstraceExporter;
3594
3616
  const vercelOtel = await tryImport("@vercel/otel");
3595
3617
  if (vercelOtel && typeof vercelOtel.registerOTel === "function") {
3596
3618
  const otelConfig = {
@@ -4005,7 +4027,7 @@ function registerGlasstrace(options) {
4005
4027
  setCoreState(CoreState.REGISTERING);
4006
4028
  startRuntimeStateWriter({
4007
4029
  projectRoot: process.cwd(),
4008
- sdkVersion: "1.0.1"
4030
+ sdkVersion: "1.1.1"
4009
4031
  });
4010
4032
  const config = resolveConfig(options);
4011
4033
  if (config.verbose) {
@@ -4171,8 +4193,8 @@ async function backgroundInit(config, anonKeyForInit, generation) {
4171
4193
  if (config.verbose) {
4172
4194
  console.info("[glasstrace] Background init firing.");
4173
4195
  }
4174
- const healthReport = collectHealthReport("1.0.1");
4175
- const initResult = await performInit(config, anonKeyForInit, "1.0.1", healthReport);
4196
+ const healthReport = collectHealthReport("1.1.1");
4197
+ const initResult = await performInit(config, anonKeyForInit, "1.1.1", healthReport);
4176
4198
  if (generation !== registrationGeneration) return;
4177
4199
  const currentState = getCoreState();
4178
4200
  if (currentState === CoreState.SHUTTING_DOWN || currentState === CoreState.SHUTDOWN) {
@@ -4195,7 +4217,7 @@ async function backgroundInit(config, anonKeyForInit, generation) {
4195
4217
  }
4196
4218
  maybeInstallConsoleCapture();
4197
4219
  if (didLastInitSucceed()) {
4198
- startHeartbeat(config, anonKeyForInit, "1.0.1", generation, (newApiKey, accountId) => {
4220
+ startHeartbeat(config, anonKeyForInit, "1.1.1", generation, (newApiKey, accountId) => {
4199
4221
  setAuthState(AuthState.CLAIMING);
4200
4222
  emitLifecycleEvent("auth:claim_started", { accountId });
4201
4223
  setResolvedApiKey(newApiKey);
@@ -4490,7 +4512,7 @@ async function handleSourceMapUpload(distDir) {
4490
4512
  );
4491
4513
  return;
4492
4514
  }
4493
- const { discoverSourceMapFiles, computeBuildHash, uploadSourceMaps } = await import("./source-map-uploader-BJIXRLJ6.js");
4515
+ const { discoverSourceMapFiles, computeBuildHash, uploadSourceMaps } = await import("./source-map-uploader-DPUUCLNW.js");
4494
4516
  const files = await discoverSourceMapFiles(distDir);
4495
4517
  if (files.length === 0) {
4496
4518
  console.info("[glasstrace] No source map files found. Skipping upload.");
@@ -4544,4 +4566,4 @@ export {
4544
4566
  withGlasstraceConfig,
4545
4567
  captureError
4546
4568
  };
4547
- //# sourceMappingURL=chunk-MV3F7HVX.js.map
4569
+ //# sourceMappingURL=chunk-Y26HJUPD.js.map