@glasstrace/sdk 0.13.5 → 0.14.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.
package/dist/cli/init.cjs CHANGED
@@ -14823,7 +14823,8 @@ var init_dist = __esm({
14823
14823
  envVarValues: external_exports.boolean(),
14824
14824
  fullConsoleOutput: external_exports.boolean(),
14825
14825
  importGraph: external_exports.boolean(),
14826
- consoleErrors: external_exports.boolean().optional().default(false)
14826
+ consoleErrors: external_exports.boolean().optional().default(false),
14827
+ errorResponseBodies: external_exports.boolean().optional().default(false)
14827
14828
  });
14828
14829
  SdkCachedConfigSchema = external_exports.object({
14829
14830
  response: external_exports.record(external_exports.string(), external_exports.unknown()),
@@ -16612,7 +16613,8 @@ function runStatus(options) {
16612
16613
  configWrapped: checkConfigWrapped(root),
16613
16614
  anonKey: checkAnonKey(root),
16614
16615
  mcpConfigured: checkMcpConfigured(root),
16615
- agents: checkAgents(root)
16616
+ agents: checkAgents(root),
16617
+ runtime: readRuntimeState(root)
16616
16618
  };
16617
16619
  }
16618
16620
  function checkInstalled(root) {
@@ -16703,7 +16705,69 @@ function checkAgents(root) {
16703
16705
  }
16704
16706
  return found;
16705
16707
  }
16706
- var fs6, path6, MCP_JSON_FILES, MCP_TOML_FILES, AGENT_INFO_FILES2, INSTRUMENTATION_FILES;
16708
+ function readRuntimeState(root) {
16709
+ const empty = {
16710
+ available: false,
16711
+ stale: false,
16712
+ coreState: null,
16713
+ authState: null,
16714
+ otelState: null,
16715
+ otelScenario: null,
16716
+ updatedAt: null,
16717
+ pid: null
16718
+ };
16719
+ try {
16720
+ const filePath = path6.join(root, ".glasstrace", "runtime-state.json");
16721
+ const content = fs6.readFileSync(filePath, "utf-8");
16722
+ const parsed = JSON.parse(content);
16723
+ const updatedAt = typeof parsed.updatedAt === "string" ? parsed.updatedAt : null;
16724
+ const pid = typeof parsed.pid === "number" ? parsed.pid : null;
16725
+ const core = parsed.core;
16726
+ const auth = parsed.auth;
16727
+ const otel = parsed.otel;
16728
+ const coreState = typeof core?.state === "string" ? core.state : null;
16729
+ const authState = typeof auth?.state === "string" ? auth.state : null;
16730
+ const otelState = typeof otel?.state === "string" ? otel.state : null;
16731
+ const otelScenario = typeof otel?.scenario === "string" ? otel.scenario : null;
16732
+ let stale = false;
16733
+ if (coreState === "SHUTDOWN") {
16734
+ stale = false;
16735
+ } else if (updatedAt) {
16736
+ const updatedMs = new Date(updatedAt).getTime();
16737
+ const age = Number.isFinite(updatedMs) ? Date.now() - updatedMs : Infinity;
16738
+ if (age > STALE_THRESHOLD_MS) {
16739
+ if (pid && pid > 0) {
16740
+ try {
16741
+ process.kill(pid, 0);
16742
+ stale = false;
16743
+ } catch (err) {
16744
+ const code = err?.code;
16745
+ if (code === "EPERM") {
16746
+ stale = false;
16747
+ } else {
16748
+ stale = true;
16749
+ }
16750
+ }
16751
+ } else {
16752
+ stale = true;
16753
+ }
16754
+ }
16755
+ }
16756
+ return {
16757
+ available: true,
16758
+ stale,
16759
+ coreState,
16760
+ authState,
16761
+ otelState,
16762
+ otelScenario,
16763
+ updatedAt,
16764
+ pid
16765
+ };
16766
+ } catch {
16767
+ return empty;
16768
+ }
16769
+ }
16770
+ var fs6, path6, MCP_JSON_FILES, MCP_TOML_FILES, AGENT_INFO_FILES2, INSTRUMENTATION_FILES, STALE_THRESHOLD_MS;
16707
16771
  var init_status = __esm({
16708
16772
  "src/cli/status.ts"() {
16709
16773
  "use strict";
@@ -16726,6 +16790,7 @@ var init_status = __esm({
16726
16790
  "src/instrumentation.js",
16727
16791
  "src/instrumentation.mjs"
16728
16792
  ];
16793
+ STALE_THRESHOLD_MS = 3e4;
16729
16794
  }
16730
16795
  });
16731
16796