@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.
Files changed (81) hide show
  1. package/README.md +124 -0
  2. package/dist/capture-error-BmQz7xF6.d.cts +455 -0
  3. package/dist/capture-error-CTgSYxek.d.ts +455 -0
  4. package/dist/{chunk-XS5W3SPL.js → chunk-4WI7B5FQ.js} +91 -5
  5. package/dist/chunk-4WI7B5FQ.js.map +1 -0
  6. package/dist/{chunk-JZ475QRH.js → chunk-D3QXU2VM.js} +22 -191
  7. package/dist/chunk-D3QXU2VM.js.map +1 -0
  8. package/dist/{chunk-GYTCZSAV.js → chunk-MFYOQOD7.js} +2 -2
  9. package/dist/{chunk-4WUHMLMM.js → chunk-MMKFFF2L.js} +2 -2
  10. package/dist/{chunk-JH7EGRC5.js → chunk-N3XIVM2U.js} +158 -12
  11. package/dist/chunk-N3XIVM2U.js.map +1 -0
  12. package/dist/{chunk-FKBCEOJ5.js → chunk-Q42BY5BA.js} +2 -2
  13. package/dist/{chunk-DBKG6SRI.js → chunk-QU26IKIJ.js} +2 -2
  14. package/dist/{chunk-ADUD4PEK.js → chunk-TANUWTFO.js} +3 -3
  15. package/dist/{chunk-LJMZXJ45.js → chunk-YLY7AGLC.js} +9 -6
  16. package/dist/chunk-YLY7AGLC.js.map +1 -0
  17. package/dist/chunk-ZBQQXVHD.js +208 -0
  18. package/dist/chunk-ZBQQXVHD.js.map +1 -0
  19. package/dist/cli/init.cjs +218 -35
  20. package/dist/cli/init.cjs.map +1 -1
  21. package/dist/cli/init.js +69 -12
  22. package/dist/cli/init.js.map +1 -1
  23. package/dist/cli/mcp-add.cjs +57 -26
  24. package/dist/cli/mcp-add.cjs.map +1 -1
  25. package/dist/cli/mcp-add.js +12 -9
  26. package/dist/cli/mcp-add.js.map +1 -1
  27. package/dist/cli/status.cjs +33 -3
  28. package/dist/cli/status.cjs.map +1 -1
  29. package/dist/cli/status.js +12 -3
  30. package/dist/cli/status.js.map +1 -1
  31. package/dist/cli/uninit.cjs +27 -3
  32. package/dist/cli/uninit.cjs.map +1 -1
  33. package/dist/cli/uninit.d.cts +10 -2
  34. package/dist/cli/uninit.d.ts +10 -2
  35. package/dist/cli/uninit.js +4 -3
  36. package/dist/cli/upgrade-instructions.cjs +440 -0
  37. package/dist/cli/upgrade-instructions.cjs.map +1 -0
  38. package/dist/cli/upgrade-instructions.d.cts +48 -0
  39. package/dist/cli/upgrade-instructions.d.ts +48 -0
  40. package/dist/cli/upgrade-instructions.js +80 -0
  41. package/dist/cli/upgrade-instructions.js.map +1 -0
  42. package/dist/cli/validate.cjs +12 -1
  43. package/dist/cli/validate.cjs.map +1 -1
  44. package/dist/cli/validate.js +2 -2
  45. package/dist/{edge-entry-BSKA1l_0.d.ts → edge-entry-AWO70gje.d.ts} +1 -1
  46. package/dist/{edge-entry-DyMWa6JK.d.cts → edge-entry-DaeG7D7S.d.cts} +1 -1
  47. package/dist/edge-entry.cjs +43 -2
  48. package/dist/edge-entry.cjs.map +1 -1
  49. package/dist/edge-entry.d.cts +2 -2
  50. package/dist/edge-entry.d.ts +2 -2
  51. package/dist/edge-entry.js +2 -2
  52. package/dist/index.cjs +594 -64
  53. package/dist/index.cjs.map +1 -1
  54. package/dist/{index.d-Bo_Rxund.d.cts → index.d-Dq33YwFT.d.cts} +91 -1
  55. package/dist/{index.d-Bo_Rxund.d.ts → index.d-Dq33YwFT.d.ts} +91 -1
  56. package/dist/index.d.cts +91 -431
  57. package/dist/index.d.ts +91 -431
  58. package/dist/index.js +291 -6
  59. package/dist/index.js.map +1 -1
  60. package/dist/node-entry.cjs +282 -71
  61. package/dist/node-entry.cjs.map +1 -1
  62. package/dist/node-entry.d.cts +3 -3
  63. package/dist/node-entry.d.ts +3 -3
  64. package/dist/node-entry.js +8 -7
  65. package/dist/node-subpath.cjs +12 -1
  66. package/dist/node-subpath.cjs.map +1 -1
  67. package/dist/node-subpath.d.cts +1 -1
  68. package/dist/node-subpath.d.ts +1 -1
  69. package/dist/node-subpath.js +3 -3
  70. package/dist/{source-map-uploader-FSTHCYDR.js → source-map-uploader-PB3M4PPP.js} +3 -3
  71. package/package.json +1 -1
  72. package/dist/chunk-JH7EGRC5.js.map +0 -1
  73. package/dist/chunk-JZ475QRH.js.map +0 -1
  74. package/dist/chunk-LJMZXJ45.js.map +0 -1
  75. package/dist/chunk-XS5W3SPL.js.map +0 -1
  76. /package/dist/{chunk-GYTCZSAV.js.map → chunk-MFYOQOD7.js.map} +0 -0
  77. /package/dist/{chunk-4WUHMLMM.js.map → chunk-MMKFFF2L.js.map} +0 -0
  78. /package/dist/{chunk-FKBCEOJ5.js.map → chunk-Q42BY5BA.js.map} +0 -0
  79. /package/dist/{chunk-DBKG6SRI.js.map → chunk-QU26IKIJ.js.map} +0 -0
  80. /package/dist/{chunk-ADUD4PEK.js.map → chunk-TANUWTFO.js.map} +0 -0
  81. /package/dist/{source-map-uploader-FSTHCYDR.js.map → source-map-uploader-PB3M4PPP.js.map} +0 -0
