@glasstrace/sdk 1.3.4 → 1.3.6
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/README.md +6 -0
- package/dist/{chunk-XFNK4YEW.js → chunk-IY6A6EXS.js} +50 -21
- package/dist/chunk-IY6A6EXS.js.map +1 -0
- package/dist/{chunk-P4OYPFQ5.js → chunk-TZMYGEMB.js} +2 -2
- package/dist/chunk-TZMYGEMB.js.map +1 -0
- package/dist/cli/init.cjs +2 -2
- package/dist/cli/init.cjs.map +1 -1
- package/dist/cli/init.js +2 -2
- package/dist/cli/mcp-add.cjs +1 -1
- package/dist/cli/mcp-add.cjs.map +1 -1
- package/dist/cli/mcp-add.js +1 -1
- package/dist/index.cjs +49 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/node-entry.cjs +51 -22
- package/dist/node-entry.cjs.map +1 -1
- package/dist/node-entry.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-P4OYPFQ5.js.map +0 -1
- package/dist/chunk-XFNK4YEW.js.map +0 -1
package/dist/index.js
CHANGED
package/dist/node-entry.cjs
CHANGED
|
@@ -22164,6 +22164,27 @@ function detectSentry() {
|
|
|
22164
22164
|
}
|
|
22165
22165
|
}
|
|
22166
22166
|
|
|
22167
|
+
// src/proxy-detection.ts
|
|
22168
|
+
function isProxyTracerProvider(value) {
|
|
22169
|
+
if (value === null || value === void 0 || typeof value !== "object") {
|
|
22170
|
+
return false;
|
|
22171
|
+
}
|
|
22172
|
+
return "getTracer" in value && typeof value.getTracer === "function" && "getDelegate" in value && typeof value.getDelegate === "function" && "setDelegate" in value && typeof value.setDelegate === "function" && "getDelegateTracer" in value && typeof value.getDelegateTracer === "function";
|
|
22173
|
+
}
|
|
22174
|
+
function isProxyTracer(value, ownerProvider) {
|
|
22175
|
+
if (value === null || value === void 0 || typeof value !== "object") {
|
|
22176
|
+
return false;
|
|
22177
|
+
}
|
|
22178
|
+
const structurallyShaped = "_getTracer" in value && typeof value._getTracer === "function" && "startSpan" in value && typeof value.startSpan === "function" && "startActiveSpan" in value && typeof value.startActiveSpan === "function";
|
|
22179
|
+
if (!structurallyShaped) {
|
|
22180
|
+
return false;
|
|
22181
|
+
}
|
|
22182
|
+
if (!Object.hasOwn(value, "_provider")) {
|
|
22183
|
+
return false;
|
|
22184
|
+
}
|
|
22185
|
+
return value._provider === ownerProvider;
|
|
22186
|
+
}
|
|
22187
|
+
|
|
22167
22188
|
// src/otel-config.ts
|
|
22168
22189
|
var resolvedApiKey = API_KEY_PENDING;
|
|
22169
22190
|
var activeExporter = null;
|
|
@@ -22202,7 +22223,7 @@ async function configureOtel(config2, sessionManager) {
|
|
|
22202
22223
|
});
|
|
22203
22224
|
const existingProvider = trace.getTracerProvider();
|
|
22204
22225
|
const probeTracer = existingProvider.getTracer("glasstrace-probe");
|
|
22205
|
-
const anotherProviderRegistered = probeTracer
|
|
22226
|
+
const anotherProviderRegistered = !isProxyTracerProvider(existingProvider) || !isProxyTracer(probeTracer, existingProvider);
|
|
22206
22227
|
if (anotherProviderRegistered) {
|
|
22207
22228
|
setCoexistenceState("coexisting");
|
|
22208
22229
|
await runCoexistencePath(existingProvider, config2);
|
|
@@ -22481,19 +22502,19 @@ function stopHeartbeat() {
|
|
|
22481
22502
|
}
|
|
22482
22503
|
}
|
|
22483
22504
|
function checkShutdownMarker(projectRoot) {
|
|
22484
|
-
let
|
|
22485
|
-
let
|
|
22505
|
+
let fsSync3 = null;
|
|
22506
|
+
let pathSync2 = null;
|
|
22486
22507
|
try {
|
|
22487
|
-
|
|
22488
|
-
|
|
22508
|
+
fsSync3 = require("node:fs");
|
|
22509
|
+
pathSync2 = require("node:path");
|
|
22489
22510
|
} catch {
|
|
22490
22511
|
return { triggered: false };
|
|
22491
22512
|
}
|
|
22492
22513
|
const root = projectRoot ?? (typeof process !== "undefined" ? process.cwd() : ".");
|
|
22493
|
-
const markerPath =
|
|
22494
|
-
if (!
|
|
22514
|
+
const markerPath = pathSync2.join(root, SHUTDOWN_MARKER_RELPATH);
|
|
22515
|
+
if (!fsSync3.existsSync(markerPath)) return { triggered: false };
|
|
22495
22516
|
try {
|
|
22496
|
-
|
|
22517
|
+
fsSync3.unlinkSync(markerPath);
|
|
22497
22518
|
} catch {
|
|
22498
22519
|
}
|
|
22499
22520
|
const shutdown = executeShutdown().catch(() => {
|
|
@@ -22573,9 +22594,16 @@ function registerHeartbeatShutdownHook(config2, anonKey, sdkVersion) {
|
|
|
22573
22594
|
}
|
|
22574
22595
|
|
|
22575
22596
|
// src/runtime-state.ts
|
|
22576
|
-
var import_node_fs = require("node:fs");
|
|
22577
|
-
var import_node_path = require("node:path");
|
|
22578
22597
|
init_console_capture();
|
|
22598
|
+
var fsSync = null;
|
|
22599
|
+
var pathSync = null;
|
|
22600
|
+
try {
|
|
22601
|
+
fsSync = require("node:fs");
|
|
22602
|
+
pathSync = require("node:path");
|
|
22603
|
+
} catch {
|
|
22604
|
+
fsSync = null;
|
|
22605
|
+
pathSync = null;
|
|
22606
|
+
}
|
|
22579
22607
|
var _projectRoot = null;
|
|
22580
22608
|
var _sdkVersion = "unknown";
|
|
22581
22609
|
var _lastScenario;
|
|
@@ -22584,7 +22612,7 @@ var _debounceTimer = null;
|
|
|
22584
22612
|
var _started = false;
|
|
22585
22613
|
function startRuntimeStateWriter(options) {
|
|
22586
22614
|
if (_started) return;
|
|
22587
|
-
if (!isSyncFsAvailable()) {
|
|
22615
|
+
if (!isSyncFsAvailable() || fsSync === null || pathSync === null) {
|
|
22588
22616
|
_started = true;
|
|
22589
22617
|
return;
|
|
22590
22618
|
}
|
|
@@ -22636,9 +22664,9 @@ function writeStateNow() {
|
|
|
22636
22664
|
if (_lastError) {
|
|
22637
22665
|
runtimeState.lastError = _lastError;
|
|
22638
22666
|
}
|
|
22639
|
-
const dir =
|
|
22640
|
-
const filePath =
|
|
22641
|
-
|
|
22667
|
+
const dir = pathSync.join(_projectRoot, ".glasstrace");
|
|
22668
|
+
const filePath = pathSync.join(dir, "runtime-state.json");
|
|
22669
|
+
fsSync.mkdirSync(dir, { recursive: true, mode: 448 });
|
|
22642
22670
|
atomicWriteFileSync(filePath, JSON.stringify(runtimeState, null, 2) + "\n", {
|
|
22643
22671
|
mode: 384
|
|
22644
22672
|
});
|
|
@@ -22680,7 +22708,7 @@ function registerGlasstrace(options) {
|
|
|
22680
22708
|
setCoreState(CoreState.REGISTERING);
|
|
22681
22709
|
startRuntimeStateWriter({
|
|
22682
22710
|
projectRoot: process.cwd(),
|
|
22683
|
-
sdkVersion: "1.3.
|
|
22711
|
+
sdkVersion: "1.3.6"
|
|
22684
22712
|
});
|
|
22685
22713
|
const config2 = resolveConfig(options);
|
|
22686
22714
|
if (config2.verbose) {
|
|
@@ -22696,8 +22724,9 @@ function registerGlasstrace(options) {
|
|
|
22696
22724
|
if (config2.verbose) {
|
|
22697
22725
|
console.info("[glasstrace] Not production-disabled.");
|
|
22698
22726
|
}
|
|
22699
|
-
const
|
|
22700
|
-
const
|
|
22727
|
+
const existingTracerProvider = trace.getTracerProvider();
|
|
22728
|
+
const existingProbe = existingTracerProvider.getTracer("glasstrace-probe");
|
|
22729
|
+
const anotherProviderRegistered = !isProxyTracerProvider(existingTracerProvider) || !isProxyTracer(existingProbe, existingTracerProvider);
|
|
22701
22730
|
if (anotherProviderRegistered) {
|
|
22702
22731
|
setCoexistenceState("coexisting");
|
|
22703
22732
|
}
|
|
@@ -22846,8 +22875,8 @@ async function backgroundInit(config2, anonKeyForInit, generation) {
|
|
|
22846
22875
|
if (config2.verbose) {
|
|
22847
22876
|
console.info("[glasstrace] Background init firing.");
|
|
22848
22877
|
}
|
|
22849
|
-
const healthReport = collectHealthReport("1.3.
|
|
22850
|
-
const initResult = await performInit(config2, anonKeyForInit, "1.3.
|
|
22878
|
+
const healthReport = collectHealthReport("1.3.6");
|
|
22879
|
+
const initResult = await performInit(config2, anonKeyForInit, "1.3.6", healthReport);
|
|
22851
22880
|
if (generation !== registrationGeneration) return;
|
|
22852
22881
|
const currentState = getCoreState();
|
|
22853
22882
|
if (currentState === CoreState.SHUTTING_DOWN || currentState === CoreState.SHUTDOWN) {
|
|
@@ -22870,7 +22899,7 @@ async function backgroundInit(config2, anonKeyForInit, generation) {
|
|
|
22870
22899
|
}
|
|
22871
22900
|
maybeInstallConsoleCapture();
|
|
22872
22901
|
if (didLastInitSucceed()) {
|
|
22873
|
-
startHeartbeat(config2, anonKeyForInit, "1.3.
|
|
22902
|
+
startHeartbeat(config2, anonKeyForInit, "1.3.6", generation, (newApiKey, accountId) => {
|
|
22874
22903
|
setAuthState(AuthState.CLAIMING);
|
|
22875
22904
|
emitLifecycleEvent("auth:claim_started", { accountId });
|
|
22876
22905
|
setResolvedApiKey(newApiKey);
|
|
@@ -23105,7 +23134,7 @@ init_source_map_uploader();
|
|
|
23105
23134
|
|
|
23106
23135
|
// src/import-graph.ts
|
|
23107
23136
|
var fs3 = __toESM(require("node:fs/promises"), 1);
|
|
23108
|
-
var
|
|
23137
|
+
var fsSync2 = __toESM(require("node:fs"), 1);
|
|
23109
23138
|
var path3 = __toESM(require("node:path"), 1);
|
|
23110
23139
|
var crypto3 = __toESM(require("node:crypto"), 1);
|
|
23111
23140
|
init_dist();
|
|
@@ -23139,7 +23168,7 @@ function loadCustomTestPatterns(projectRoot) {
|
|
|
23139
23168
|
const configPath = path3.join(projectRoot, name);
|
|
23140
23169
|
let content;
|
|
23141
23170
|
try {
|
|
23142
|
-
content =
|
|
23171
|
+
content = fsSync2.readFileSync(configPath, "utf-8");
|
|
23143
23172
|
} catch {
|
|
23144
23173
|
continue;
|
|
23145
23174
|
}
|