@glasstrace/sdk 0.18.0 → 0.19.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/{chunk-GSGX76Q5.js → chunk-5N2IR4EO.js} +146 -3
- package/dist/chunk-5N2IR4EO.js.map +1 -0
- package/dist/{chunk-IOPCSX6C.js → chunk-F2TZRBEH.js} +2 -2
- package/dist/{chunk-E33Y7BQH.js → chunk-VN3GZDV6.js} +2 -2
- package/dist/{chunk-J5BW7V2D.js → chunk-YPXW2TN3.js} +2 -2
- package/dist/cli/init.cjs +68 -2
- package/dist/cli/init.cjs.map +1 -1
- package/dist/cli/init.js +4 -4
- package/dist/cli/mcp-add.cjs +66 -0
- package/dist/cli/mcp-add.cjs.map +1 -1
- package/dist/cli/mcp-add.js +2 -2
- package/dist/index.cjs +148 -34
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +43 -12
- package/dist/index.d.ts +43 -12
- package/dist/index.js +10 -39
- package/dist/index.js.map +1 -1
- package/dist/{source-map-uploader-26QPRSCG.js → source-map-uploader-VPDZWWM2.js} +3 -3
- package/package.json +1 -1
- package/dist/chunk-GSGX76Q5.js.map +0 -1
- /package/dist/{chunk-IOPCSX6C.js.map → chunk-F2TZRBEH.js.map} +0 -0
- /package/dist/{chunk-E33Y7BQH.js.map → chunk-VN3GZDV6.js.map} +0 -0
- /package/dist/{chunk-J5BW7V2D.js.map → chunk-YPXW2TN3.js.map} +0 -0
- /package/dist/{source-map-uploader-26QPRSCG.js.map → source-map-uploader-VPDZWWM2.js.map} +0 -0
package/dist/cli/mcp-add.js
CHANGED
|
@@ -8,8 +8,8 @@ import {
|
|
|
8
8
|
} from "../chunk-HAU66QBQ.js";
|
|
9
9
|
import {
|
|
10
10
|
readAnonKey
|
|
11
|
-
} from "../chunk-
|
|
12
|
-
import "../chunk-
|
|
11
|
+
} from "../chunk-YPXW2TN3.js";
|
|
12
|
+
import "../chunk-5N2IR4EO.js";
|
|
13
13
|
import {
|
|
14
14
|
scaffoldMcpMarker
|
|
15
15
|
} from "../chunk-O63DJKIJ.js";
|
package/dist/index.cjs
CHANGED
|
@@ -14489,7 +14489,84 @@ function createAnonApiKey() {
|
|
|
14489
14489
|
function createBuildHash(hash2) {
|
|
14490
14490
|
return BuildHashSchema.parse(hash2);
|
|
14491
14491
|
}
|
|
14492
|
-
|
|
14492
|
+
function rotr(x, n) {
|
|
14493
|
+
return (x >>> n | x << 32 - n) >>> 0;
|
|
14494
|
+
}
|
|
14495
|
+
function sha256Hex(input) {
|
|
14496
|
+
const message = new TextEncoder().encode(input);
|
|
14497
|
+
const bitLength = message.length * 8;
|
|
14498
|
+
const paddedLength = Math.ceil((message.length + 9) / 64) * 64;
|
|
14499
|
+
const padded = new Uint8Array(paddedLength);
|
|
14500
|
+
padded.set(message);
|
|
14501
|
+
padded[message.length] = 128;
|
|
14502
|
+
const view = new DataView(padded.buffer);
|
|
14503
|
+
view.setUint32(paddedLength - 8, Math.floor(bitLength / 4294967296), false);
|
|
14504
|
+
view.setUint32(paddedLength - 4, bitLength >>> 0, false);
|
|
14505
|
+
const H = new Uint32Array([
|
|
14506
|
+
1779033703,
|
|
14507
|
+
3144134277,
|
|
14508
|
+
1013904242,
|
|
14509
|
+
2773480762,
|
|
14510
|
+
1359893119,
|
|
14511
|
+
2600822924,
|
|
14512
|
+
528734635,
|
|
14513
|
+
1541459225
|
|
14514
|
+
]);
|
|
14515
|
+
const W = new Uint32Array(64);
|
|
14516
|
+
for (let offset = 0; offset < paddedLength; offset += 64) {
|
|
14517
|
+
for (let i = 0; i < 16; i++) {
|
|
14518
|
+
W[i] = view.getUint32(offset + i * 4, false);
|
|
14519
|
+
}
|
|
14520
|
+
for (let i = 16; i < 64; i++) {
|
|
14521
|
+
const s0 = rotr(W[i - 15], 7) ^ rotr(W[i - 15], 18) ^ W[i - 15] >>> 3;
|
|
14522
|
+
const s1 = rotr(W[i - 2], 17) ^ rotr(W[i - 2], 19) ^ W[i - 2] >>> 10;
|
|
14523
|
+
W[i] = W[i - 16] + s0 + W[i - 7] + s1 >>> 0;
|
|
14524
|
+
}
|
|
14525
|
+
let a = H[0];
|
|
14526
|
+
let b = H[1];
|
|
14527
|
+
let c = H[2];
|
|
14528
|
+
let d = H[3];
|
|
14529
|
+
let e = H[4];
|
|
14530
|
+
let f = H[5];
|
|
14531
|
+
let g = H[6];
|
|
14532
|
+
let h = H[7];
|
|
14533
|
+
for (let i = 0; i < 64; i++) {
|
|
14534
|
+
const S1 = rotr(e, 6) ^ rotr(e, 11) ^ rotr(e, 25);
|
|
14535
|
+
const ch = e & f ^ ~e & g;
|
|
14536
|
+
const temp1 = h + S1 + ch + K[i] + W[i] >>> 0;
|
|
14537
|
+
const S0 = rotr(a, 2) ^ rotr(a, 13) ^ rotr(a, 22);
|
|
14538
|
+
const maj = a & b ^ a & c ^ b & c;
|
|
14539
|
+
const temp2 = S0 + maj >>> 0;
|
|
14540
|
+
h = g;
|
|
14541
|
+
g = f;
|
|
14542
|
+
f = e;
|
|
14543
|
+
e = d + temp1 >>> 0;
|
|
14544
|
+
d = c;
|
|
14545
|
+
c = b;
|
|
14546
|
+
b = a;
|
|
14547
|
+
a = temp1 + temp2 >>> 0;
|
|
14548
|
+
}
|
|
14549
|
+
H[0] = H[0] + a >>> 0;
|
|
14550
|
+
H[1] = H[1] + b >>> 0;
|
|
14551
|
+
H[2] = H[2] + c >>> 0;
|
|
14552
|
+
H[3] = H[3] + d >>> 0;
|
|
14553
|
+
H[4] = H[4] + e >>> 0;
|
|
14554
|
+
H[5] = H[5] + f >>> 0;
|
|
14555
|
+
H[6] = H[6] + g >>> 0;
|
|
14556
|
+
H[7] = H[7] + h >>> 0;
|
|
14557
|
+
}
|
|
14558
|
+
let out = "";
|
|
14559
|
+
for (let i = 0; i < 8; i++) {
|
|
14560
|
+
out += H[i].toString(16).padStart(8, "0");
|
|
14561
|
+
}
|
|
14562
|
+
return out;
|
|
14563
|
+
}
|
|
14564
|
+
function deriveSessionId(apiKey, origin, date5, windowIndex) {
|
|
14565
|
+
const input = JSON.stringify([apiKey, origin, date5, windowIndex]);
|
|
14566
|
+
const digest = sha256Hex(input).slice(0, 16);
|
|
14567
|
+
return SessionIdSchema.parse(digest);
|
|
14568
|
+
}
|
|
14569
|
+
var DevApiKeySchema, AnonApiKeySchema, SessionIdSchema, BuildHashSchema, SdkDiagnosticCodeSchema, CaptureConfigSchema, SdkCachedConfigSchema, GlasstraceOptionsSchema, GlasstraceEnvVarsSchema, ImportGraphPayloadSchema, SdkHealthReportSchema, TierLimitsSchema, SdkInitResponseSchema, DiscoveryResponseSchema, SourceMapUploadResponseSchema, PresignedUploadRequestSchema, PresignedUploadResponseSchema, SourceMapManifestRequestSchema, SourceMapManifestResponseSchema, GLASSTRACE_ATTRIBUTE_NAMES, DEFAULT_CAPTURE_CONFIG, K;
|
|
14493
14570
|
var init_dist = __esm({
|
|
14494
14571
|
"../protocol/dist/index.js"() {
|
|
14495
14572
|
"use strict";
|
|
@@ -14668,6 +14745,72 @@ var init_dist = __esm({
|
|
|
14668
14745
|
consoleErrors: false,
|
|
14669
14746
|
errorResponseBodies: false
|
|
14670
14747
|
};
|
|
14748
|
+
K = new Uint32Array([
|
|
14749
|
+
1116352408,
|
|
14750
|
+
1899447441,
|
|
14751
|
+
3049323471,
|
|
14752
|
+
3921009573,
|
|
14753
|
+
961987163,
|
|
14754
|
+
1508970993,
|
|
14755
|
+
2453635748,
|
|
14756
|
+
2870763221,
|
|
14757
|
+
3624381080,
|
|
14758
|
+
310598401,
|
|
14759
|
+
607225278,
|
|
14760
|
+
1426881987,
|
|
14761
|
+
1925078388,
|
|
14762
|
+
2162078206,
|
|
14763
|
+
2614888103,
|
|
14764
|
+
3248222580,
|
|
14765
|
+
3835390401,
|
|
14766
|
+
4022224774,
|
|
14767
|
+
264347078,
|
|
14768
|
+
604807628,
|
|
14769
|
+
770255983,
|
|
14770
|
+
1249150122,
|
|
14771
|
+
1555081692,
|
|
14772
|
+
1996064986,
|
|
14773
|
+
2554220882,
|
|
14774
|
+
2821834349,
|
|
14775
|
+
2952996808,
|
|
14776
|
+
3210313671,
|
|
14777
|
+
3336571891,
|
|
14778
|
+
3584528711,
|
|
14779
|
+
113926993,
|
|
14780
|
+
338241895,
|
|
14781
|
+
666307205,
|
|
14782
|
+
773529912,
|
|
14783
|
+
1294757372,
|
|
14784
|
+
1396182291,
|
|
14785
|
+
1695183700,
|
|
14786
|
+
1986661051,
|
|
14787
|
+
2177026350,
|
|
14788
|
+
2456956037,
|
|
14789
|
+
2730485921,
|
|
14790
|
+
2820302411,
|
|
14791
|
+
3259730800,
|
|
14792
|
+
3345764771,
|
|
14793
|
+
3516065817,
|
|
14794
|
+
3600352804,
|
|
14795
|
+
4094571909,
|
|
14796
|
+
275423344,
|
|
14797
|
+
430227734,
|
|
14798
|
+
506948616,
|
|
14799
|
+
659060556,
|
|
14800
|
+
883997877,
|
|
14801
|
+
958139571,
|
|
14802
|
+
1322822218,
|
|
14803
|
+
1537002063,
|
|
14804
|
+
1747873779,
|
|
14805
|
+
1955562222,
|
|
14806
|
+
2024104815,
|
|
14807
|
+
2227730452,
|
|
14808
|
+
2361852424,
|
|
14809
|
+
2428436474,
|
|
14810
|
+
2756734187,
|
|
14811
|
+
3204031479,
|
|
14812
|
+
3329325298
|
|
14813
|
+
]);
|
|
14671
14814
|
}
|
|
14672
14815
|
});
|
|
14673
14816
|
|
|
@@ -16789,37 +16932,8 @@ init_env_detection();
|
|
|
16789
16932
|
// src/session.ts
|
|
16790
16933
|
init_dist();
|
|
16791
16934
|
var FOUR_HOURS_MS = 4 * 60 * 60 * 1e3;
|
|
16792
|
-
var hashFn = null;
|
|
16793
|
-
function fnv1aHash(input) {
|
|
16794
|
-
let hash2 = 2166136261;
|
|
16795
|
-
for (let i = 0; i < input.length; i++) {
|
|
16796
|
-
hash2 ^= input.charCodeAt(i);
|
|
16797
|
-
hash2 = Math.imul(hash2, 16777619);
|
|
16798
|
-
hash2 >>>= 0;
|
|
16799
|
-
}
|
|
16800
|
-
return hash2.toString(16).padStart(8, "0");
|
|
16801
|
-
}
|
|
16802
|
-
function getHashFn() {
|
|
16803
|
-
if (hashFn) return hashFn;
|
|
16804
|
-
try {
|
|
16805
|
-
const { createHash: createHash3 } = require("node:crypto");
|
|
16806
|
-
hashFn = (input) => createHash3("sha256").update(input).digest("hex").slice(0, 16);
|
|
16807
|
-
} catch {
|
|
16808
|
-
hashFn = (input) => {
|
|
16809
|
-
const h1 = fnv1aHash(input);
|
|
16810
|
-
const h2 = fnv1aHash(input + "\0");
|
|
16811
|
-
return (h1 + h2).slice(0, 16);
|
|
16812
|
-
};
|
|
16813
|
-
}
|
|
16814
|
-
return hashFn;
|
|
16815
|
-
}
|
|
16816
16935
|
var cachedGlasstraceEnv = process.env.GLASSTRACE_ENV;
|
|
16817
16936
|
var cachedPort = process.env.PORT ?? "3000";
|
|
16818
|
-
function deriveSessionId(apiKey, origin, date5, windowIndex) {
|
|
16819
|
-
const input = JSON.stringify([apiKey, origin, date5, windowIndex]);
|
|
16820
|
-
const hash2 = getHashFn()(input);
|
|
16821
|
-
return SessionIdSchema.parse(hash2);
|
|
16822
|
-
}
|
|
16823
16937
|
function getOrigin() {
|
|
16824
16938
|
if (cachedGlasstraceEnv) {
|
|
16825
16939
|
return cachedGlasstraceEnv;
|
|
@@ -21721,7 +21835,7 @@ function registerGlasstrace(options) {
|
|
|
21721
21835
|
setCoreState(CoreState.REGISTERING);
|
|
21722
21836
|
startRuntimeStateWriter({
|
|
21723
21837
|
projectRoot: process.cwd(),
|
|
21724
|
-
sdkVersion: "0.
|
|
21838
|
+
sdkVersion: "0.19.0"
|
|
21725
21839
|
});
|
|
21726
21840
|
const config2 = resolveConfig(options);
|
|
21727
21841
|
if (config2.verbose) {
|
|
@@ -21887,8 +22001,8 @@ async function backgroundInit(config2, anonKeyForInit, generation) {
|
|
|
21887
22001
|
if (config2.verbose) {
|
|
21888
22002
|
console.info("[glasstrace] Background init firing.");
|
|
21889
22003
|
}
|
|
21890
|
-
const healthReport = collectHealthReport("0.
|
|
21891
|
-
const initResult = await performInit(config2, anonKeyForInit, "0.
|
|
22004
|
+
const healthReport = collectHealthReport("0.19.0");
|
|
22005
|
+
const initResult = await performInit(config2, anonKeyForInit, "0.19.0", healthReport);
|
|
21892
22006
|
if (generation !== registrationGeneration) return;
|
|
21893
22007
|
const currentState = getCoreState();
|
|
21894
22008
|
if (currentState === CoreState.SHUTTING_DOWN || currentState === CoreState.SHUTDOWN) {
|
|
@@ -21911,7 +22025,7 @@ async function backgroundInit(config2, anonKeyForInit, generation) {
|
|
|
21911
22025
|
}
|
|
21912
22026
|
maybeInstallConsoleCapture();
|
|
21913
22027
|
if (didLastInitSucceed()) {
|
|
21914
|
-
startHeartbeat(config2, anonKeyForInit, "0.
|
|
22028
|
+
startHeartbeat(config2, anonKeyForInit, "0.19.0", generation, (newApiKey, accountId) => {
|
|
21915
22029
|
setAuthState(AuthState.CLAIMING);
|
|
21916
22030
|
emitLifecycleEvent("auth:claim_started", { accountId });
|
|
21917
22031
|
setResolvedApiKey(newApiKey);
|