package/dist/cli/init.cjs CHANGED
@@ -14482,7 +14482,18 @@ var init_dist = __esm({
14482
14482
  fullConsoleOutput: external_exports.boolean(),
14483
14483
  importGraph: external_exports.boolean(),
14484
14484
  consoleErrors: external_exports.boolean().optional().default(false),
14485
- errorResponseBodies: external_exports.boolean().optional().default(false)
14485
+ errorResponseBodies: external_exports.boolean().optional().default(false),
14486
+ /**
14487
+ * Account opt-in for side-effect evidence emission (SDK-049).
14488
+ *
14489
+ * When `false` (default), `recordSideEffect()` is a silent no-op:
14490
+ * no allowlist evaluation runs and no `glasstrace.side_effect.*`
14491
+ * attribute reaches the wire. When `true`, allowlisted side-effect
14492
+ * metadata is attached to the active OTel span subject to the
14493
+ * client-side allowlist enforcement layered with the product's
14494
+ * storage-time filter as defense-in-depth.
14495
+ */
14496
+ sideEffectEvidence: external_exports.boolean().optional().default(false)
14486
14497
  });
14487
14498
  SdkCachedConfigSchema = external_exports.object({
14488
14499
  response: external_exports.record(external_exports.string(), external_exports.unknown()),
@@ -15392,28 +15403,38 @@ function generateMcpConfig(agent, endpoint, bearer) {
15392
15403
  }
15393
15404
  }
15394
15405
  }
