@glasstrace/sdk 0.17.1 → 0.17.2

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.
@@ -5,7 +5,7 @@ import {
5
5
  injectInfoSection,
6
6
  updateGitignore,
7
7
  writeMcpConfig
8
- } from "../chunk-CTJI2YKA.js";
8
+ } from "../chunk-HAU66QBQ.js";
9
9
  import {
10
10
  readAnonKey
11
11
  } from "../chunk-J5BW7V2D.js";
package/dist/index.cjs CHANGED
@@ -17507,6 +17507,7 @@ async function performInit(config2, anonKey, sdkVersion, healthReport) {
17507
17507
  rateLimitBackoff = false;
17508
17508
  return null;
17509
17509
  }
17510
+ let failureRecorded = false;
17510
17511
  try {
17511
17512
  const effectiveKey = config2.apiKey || anonKey;
17512
17513
  if (!effectiveKey) {
@@ -17539,6 +17540,7 @@ async function performInit(config2, anonKey, sdkVersion, healthReport) {
17539
17540
  return null;
17540
17541
  } catch (err) {
17541
17542
  recordInitFailure();
17543
+ failureRecorded = true;
17542
17544
  if (err instanceof HttpsTransportError) {
17543
17545
  if (/timed out|aborted/i.test(err.message)) {
17544
17546
  console.warn("[glasstrace] ingestion_unreachable: Init request timed out.");
@@ -17577,9 +17579,15 @@ async function performInit(config2, anonKey, sdkVersion, healthReport) {
17577
17579
  return null;
17578
17580
  }
17579
17581
  } catch (err) {
17580
- console.warn(
17581
- `[glasstrace] Unexpected init error: ${err instanceof Error ? err.message : String(err)}`
17582
- );
17582
+ if (!failureRecorded) {
17583
+ recordInitFailure();
17584
+ }
17585
+ try {
17586
+ console.warn(
17587
+ `[glasstrace] Unexpected init error: ${err instanceof Error ? err.message : String(err)}`
17588
+ );
17589
+ } catch {
17590
+ }
17583
17591
  }
17584
17592
  return null;
17585
17593
  }
@@ -21681,7 +21689,7 @@ function registerGlasstrace(options) {
21681
21689
  setCoreState(CoreState.REGISTERING);
21682
21690
  startRuntimeStateWriter({
21683
21691
  projectRoot: process.cwd(),
21684
- sdkVersion: "0.17.1"
21692
+ sdkVersion: "0.17.2"
21685
21693
  });
21686
21694
  const config2 = resolveConfig(options);
21687
21695
  if (config2.verbose) {
@@ -21846,8 +21854,8 @@ async function backgroundInit(config2, anonKeyForInit, generation) {
21846
21854
  if (config2.verbose) {
21847
21855
  console.info("[glasstrace] Background init firing.");
21848
21856
  }
21849
- const healthReport = collectHealthReport("0.17.1");
21850
- const initResult = await performInit(config2, anonKeyForInit, "0.17.1", healthReport);
21857
+ const healthReport = collectHealthReport("0.17.2");
21858
+ const initResult = await performInit(config2, anonKeyForInit, "0.17.2", healthReport);
21851
21859
  if (generation !== registrationGeneration) return;
21852
21860
  const currentState = getCoreState();
21853
21861
  if (currentState === CoreState.SHUTTING_DOWN || currentState === CoreState.SHUTDOWN) {
@@ -21870,7 +21878,7 @@ async function backgroundInit(config2, anonKeyForInit, generation) {
21870
21878
  }
21871
21879
  maybeInstallConsoleCapture();
21872
21880
  if (didLastInitSucceed()) {
21873
- startHeartbeat(config2, anonKeyForInit, "0.17.1", generation, (newApiKey, accountId) => {
21881
+ startHeartbeat(config2, anonKeyForInit, "0.17.2", generation, (newApiKey, accountId) => {
21874
21882
  setAuthState(AuthState.CLAIMING);
21875
21883
  emitLifecycleEvent("auth:claim_started", { accountId });
21876
21884
  setResolvedApiKey(newApiKey);