@glasstrace/sdk 1.3.9 → 1.5.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/README.md +124 -0
- package/dist/capture-error-BmQz7xF6.d.cts +455 -0
- package/dist/capture-error-CTgSYxek.d.ts +455 -0
- package/dist/{chunk-XS5W3SPL.js → chunk-4WI7B5FQ.js} +91 -5
- package/dist/chunk-4WI7B5FQ.js.map +1 -0
- package/dist/{chunk-JZ475QRH.js → chunk-D3QXU2VM.js} +22 -191
- package/dist/chunk-D3QXU2VM.js.map +1 -0
- package/dist/{chunk-GYTCZSAV.js → chunk-MFYOQOD7.js} +2 -2
- package/dist/{chunk-4WUHMLMM.js → chunk-MMKFFF2L.js} +2 -2
- package/dist/{chunk-JH7EGRC5.js → chunk-N3XIVM2U.js} +158 -12
- package/dist/chunk-N3XIVM2U.js.map +1 -0
- package/dist/{chunk-FKBCEOJ5.js → chunk-Q42BY5BA.js} +2 -2
- package/dist/{chunk-DBKG6SRI.js → chunk-QU26IKIJ.js} +2 -2
- package/dist/{chunk-ADUD4PEK.js → chunk-TANUWTFO.js} +3 -3
- package/dist/{chunk-LJMZXJ45.js → chunk-YLY7AGLC.js} +9 -6
- package/dist/chunk-YLY7AGLC.js.map +1 -0
- package/dist/chunk-ZBQQXVHD.js +208 -0
- package/dist/chunk-ZBQQXVHD.js.map +1 -0
- package/dist/cli/init.cjs +218 -35
- package/dist/cli/init.cjs.map +1 -1
- package/dist/cli/init.js +69 -12
- package/dist/cli/init.js.map +1 -1
- package/dist/cli/mcp-add.cjs +57 -26
- package/dist/cli/mcp-add.cjs.map +1 -1
- package/dist/cli/mcp-add.js +12 -9
- package/dist/cli/mcp-add.js.map +1 -1
- package/dist/cli/status.cjs +33 -3
- package/dist/cli/status.cjs.map +1 -1
- package/dist/cli/status.js +12 -3
- package/dist/cli/status.js.map +1 -1
- package/dist/cli/uninit.cjs +27 -3
- package/dist/cli/uninit.cjs.map +1 -1
- package/dist/cli/uninit.d.cts +10 -2
- package/dist/cli/uninit.d.ts +10 -2
- package/dist/cli/uninit.js +4 -3
- package/dist/cli/upgrade-instructions.cjs +440 -0
- package/dist/cli/upgrade-instructions.cjs.map +1 -0
- package/dist/cli/upgrade-instructions.d.cts +48 -0
- package/dist/cli/upgrade-instructions.d.ts +48 -0
- package/dist/cli/upgrade-instructions.js +80 -0
- package/dist/cli/upgrade-instructions.js.map +1 -0
- package/dist/cli/validate.cjs +12 -1
- package/dist/cli/validate.cjs.map +1 -1
- package/dist/cli/validate.js +2 -2
- package/dist/{edge-entry-BSKA1l_0.d.ts → edge-entry-AWO70gje.d.ts} +1 -1
- package/dist/{edge-entry-DyMWa6JK.d.cts → edge-entry-DaeG7D7S.d.cts} +1 -1
- package/dist/edge-entry.cjs +43 -2
- package/dist/edge-entry.cjs.map +1 -1
- package/dist/edge-entry.d.cts +2 -2
- package/dist/edge-entry.d.ts +2 -2
- package/dist/edge-entry.js +2 -2
- package/dist/index.cjs +594 -64
- package/dist/index.cjs.map +1 -1
- package/dist/{index.d-Bo_Rxund.d.cts → index.d-Dq33YwFT.d.cts} +91 -1
- package/dist/{index.d-Bo_Rxund.d.ts → index.d-Dq33YwFT.d.ts} +91 -1
- package/dist/index.d.cts +91 -431
- package/dist/index.d.ts +91 -431
- package/dist/index.js +291 -6
- package/dist/index.js.map +1 -1
- package/dist/node-entry.cjs +282 -71
- package/dist/node-entry.cjs.map +1 -1
- package/dist/node-entry.d.cts +3 -3
- package/dist/node-entry.d.ts +3 -3
- package/dist/node-entry.js +8 -7
- package/dist/node-subpath.cjs +12 -1
- package/dist/node-subpath.cjs.map +1 -1
- package/dist/node-subpath.d.cts +1 -1
- package/dist/node-subpath.d.ts +1 -1
- package/dist/node-subpath.js +3 -3
- package/dist/{source-map-uploader-FSTHCYDR.js → source-map-uploader-PB3M4PPP.js} +3 -3
- package/package.json +1 -1
- package/dist/chunk-JH7EGRC5.js.map +0 -1
- package/dist/chunk-JZ475QRH.js.map +0 -1
- package/dist/chunk-LJMZXJ45.js.map +0 -1
- package/dist/chunk-XS5W3SPL.js.map +0 -1
- /package/dist/{chunk-GYTCZSAV.js.map → chunk-MFYOQOD7.js.map} +0 -0
- /package/dist/{chunk-4WUHMLMM.js.map → chunk-MMKFFF2L.js.map} +0 -0
- /package/dist/{chunk-FKBCEOJ5.js.map → chunk-Q42BY5BA.js.map} +0 -0
- /package/dist/{chunk-DBKG6SRI.js.map → chunk-QU26IKIJ.js.map} +0 -0
- /package/dist/{chunk-ADUD4PEK.js.map → chunk-TANUWTFO.js.map} +0 -0
- /package/dist/{source-map-uploader-FSTHCYDR.js.map → source-map-uploader-PB3M4PPP.js.map} +0 -0
package/dist/cli/mcp-add.cjs
CHANGED
|
@@ -13831,7 +13831,18 @@ var CaptureConfigSchema = external_exports.object({
|
|
|
13831
13831
|
fullConsoleOutput: external_exports.boolean(),
|
|
13832
13832
|
importGraph: external_exports.boolean(),
|
|
13833
13833
|
consoleErrors: external_exports.boolean().optional().default(false),
|
|
13834
|
-
errorResponseBodies: external_exports.boolean().optional().default(false)
|
|
13834
|
+
errorResponseBodies: external_exports.boolean().optional().default(false),
|
|
13835
|
+
/**
|
|
13836
|
+
* Account opt-in for side-effect evidence emission (SDK-049).
|
|
13837
|
+
*
|
|
13838
|
+
* When `false` (default), `recordSideEffect()` is a silent no-op:
|
|
13839
|
+
* no allowlist evaluation runs and no `glasstrace.side_effect.*`
|
|
13840
|
+
* attribute reaches the wire. When `true`, allowlisted side-effect
|
|
13841
|
+
* metadata is attached to the active OTel span subject to the
|
|
13842
|
+
* client-side allowlist enforcement layered with the product's
|
|
13843
|
+
* storage-time filter as defense-in-depth.
|
|
13844
|
+
*/
|
|
13845
|
+
sideEffectEvidence: external_exports.boolean().optional().default(false)
|
|
13835
13846
|
});
|
|
13836
13847
|
var SdkCachedConfigSchema = external_exports.object({
|
|
13837
13848
|
response: external_exports.record(external_exports.string(), external_exports.unknown()),
|
|
@@ -14503,28 +14514,39 @@ function generateMcpConfig(agent, endpoint, bearer) {
|
|
|
14503
14514
|
}
|
|
14504
14515
|
}
|
|
14505
14516
|
}
|
|
14506
|
-
|
|
14517
|
+
var SDK_VERSION_STAMP_PATTERN = /^[A-Za-z0-9.+-]+$/;
|
|
14518
|
+
function htmlMarkers(sdkVersion) {
|
|
14507
14519
|
return {
|
|
14508
|
-
start:
|
|
14520
|
+
start: `<!-- glasstrace:mcp:start v=${sdkVersion} -->`,
|
|
14509
14521
|
end: "<!-- glasstrace:mcp:end -->"
|
|
14510
14522
|
};
|
|
14511
14523
|
}
|
|
14512
|
-
function hashMarkers() {
|
|
14524
|
+
function hashMarkers(sdkVersion) {
|
|
14513
14525
|
return {
|
|
14514
|
-
start:
|
|
14526
|
+
start: `# glasstrace:mcp:start v=${sdkVersion}`,
|
|
14515
14527
|
end: "# glasstrace:mcp:end"
|
|
14516
14528
|
};
|
|
14517
14529
|
}
|
|
14518
|
-
function generateInfoSection(agent, endpoint) {
|
|
14530
|
+
function generateInfoSection(agent, endpoint, sdkVersion) {
|
|
14519
14531
|
if (!endpoint || endpoint.trim() === "") {
|
|
14520
14532
|
throw new Error("endpoint must not be empty");
|
|
14521
14533
|
}
|
|
14534
|
+
if (!sdkVersion || sdkVersion.trim() === "") {
|
|
14535
|
+
throw new Error("sdkVersion must not be empty");
|
|
14536
|
+
}
|
|
14537
|
+
if (!SDK_VERSION_STAMP_PATTERN.test(sdkVersion)) {
|
|
14538
|
+
throw new Error(
|
|
14539
|
+
"sdkVersion must match [A-Za-z0-9.+\\-]+ (semver-shaped, no whitespace, no angle brackets)"
|
|
14540
|
+
);
|
|
14541
|
+
}
|
|
14522
14542
|
const content = [
|
|
14523
14543
|
"",
|
|
14524
14544
|
"## Glasstrace MCP Integration",
|
|
14525
14545
|
"",
|
|
14526
14546
|
`Glasstrace is configured as an MCP server at: ${endpoint}`,
|
|
14527
14547
|
"",
|
|
14548
|
+
"Glasstrace MCP is available when runtime evidence would materially reduce uncertainty. Use it when there is a failing request, stack trace, unclear runtime behavior, race/data-flow symptom, side effect, or performance issue that source inspection alone does not explain. For a current error, `get_latest_error` or `get_error_list` is usually the cheapest orientation call. For a known route/procedure with no exact error, use `find_trace_candidates` and follow returned exact `get_trace` or `get_root_cause` arguments only if the candidates look relevant. Do not call trace tools for trivial source-local fixes. Treat **no candidates** or **no_traces_found** as a scoped retrieval result, not proof the bug is absent.",
|
|
14549
|
+
"",
|
|
14528
14550
|
"Available tools:",
|
|
14529
14551
|
"- `get_latest_error` - Get the most recent error trace from the current session",
|
|
14530
14552
|
"- `find_trace_candidates` - First-contact route/procedure/URL candidate selection when you have a route fragment, tRPC procedure, method, status, or rough recent activity window but not the exact trace ID. Returns candidate traces plus suggested `get_trace` / `get_root_cause` follow-up call arguments. Candidate discovery, not root-cause proof.",
|
|
@@ -14534,24 +14556,24 @@ function generateInfoSection(agent, endpoint) {
|
|
|
14534
14556
|
"- `get_test_suggestions` - Get test suggestions based on recent errors",
|
|
14535
14557
|
"- `get_session_timeline` - Get the timeline of all traces in the current session",
|
|
14536
14558
|
"",
|
|
14537
|
-
"To reconfigure, run: `npx glasstrace mcp add
|
|
14559
|
+
"To refresh this managed section after a `@glasstrace/sdk` upgrade, run: `npx glasstrace upgrade-instructions`. To reconfigure MCP credentials, run: `npx glasstrace mcp add`.",
|
|
14538
14560
|
""
|
|
14539
14561
|
].join("\n");
|
|
14540
14562
|
switch (agent.name) {
|
|
14541
14563
|
case "claude": {
|
|
14542
|
-
const m = htmlMarkers();
|
|
14564
|
+
const m = htmlMarkers(sdkVersion);
|
|
14543
14565
|
return `${m.start}
|
|
14544
14566
|
${content}${m.end}
|
|
14545
14567
|
`;
|
|
14546
14568
|
}
|
|
14547
14569
|
case "codex": {
|
|
14548
|
-
const m = htmlMarkers();
|
|
14570
|
+
const m = htmlMarkers(sdkVersion);
|
|
14549
14571
|
return `${m.start}
|
|
14550
14572
|
${content}${m.end}
|
|
14551
14573
|
`;
|
|
14552
14574
|
}
|
|
14553
14575
|
case "cursor": {
|
|
14554
|
-
const m = hashMarkers();
|
|
14576
|
+
const m = hashMarkers(sdkVersion);
|
|
14555
14577
|
return `${m.start}
|
|
14556
14578
|
${content}${m.end}
|
|
14557
14579
|
`;
|
|
@@ -14570,10 +14592,26 @@ ${content}${m.end}
|
|
|
14570
14592
|
// src/agent-detection/inject.ts
|
|
14571
14593
|
var import_promises2 = require("node:fs/promises");
|
|
14572
14594
|
var import_node_path2 = require("node:path");
|
|
14573
|
-
var
|
|
14595
|
+
var HTML_START_RE = /^<!--\s*glasstrace:mcp:start(?:\s+v=([^\s>]+))?\s*-->$/;
|
|
14574
14596
|
var HTML_END = "<!-- glasstrace:mcp:end -->";
|
|
14575
|
-
var
|
|
14597
|
+
var HASH_START_RE = /^#\s*glasstrace:mcp:start(?:\s+v=(\S+))?$/;
|
|
14576
14598
|
var HASH_END = "# glasstrace:mcp:end";
|
|
14599
|
+
function parseStartMarkerLine(line) {
|
|
14600
|
+
const trimmed = line.trim();
|
|
14601
|
+
const html = HTML_START_RE.exec(trimmed);
|
|
14602
|
+
if (html !== null) {
|
|
14603
|
+
return { kind: "html", stamp: html[1] ?? null };
|
|
14604
|
+
}
|
|
14605
|
+
const hash2 = HASH_START_RE.exec(trimmed);
|
|
14606
|
+
if (hash2 !== null) {
|
|
14607
|
+
return { kind: "hash", stamp: hash2[1] ?? null };
|
|
14608
|
+
}
|
|
14609
|
+
return null;
|
|
14610
|
+
}
|
|
14611
|
+
function isEndMarker(line) {
|
|
14612
|
+
const trimmed = line.trim();
|
|
14613
|
+
return trimmed === HTML_END || trimmed === HASH_END;
|
|
14614
|
+
}
|
|
14577
14615
|
function isPermissionError(err) {
|
|
14578
14616
|
const code = err.code;
|
|
14579
14617
|
return code === "EACCES" || code === "EPERM" || code === "EROFS";
|
|
@@ -14615,22 +14653,14 @@ async function writeMcpConfig(agent, content, projectRoot) {
|
|
|
14615
14653
|
}
|
|
14616
14654
|
function findMarkerBoundaries(lines) {
|
|
14617
14655
|
let startIdx = -1;
|
|
14618
|
-
let endIdx = -1;
|
|
14619
14656
|
for (let i = 0; i < lines.length; i++) {
|
|
14620
|
-
|
|
14621
|
-
if (trimmed === HTML_START || trimmed === HASH_START) {
|
|
14657
|
+
if (parseStartMarkerLine(lines[i]) !== null) {
|
|
14622
14658
|
startIdx = i;
|
|
14623
|
-
} else if (
|
|
14624
|
-
|
|
14625
|
-
endIdx = i;
|
|
14626
|
-
break;
|
|
14627
|
-
}
|
|
14659
|
+
} else if (startIdx !== -1 && isEndMarker(lines[i])) {
|
|
14660
|
+
return { startIdx, endIdx: i };
|
|
14628
14661
|
}
|
|
14629
14662
|
}
|
|
14630
|
-
|
|
14631
|
-
return null;
|
|
14632
|
-
}
|
|
14633
|
-
return { startIdx, endIdx };
|
|
14663
|
+
return null;
|
|
14634
14664
|
}
|
|
14635
14665
|
async function injectInfoSection(agent, content, projectRoot) {
|
|
14636
14666
|
if (agent.infoFilePath === null) {
|
|
@@ -14899,10 +14929,11 @@ async function mcpAdd(options) {
|
|
|
14899
14929
|
const bearer = resolved.effective.key;
|
|
14900
14930
|
for (const agent of targetAgents) {
|
|
14901
14931
|
const name = formatAgentName(agent.name);
|
|
14932
|
+
const sdkVersion = true ? "1.5.0" : "0.0.0-dev";
|
|
14902
14933
|
if (agent.name !== "generic") {
|
|
14903
14934
|
const cliSuccess = await registerViaCli(agent, bearer);
|
|
14904
14935
|
if (cliSuccess) {
|
|
14905
|
-
const infoContent = generateInfoSection(agent, MCP_ENDPOINT);
|
|
14936
|
+
const infoContent = generateInfoSection(agent, MCP_ENDPOINT, sdkVersion);
|
|
14906
14937
|
if (infoContent !== "") {
|
|
14907
14938
|
await injectInfoSection(agent, infoContent, projectRoot);
|
|
14908
14939
|
}
|
|
@@ -14920,7 +14951,7 @@ async function mcpAdd(options) {
|
|
|
14920
14951
|
const configContent = generateMcpConfig(agent, MCP_ENDPOINT, bearer);
|
|
14921
14952
|
await writeMcpConfig(agent, configContent, projectRoot);
|
|
14922
14953
|
if (fs.existsSync(agent.mcpConfigPath)) {
|
|
14923
|
-
const infoContent = generateInfoSection(agent, MCP_ENDPOINT);
|
|
14954
|
+
const infoContent = generateInfoSection(agent, MCP_ENDPOINT, sdkVersion);
|
|
14924
14955
|
if (infoContent !== "") {
|
|
14925
14956
|
await injectInfoSection(agent, infoContent, projectRoot);
|
|
14926
14957
|
}
|