15395
- function htmlMarkers() {
15406
+ function htmlMarkers(sdkVersion) {
15396
15407
  return {
15397
- start: "<!-- glasstrace:mcp:start -->",
15408
+ start: `<!-- glasstrace:mcp:start v=${sdkVersion} -->`,
15398
15409
  end: "<!-- glasstrace:mcp:end -->"
15399
15410
  };
15400
15411
  }
15401
- function hashMarkers() {
15412
+ function hashMarkers(sdkVersion) {
15402
15413
  return {
15403
- start: "# glasstrace:mcp:start",
15414
+ start: `# glasstrace:mcp:start v=${sdkVersion}`,
15404
15415
  end: "# glasstrace:mcp:end"
15405
15416
  };
15406
15417
  }
15407
- function generateInfoSection(agent, endpoint) {
15418
+ function generateInfoSection(agent, endpoint, sdkVersion) {
15408
15419
  if (!endpoint || endpoint.trim() === "") {
15409
15420
  throw new Error("endpoint must not be empty");
15410
15421
  }
15422
+ if (!sdkVersion || sdkVersion.trim() === "") {
15423
+ throw new Error("sdkVersion must not be empty");
15424
+ }
15425
+ if (!SDK_VERSION_STAMP_PATTERN.test(sdkVersion)) {
15426
+ throw new Error(
15427
+ "sdkVersion must match [A-Za-z0-9.+\\-]+ (semver-shaped, no whitespace, no angle brackets)"
15428
+ );
15429
+ }
15411
15430
  const content = [
15412
15431
  "",
15413
15432
  "## Glasstrace MCP Integration",
15414
15433
  "",
15415
15434
  `Glasstrace is configured as an MCP server at: ${endpoint}`,
15416
15435
  "",
15436
+ "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.",
15437
+ "",
15417
15438
  "Available tools:",
15418
15439
  "- `get_latest_error` - Get the most recent error trace from the current session",
15419
15440
  "- `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.",
@@ -15423,24 +15444,24 @@ function generateInfoSection(agent, endpoint) {
15423
15444
  "- `get_test_suggestions` - Get test suggestions based on recent errors",
15424
15445
  "- `get_session_timeline` - Get the timeline of all traces in the current session",
15425
15446
  "",
15426
- "To reconfigure, run: `npx glasstrace mcp add`",
15447
+ "To refresh this managed section after a `@glasstrace/sdk` upgrade, run: `npx glasstrace upgrade-instructions`. To reconfigure MCP credentials, run: `npx glasstrace mcp add`.",
15427
15448
  ""
15428
15449
  ].join("\n");
15429
15450
  switch (agent.name) {
15430
15451
  case "claude": {
15431
- const m = htmlMarkers();
15452
+ const m = htmlMarkers(sdkVersion);
15432
15453
  return `${m.start}
15433
15454
  ${content}${m.end}
15434
15455
  `;
15435
15456
  }
15436
15457
  case "codex": {
15437
- const m = htmlMarkers();
15458
+ const m = htmlMarkers(sdkVersion);
15438
15459
  return `${m.start}
15439
15460
  ${content}${m.end}
15440
15461
  `;
15441
15462
  }
15442
15463
  case "cursor": {
15443
- const m = hashMarkers();
15464
+ const m = hashMarkers(sdkVersion);
15444
15465
  return `${m.start}
15445
15466
  ${content}${m.end}
15446
15467
  `;
@@ -15455,13 +15476,34 @@ ${content}${m.end}
15455
15476
  }
15456
15477
  }
15457
15478
  }
15479
+ var SDK_VERSION_STAMP_PATTERN;
15458
15480
  var init_configs = __esm({
15459
15481
  "src/agent-detection/configs.ts"() {
15460
15482
  "use strict";
15483
+ SDK_VERSION_STAMP_PATTERN = /^[A-Za-z0-9.+-]+$/;
15461
15484
  }
15462
15485
  });
15463
15486
 
15464
15487
  // src/agent-detection/inject.ts
15488
+ function parseStartMarkerLine(line) {
15489
+ const trimmed = line.trim();
15490
+ const html = HTML_START_RE.exec(trimmed);
15491
+ if (html !== null) {
15492
+ return { kind: "html", stamp: html[1] ?? null };
15493
+ }
15494
+ const hash2 = HASH_START_RE.exec(trimmed);
15495
+ if (hash2 !== null) {
15496
+ return { kind: "hash", stamp: hash2[1] ?? null };
15497
+ }
15498
+ return null;
15499
+ }
15500
+ function isEndMarker(line) {
15501
+ const trimmed = line.trim();
15502
+ return trimmed === HTML_END || trimmed === HASH_END;
15503
+ }
15504
+ function isEndMarkerLine(line) {
15505
+ return isEndMarker(line);
15506
+ }
15465
15507
  function isPermissionError(err) {
15466
15508
  const code = err.code;
15467
15509
  return code === "EACCES" || code === "EPERM" || code === "EROFS";
@@ -15503,22 +15545,14 @@ async function writeMcpConfig(agent, content, projectRoot) {
15503
15545
  }
15504
15546
  function findMarkerBoundaries(lines) {
15505
15547
  let startIdx = -1;
15506
- let endIdx = -1;
15507
15548
  for (let i = 0; i < lines.length; i++) {
15508
- const trimmed = lines[i].trim();
15509
- if (trimmed === HTML_START || trimmed === HASH_START) {
15549
+ if (parseStartMarkerLine(lines[i]) !== null) {
15510
15550
  startIdx = i;
15511
- } else if (trimmed === HTML_END || trimmed === HASH_END) {
15512
- if (startIdx !== -1) {
15513
- endIdx = i;
15514
- break;
15515
- }
15551
+ } else if (startIdx !== -1 && isEndMarker(lines[i])) {
15552
+ return { startIdx, endIdx: i };
15516
15553
  }
15517
15554
  }
15518
- if (startIdx === -1 || endIdx === -1) {
15519
- return null;
15520
- }
15521
- return { startIdx, endIdx };
15555
+ return null;
15522
15556
  }
15523
15557
  async function injectInfoSection(agent, content, projectRoot) {
15524
15558
  if (agent.infoFilePath === null) {
@@ -15585,6 +15619,17 @@ async function injectInfoSection(agent, content, projectRoot) {
15585
15619
  throw err;
15586
15620
  }
15587
15621
  }
15622
+ async function hasManagedSection(filePath) {
15623
+ let content;
15624
+ try {
15625
+ content = await (0, import_promises2.readFile)(filePath, "utf-8");
15626
+ } catch (err) {
15627
+ const code = err.code;
15628
+ if (code === "ENOENT") return false;
15629
+ throw err;
15630
+ }
15631
+ return findMarkerBoundaries(content.split("\n")) !== null;
15632
+ }
15588
15633
  async function updateGitignore(paths, projectRoot) {
15589
15634
  const gitignorePath = (0, import_node_path2.join)(projectRoot, ".gitignore");
15590
15635
  const relativePaths = paths.filter((p) => !(0, import_node_path2.isAbsolute)(p));
@@ -15631,15 +15676,15 @@ async function updateGitignore(paths, projectRoot) {
15631
15676
  throw err;
15632
15677
  }
15633
15678
  }
15634
- var import_promises2, import_node_path2, HTML_START, HTML_END, HASH_START, HASH_END;
15679
+ var import_promises2, import_node_path2, HTML_START_RE, HTML_END, HASH_START_RE, HASH_END;
15635
15680
  var init_inject = __esm({
15636
15681
  "src/agent-detection/inject.ts"() {
15637
15682
  "use strict";
15638
15683
  import_promises2 = require("node:fs/promises");
15639
15684
  import_node_path2 = require("node:path");
15640
- HTML_START = "<!-- glasstrace:mcp:start -->";
15685
+ HTML_START_RE = /^<!--\s*glasstrace:mcp:start(?:\s+v=([^\s>]+))?\s*-->$/;
15641
15686
  HTML_END = "<!-- glasstrace:mcp:end -->";
15642
- HASH_START = "# glasstrace:mcp:start";
15687
+ HASH_START_RE = /^#\s*glasstrace:mcp:start(?:\s+v=(\S+))?$/;
15643
15688
  HASH_END = "# glasstrace:mcp:end";
15644
15689
  }
15645
15690
  });
@@ -16339,10 +16384,9 @@ function removeMarkerSection(content) {
16339
16384
  let startIdx = -1;
16340
16385
  let endIdx = -1;
16341
16386
  for (let i = 0; i < lines.length; i++) {
16342
- const trimmed = lines[i].trim();
16343
- if (trimmed === "<!-- glasstrace:mcp:start -->" || trimmed === "# glasstrace:mcp:start") {
16387
+ if (parseStartMarkerLine(lines[i]) !== null) {
16344
16388
  startIdx = i;
16345
- } else if ((trimmed === "<!-- glasstrace:mcp:end -->" || trimmed === "# glasstrace:mcp:end") && startIdx !== -1) {
16389
+ } else if (isEndMarkerLine(lines[i]) && startIdx !== -1) {
16346
16390
  endIdx = i;
16347
16391
  break;
16348
16392
  }
@@ -16794,6 +16838,7 @@ var init_uninit = __esm({
16794
16838
  init_mcp_runtime();
16795
16839
  init_atomic_write();
16796
16840
  init_discovery_file();
16841
+ init_inject();
16797
16842
  MCP_CONFIG_FILES = [".mcp.json", ".cursor/mcp.json", ".gemini/settings.json"];
16798
16843
  AGENT_INFO_FILES = [
16799
16844
  "CLAUDE.md",
@@ -16949,10 +16994,11 @@ async function mcpAdd(options) {
16949
16994
  const bearer = resolved.effective.key;
16950
16995
  for (const agent of targetAgents) {
16951
16996
  const name = formatAgentName(agent.name);
16997
+ const sdkVersion = true ? "1.5.0" : "0.0.0-dev";
16952
16998
  if (agent.name !== "generic") {
16953
16999
  const cliSuccess = await registerViaCli(agent, bearer);
16954
17000
  if (cliSuccess) {
16955
- const infoContent = generateInfoSection(agent, MCP_ENDPOINT);
17001
+ const infoContent = generateInfoSection(agent, MCP_ENDPOINT, sdkVersion);
16956
17002
  if (infoContent !== "") {
16957
17003
  await injectInfoSection(agent, infoContent, projectRoot);
16958
17004
  }
@@ -16970,7 +17016,7 @@ async function mcpAdd(options) {
16970
17016
  const configContent = generateMcpConfig(agent, MCP_ENDPOINT, bearer);
16971
17017
  await writeMcpConfig(agent, configContent, projectRoot);
16972
17018
  if (fs6.existsSync(agent.mcpConfigPath)) {
16973
- const infoContent = generateInfoSection(agent, MCP_ENDPOINT);
17019
+ const infoContent = generateInfoSection(agent, MCP_ENDPOINT, sdkVersion);
16974
17020
  if (infoContent !== "") {
16975
17021
  await injectInfoSection(agent, infoContent, projectRoot);
16976
17022
  }
@@ -17190,6 +17236,82 @@ var init_validate = __esm({
17190
17236
  }
17191
17237
  });
17192
17238
 
17239
+ // src/cli/upgrade-instructions.ts
17240
+ var upgrade_instructions_exports = {};
17241
+ __export(upgrade_instructions_exports, {
17242
+ runUpgradeInstructions: () => runUpgradeInstructions
17243
+ });
17244
+ function formatPathForOutput(filePath, projectRoot) {
17245
+ const rel = (0, import_node_path3.relative)(projectRoot, filePath);
17246
+ if (rel === "" || rel.startsWith("..") || (0, import_node_path3.isAbsolute)(rel)) {
17247
+ return filePath;
17248
+ }
17249
+ return rel;
17250
+ }
17251
+ async function runUpgradeInstructions(options) {
17252
+ const refreshed = [];
17253
+ const skipped = [];
17254
+ const warnings = [];
17255
+ const errors = [];
17256
+ let agents;
17257
+ try {
17258
+ agents = await detectAgents(options.projectRoot);
17259
+ } catch (err) {
17260
+ errors.push(
17261
+ `Failed to detect agents: ${err instanceof Error ? err.message : String(err)}`
17262
+ );
17263
+ return { exitCode: 1, refreshed, skipped, warnings, errors };
17264
+ }
17265
+ const sdkVersion = true ? "1.5.0" : "0.0.0-dev";
17266
+ for (const agent of agents) {
17267
+ if (agent.infoFilePath === null) {
17268
+ continue;
17269
+ }
17270
+ const displayPath = formatPathForOutput(
17271
+ agent.infoFilePath,
17272
+ options.projectRoot
17273
+ );
17274
+ let containsSection;
17275
+ try {
17276
+ containsSection = await hasManagedSection(agent.infoFilePath);
17277
+ } catch (err) {
17278
+ warnings.push(
17279
+ `Could not inspect ${displayPath}: ${err instanceof Error ? err.message : String(err)}`
17280
+ );
17281
+ continue;
17282
+ }
17283
+ if (!containsSection) {
17284
+ skipped.push(displayPath);
17285
+ continue;
17286
+ }
17287
+ const content = generateInfoSection(agent, MCP_ENDPOINT, sdkVersion);
17288
+ if (content === "") {
17289
+ continue;
17290
+ }
17291
+ try {
17292
+ await injectInfoSection(agent, content, options.projectRoot);
17293
+ refreshed.push(displayPath);
17294
+ } catch (err) {
17295
+ errors.push(
17296
+ `Failed to refresh ${displayPath}: ${err instanceof Error ? err.message : String(err)}`
17297
+ );
17298
+ }
17299
+ }
17300
+ const exitCode = errors.length === 0 ? 0 : 1;
17301
+ return { exitCode, refreshed, skipped, warnings, errors };
17302
+ }
17303
+ var import_node_path3;
17304
+ var init_upgrade_instructions = __esm({
17305
+ "src/cli/upgrade-instructions.ts"() {
17306
+ "use strict";
17307
+ import_node_path3 = require("node:path");
17308
+ init_mcp_runtime();
17309
+ init_detect();
17310
+ init_configs();
17311
+ init_inject();
17312
+ }
17313
+ });
17314
+
17193
17315
  // src/cli/status.ts
17194
17316
  var status_exports = {};
17195
17317
  __export(status_exports, {
@@ -17286,9 +17408,14 @@ function checkAgents(root) {
17286
17408
  for (const name of AGENT_INFO_FILES2) {
17287
17409
  try {
17288
17410
  const content = fs8.readFileSync(path8.join(root, name), "utf-8");
17289
- const hasHtmlMarkers = content.includes("<!-- glasstrace:mcp:start -->") && content.includes("<!-- glasstrace:mcp:end -->");
17290
- const hasHashMarkers = content.includes("# glasstrace:mcp:start") && content.includes("# glasstrace:mcp:end");
17291
- if (hasHtmlMarkers || hasHashMarkers) {
17411
+ let hasStart = false;
17412
+ let hasEnd = false;
17413
+ for (const line of content.split("\n")) {
17414
+ if (parseStartMarkerLine(line) !== null) hasStart = true;
17415
+ else if (isEndMarkerLine(line)) hasEnd = true;
17416
+ if (hasStart && hasEnd) break;
17417
+ }
17418
+ if (hasStart && hasEnd) {
17292
17419
  found.push(name);
17293
17420
  }
17294
17421
  } catch {
@@ -17365,6 +17492,7 @@ var init_status = __esm({
17365
17492
  fs8 = __toESM(require("node:fs"), 1);
17366
17493
  path8 = __toESM(require("node:path"), 1);
17367
17494
  init_constants();
17495
+ init_inject();
17368
17496
  MCP_JSON_FILES = [".mcp.json", ".cursor/mcp.json", ".gemini/settings.json", ".glasstrace/mcp.json"];
17369
17497
  MCP_TOML_FILES = [".codex/config.toml"];
17370
17498
  AGENT_INFO_FILES2 = [
@@ -18770,7 +18898,12 @@ Then add this as the first statement in your register() function:
18770
18898
  }
18771
18899
  anyConfigWritten = true;
18772
18900
  anyConfigRewrittenWithBearer = true;
18773
- const infoContent = generateInfoSection(agent, MCP_ENDPOINT);
18901
+ const sdkVersionForInject = true ? "1.5.0" : "0.0.0-dev";
18902
+ const infoContent = generateInfoSection(
18903
+ agent,
18904
+ MCP_ENDPOINT,
18905
+ sdkVersionForInject
18906
+ );
18774
18907
  if (infoContent !== "") {
18775
18908
  await injectInfoSection(agent, infoContent, projectRoot);
18776
18909
  }
@@ -18868,7 +19001,7 @@ async function verifyAnonKeyRegistration(projectRoot) {
18868
19001
  }
18869
19002
  const baseConfig = resolveConfig({ apiKey: devKey });
18870
19003
  const config2 = { ...baseConfig, apiKey: devKey };
18871
- const sdkVersion = true ? "1.3.9" : "0.0.0-dev";
19004
+ const sdkVersion = true ? "1.5.0" : "0.0.0-dev";
18872
19005
  const result = await verifyInitReachable(config2, anonKey, sdkVersion);
18873
19006
  if (result.ok) {
18874
19007
  return { outcome: "verified" };
@@ -19057,6 +19190,55 @@ Usage: glasstrace mcp add [--force] [--dry-run]
19057
19190
  }).catch((err) => {
19058
19191
  process.stderr.write(
19059
19192
  `Fatal error: ${err instanceof Error ? err.message : String(err)}
19193
+ `
19194
+ );
19195
+ process.exit(1);
19196
+ });
19197
+ } else if (subcommand === "upgrade-instructions") {
19198
+ Promise.all([
19199
+ Promise.resolve().then(() => (init_upgrade_instructions(), upgrade_instructions_exports)),
19200
+ Promise.resolve().then(() => (init_monorepo(), monorepo_exports))
19201
+ ]).then(([{ runUpgradeInstructions: runUpgradeInstructions2 }, { resolveProjectRoot: resolve2 }]) => {
19202
+ let projectRoot = process.cwd();
19203
+ try {
19204
+ projectRoot = resolve2(projectRoot).projectRoot;
19205
+ } catch {
19206
+ }
19207
+ return runUpgradeInstructions2({ projectRoot });
19208
+ }).then((result) => {
19209
+ for (const err of result.errors) {
19210
+ process.stderr.write(`Error: ${err}
19211
+ `);
19212
+ }
19213
+ for (const warn of result.warnings) {
19214
+ process.stderr.write(`Warning: ${warn}
19215
+ `);
19216
+ }
19217
+ if (result.refreshed.length > 0) {
19218
+ process.stderr.write("\nRefreshed agent instruction files:\n");
19219
+ for (const file2 of result.refreshed) {
19220
+ process.stderr.write(` - ${file2}
19221
+ `);
19222
+ }
19223
+ }
19224
+ if (result.skipped.length > 0) {
19225
+ process.stderr.write(
19226
+ "\nSkipped (no Glasstrace managed section present):\n"
19227
+ );
19228
+ for (const file2 of result.skipped) {
19229
+ process.stderr.write(` - ${file2}
19230
+ `);
19231
+ }
19232
+ }
19233
+ if (result.refreshed.length === 0 && result.skipped.length === 0 && result.errors.length === 0) {
19234
+ process.stderr.write(
19235
+ "\nNo agent instruction files detected with a Glasstrace managed section. Run `npx glasstrace init` or `npx glasstrace mcp add` to install one.\n"
19236
+ );
19237
+ }
19238
+ process.exit(result.exitCode);
19239
+ }).catch((err) => {
19240
+ process.stderr.write(
19241
+ `Fatal error: ${err instanceof Error ? err.message : String(err)}
19060
19242
  `
19061
19243
  );
19062
19244
  process.exit(1);
@@ -19110,6 +19292,7 @@ Usage:
19110
19292
  glasstrace uninit [--dry-run] [--force]
19111
19293
  glasstrace status [--json]
19112
19294
  glasstrace mcp add [--force] [--dry-run]
19295
+ glasstrace upgrade-instructions
19113
19296
  `
19114
19297
  );
19115
19298
  process.exit(1);