@glasstrace/sdk 0.8.0 → 0.9.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.
- package/dist/{chunk-UGHMMOM4.js → chunk-4NDQPWDJ.js} +16 -21
- package/dist/chunk-4NDQPWDJ.js.map +1 -0
- package/dist/chunk-DXRZKKSO.js +21 -0
- package/dist/chunk-DXRZKKSO.js.map +1 -0
- package/dist/{chunk-QW6W4CSA.js → chunk-PQWAKVQ5.js} +9 -4
- package/dist/chunk-PQWAKVQ5.js.map +1 -0
- package/dist/{chunk-SALPGSWK.js → chunk-Y6V7BTF3.js} +2 -2
- package/dist/cli/init.cjs +900 -62
- package/dist/cli/init.cjs.map +1 -1
- package/dist/cli/init.js +295 -15
- package/dist/cli/init.js.map +1 -1
- package/dist/cli/mcp-add.cjs +25 -15
- package/dist/cli/mcp-add.cjs.map +1 -1
- package/dist/cli/mcp-add.js +6 -4
- package/dist/cli/mcp-add.js.map +1 -1
- package/dist/cli/uninit.cjs +587 -0
- package/dist/cli/uninit.cjs.map +1 -0
- package/dist/cli/uninit.d.cts +141 -0
- package/dist/cli/uninit.d.ts +141 -0
- package/dist/cli/uninit.js +543 -0
- package/dist/cli/uninit.js.map +1 -0
- package/dist/index.cjs +52 -42
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +46 -39
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
- package/dist/chunk-QW6W4CSA.js.map +0 -1
- package/dist/chunk-UGHMMOM4.js.map +0 -1
- /package/dist/{chunk-SALPGSWK.js.map → chunk-Y6V7BTF3.js.map} +0 -0
package/dist/index.cjs
CHANGED
|
@@ -15793,9 +15793,14 @@ async function getOrCreateAnonKey(projectRoot) {
|
|
|
15793
15793
|
} catch (err) {
|
|
15794
15794
|
const code = err.code;
|
|
15795
15795
|
if (code === "EEXIST") {
|
|
15796
|
-
|
|
15797
|
-
|
|
15798
|
-
|
|
15796
|
+
for (let attempt = 0; attempt < 3; attempt++) {
|
|
15797
|
+
const winnerKey = await readAnonKey(root);
|
|
15798
|
+
if (winnerKey !== null) {
|
|
15799
|
+
return winnerKey;
|
|
15800
|
+
}
|
|
15801
|
+
if (attempt < 2) {
|
|
15802
|
+
await new Promise((resolve2) => setTimeout(resolve2, 50));
|
|
15803
|
+
}
|
|
15799
15804
|
}
|
|
15800
15805
|
try {
|
|
15801
15806
|
await (0, import_promises.writeFile)(keyPath, newKey, { mode: 384 });
|
|
@@ -19147,6 +19152,43 @@ async function configureOtel(config2, sessionManager) {
|
|
|
19147
19152
|
registerShutdownHooks(provider);
|
|
19148
19153
|
}
|
|
19149
19154
|
|
|
19155
|
+
// src/nudge/error-nudge.ts
|
|
19156
|
+
var import_node_fs2 = require("fs");
|
|
19157
|
+
var import_node_path3 = require("path");
|
|
19158
|
+
var hasFired = false;
|
|
19159
|
+
function sanitize(input) {
|
|
19160
|
+
return input.replace(/[\x00-\x1f\x7f]/g, "");
|
|
19161
|
+
}
|
|
19162
|
+
function maybeShowMcpNudge(errorSummary) {
|
|
19163
|
+
if (hasFired) {
|
|
19164
|
+
return;
|
|
19165
|
+
}
|
|
19166
|
+
const config2 = resolveConfig();
|
|
19167
|
+
if (isProductionDisabled(config2)) {
|
|
19168
|
+
hasFired = true;
|
|
19169
|
+
return;
|
|
19170
|
+
}
|
|
19171
|
+
let markerExists = false;
|
|
19172
|
+
try {
|
|
19173
|
+
const markerPath = (0, import_node_path3.join)(process.cwd(), ".glasstrace", "mcp-connected");
|
|
19174
|
+
markerExists = (0, import_node_fs2.existsSync)(markerPath);
|
|
19175
|
+
} catch {
|
|
19176
|
+
markerExists = false;
|
|
19177
|
+
}
|
|
19178
|
+
if (markerExists) {
|
|
19179
|
+
hasFired = true;
|
|
19180
|
+
return;
|
|
19181
|
+
}
|
|
19182
|
+
hasFired = true;
|
|
19183
|
+
const safe = sanitize(errorSummary);
|
|
19184
|
+
process.stderr.write(
|
|
19185
|
+
`[glasstrace] Error captured: ${safe}
|
|
19186
|
+
Debug with AI: ask your agent "What's the latest Glasstrace error?"
|
|
19187
|
+
Not connected? Run: npx glasstrace mcp add
|
|
19188
|
+
`
|
|
19189
|
+
);
|
|
19190
|
+
}
|
|
19191
|
+
|
|
19150
19192
|
// src/console-capture.ts
|
|
19151
19193
|
var isGlasstraceLog = false;
|
|
19152
19194
|
var originalError = null;
|
|
@@ -19183,9 +19225,14 @@ async function installConsoleCapture() {
|
|
|
19183
19225
|
if (otelApi) {
|
|
19184
19226
|
const span = otelApi.trace.getSpan(otelApi.context.active());
|
|
19185
19227
|
if (span) {
|
|
19228
|
+
const formattedMessage = formatArgs(args);
|
|
19186
19229
|
span.addEvent("console.error", {
|
|
19187
|
-
"console.message":
|
|
19230
|
+
"console.message": formattedMessage
|
|
19188
19231
|
});
|
|
19232
|
+
try {
|
|
19233
|
+
maybeShowMcpNudge(formattedMessage);
|
|
19234
|
+
} catch {
|
|
19235
|
+
}
|
|
19189
19236
|
}
|
|
19190
19237
|
}
|
|
19191
19238
|
};
|
|
@@ -19351,7 +19398,7 @@ async function backgroundInit(config2, anonKeyForInit, generation) {
|
|
|
19351
19398
|
if (config2.verbose) {
|
|
19352
19399
|
console.info("[glasstrace] Background init firing.");
|
|
19353
19400
|
}
|
|
19354
|
-
const initResult = await performInit(config2, anonKeyForInit, "0.
|
|
19401
|
+
const initResult = await performInit(config2, anonKeyForInit, "0.9.1");
|
|
19355
19402
|
if (generation !== registrationGeneration) return;
|
|
19356
19403
|
if (initResult?.claimResult) {
|
|
19357
19404
|
setResolvedApiKey(initResult.claimResult.newApiKey);
|
|
@@ -19675,43 +19722,6 @@ async function handleSourceMapUpload(distDir) {
|
|
|
19675
19722
|
|
|
19676
19723
|
// src/capture-error.ts
|
|
19677
19724
|
init_esm();
|
|
19678
|
-
|
|
19679
|
-
// src/nudge/error-nudge.ts
|
|
19680
|
-
var import_node_fs2 = require("fs");
|
|
19681
|
-
var import_node_path3 = require("path");
|
|
19682
|
-
var hasFired = false;
|
|
19683
|
-
function sanitize(input) {
|
|
19684
|
-
return input.replace(/[\x00-\x1f\x7f]/g, "");
|
|
19685
|
-
}
|
|
19686
|
-
function maybeShowMcpNudge(errorSummary) {
|
|
19687
|
-
if (hasFired) {
|
|
19688
|
-
return;
|
|
19689
|
-
}
|
|
19690
|
-
const config2 = resolveConfig();
|
|
19691
|
-
if (isProductionDisabled(config2)) {
|
|
19692
|
-
return;
|
|
19693
|
-
}
|
|
19694
|
-
let markerExists = false;
|
|
19695
|
-
try {
|
|
19696
|
-
const markerPath = (0, import_node_path3.join)(process.cwd(), ".glasstrace", "mcp-connected");
|
|
19697
|
-
markerExists = (0, import_node_fs2.existsSync)(markerPath);
|
|
19698
|
-
} catch {
|
|
19699
|
-
markerExists = false;
|
|
19700
|
-
}
|
|
19701
|
-
if (markerExists) {
|
|
19702
|
-
return;
|
|
19703
|
-
}
|
|
19704
|
-
hasFired = true;
|
|
19705
|
-
const safe = sanitize(errorSummary);
|
|
19706
|
-
process.stderr.write(
|
|
19707
|
-
`[glasstrace] Error captured: ${safe}
|
|
19708
|
-
Debug with AI: ask your agent "What's the latest Glasstrace error?"
|
|
19709
|
-
Not connected? Run: npx glasstrace mcp add
|
|
19710
|
-
`
|
|
19711
|
-
);
|
|
19712
|
-
}
|
|
19713
|
-
|
|
19714
|
-
// src/capture-error.ts
|
|
19715
19725
|
function captureError(error48) {
|
|
19716
19726
|
try {
|
|
19717
19727
|
const span = trace.getSpan(context.active());
|