@agent-inspect/mcp-server 6.28.0 → 6.29.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.
@@ -341,6 +341,8 @@ function isPersistedTokenUsage(value) {
341
341
  if (!isOptionalNonNegativeNumber(value.output)) return false;
342
342
  if (!isOptionalNonNegativeNumber(value.total)) return false;
343
343
  if (!isOptionalNonNegativeNumber(value.cached)) return false;
344
+ if (!isOptionalNonNegativeNumber(value.cacheWrite)) return false;
345
+ if (!isOptionalNonNegativeNumber(value.reasoning)) return false;
344
346
  return true;
345
347
  }
346
348
  function isPersistedTraceContext(value) {
@@ -1243,7 +1245,13 @@ function buildRunSummary(events) {
1243
1245
  tokensInput: isNonNegativeFiniteNumber(s.metadata?.tokens?.input) ? s.metadata.tokens.input : void 0,
1244
1246
  tokensOutput: isNonNegativeFiniteNumber(s.metadata?.tokens?.output) ? s.metadata.tokens.output : void 0,
1245
1247
  tokensTotal: isNonNegativeFiniteNumber(s.metadata?.tokens?.total) ? s.metadata.tokens.total : void 0,
1246
- tokensCached: isNonNegativeFiniteNumber(s.metadata?.tokens?.cached) ? s.metadata.tokens.cached : void 0
1248
+ tokensCached: isNonNegativeFiniteNumber(s.metadata?.tokens?.cached) ? s.metadata.tokens.cached : void 0,
1249
+ tokensCacheWrite: isNonNegativeFiniteNumber(
1250
+ s.metadata?.tokens?.cacheWrite
1251
+ ) ? s.metadata.tokens.cacheWrite : void 0,
1252
+ tokensReasoning: isNonNegativeFiniteNumber(
1253
+ s.metadata?.tokens?.reasoning
1254
+ ) ? s.metadata.tokens.reasoning : void 0
1247
1255
  });
1248
1256
  }
1249
1257
  }
@@ -1267,9 +1275,13 @@ function buildRunSummary(events) {
1267
1275
  let totalTokensOutput = 0;
1268
1276
  let totalTokensTotal = 0;
1269
1277
  let totalTokensCached = 0;
1278
+ let totalTokensCacheWrite = 0;
1279
+ let totalTokensReasoning = 0;
1270
1280
  let tokenBearingSteps = 0;
1271
1281
  let stepsWithKnownTotal = 0;
1272
1282
  let hasCachedTokens = false;
1283
+ let hasCacheWriteTokens = false;
1284
+ let hasReasoningTokens = false;
1273
1285
  const depthCache = /* @__PURE__ */ new Map();
1274
1286
  for (const [id, s] of steps.entries()) {
1275
1287
  totalSteps += 1;
@@ -1284,7 +1296,7 @@ function buildRunSummary(events) {
1284
1296
  longestStep = { name: s.name, durationMs: s.durationMs, type: s.type };
1285
1297
  }
1286
1298
  }
1287
- if (s.tokensInput !== void 0 || s.tokensOutput !== void 0 || s.tokensTotal !== void 0 || s.tokensCached !== void 0) {
1299
+ if (s.tokensInput !== void 0 || s.tokensOutput !== void 0 || s.tokensTotal !== void 0 || s.tokensCached !== void 0 || s.tokensCacheWrite !== void 0 || s.tokensReasoning !== void 0) {
1288
1300
  tokenBearingSteps += 1;
1289
1301
  if (s.tokensInput !== void 0) totalTokensInput += s.tokensInput;
1290
1302
  if (s.tokensOutput !== void 0) totalTokensOutput += s.tokensOutput;
@@ -1299,6 +1311,14 @@ function buildRunSummary(events) {
1299
1311
  totalTokensCached += s.tokensCached;
1300
1312
  hasCachedTokens = true;
1301
1313
  }
1314
+ if (s.tokensCacheWrite !== void 0) {
1315
+ totalTokensCacheWrite += s.tokensCacheWrite;
1316
+ hasCacheWriteTokens = true;
1317
+ }
1318
+ if (s.tokensReasoning !== void 0) {
1319
+ totalTokensReasoning += s.tokensReasoning;
1320
+ hasReasoningTokens = true;
1321
+ }
1302
1322
  }
1303
1323
  }
1304
1324
  const summary = {
@@ -1318,7 +1338,9 @@ function buildRunSummary(events) {
1318
1338
  input: totalTokensInput,
1319
1339
  output: totalTokensOutput,
1320
1340
  ...stepsWithKnownTotal === tokenBearingSteps ? { total: totalTokensTotal } : {},
1321
- ...hasCachedTokens ? { cached: totalTokensCached } : {}
1341
+ ...hasCachedTokens ? { cached: totalTokensCached } : {},
1342
+ ...hasCacheWriteTokens ? { cacheWrite: totalTokensCacheWrite } : {},
1343
+ ...hasReasoningTokens ? { reasoning: totalTokensReasoning } : {}
1322
1344
  }
1323
1345
  } : {}
1324
1346
  };
@@ -1589,6 +1611,12 @@ function renderRunWhat(summary, options = {}) {
1589
1611
  if (summary.totalTokens.cached !== void 0) {
1590
1612
  tokenParts.push(`${summary.totalTokens.cached} cached`);
1591
1613
  }
1614
+ if (summary.totalTokens.cacheWrite !== void 0) {
1615
+ tokenParts.push(`${summary.totalTokens.cacheWrite} cache-write`);
1616
+ }
1617
+ if (summary.totalTokens.reasoning !== void 0) {
1618
+ tokenParts.push(`${summary.totalTokens.reasoning} reasoning`);
1619
+ }
1592
1620
  lines.push(`Tokens: ${tokenParts.join(" / ")}`);
1593
1621
  }
1594
1622
  if (showCorrelation && summary.correlation) {
@@ -3261,6 +3289,9 @@ var SAFE_USAGE_LEAF_KEYS = /* @__PURE__ */ new Set([
3261
3289
  "output",
3262
3290
  "total",
3263
3291
  "cached",
3292
+ "cachewrite",
3293
+ "cache_write",
3294
+ "reasoning",
3264
3295
  "input_tokens",
3265
3296
  "inputtokens",
3266
3297
  "output_tokens",
@@ -3270,7 +3301,13 @@ var SAFE_USAGE_LEAF_KEYS = /* @__PURE__ */ new Set([
3270
3301
  "prompt_tokens",
3271
3302
  "prompttokens",
3272
3303
  "completion_tokens",
3273
- "completiontokens"
3304
+ "completiontokens",
3305
+ "cache_read",
3306
+ "cacheread",
3307
+ "cache_creation",
3308
+ "cachecreation",
3309
+ "reasoning_tokens",
3310
+ "reasoningtokens"
3274
3311
  ]);
3275
3312
  var DEFAULT_SECRET_PATTERNS = [
3276
3313
  { id: "bearer-token", pattern: /Bearer\s+[A-Za-z0-9._~+/-]{12,}=*/ },
@@ -4409,16 +4446,20 @@ function normalizeTokenUsage(value) {
4409
4446
  const output = nonNegativeFinite(value.output);
4410
4447
  const suppliedTotal = nonNegativeFinite(value.total);
4411
4448
  const cached = nonNegativeFinite(value.cached);
4449
+ const cacheWrite = nonNegativeFinite(value.cacheWrite);
4450
+ const reasoning = nonNegativeFinite(value.reasoning);
4412
4451
  const derivedTotal = input !== void 0 && output !== void 0 && Number.isFinite(input + output) ? input + output : void 0;
4413
4452
  const total = suppliedTotal ?? derivedTotal;
4414
- if (input === void 0 && output === void 0 && total === void 0 && cached === void 0) {
4453
+ if (input === void 0 && output === void 0 && total === void 0 && cached === void 0 && cacheWrite === void 0 && reasoning === void 0) {
4415
4454
  return void 0;
4416
4455
  }
4417
4456
  return {
4418
4457
  ...input !== void 0 ? { input } : {},
4419
4458
  ...output !== void 0 ? { output } : {},
4420
4459
  ...total !== void 0 ? { total } : {},
4421
- ...cached !== void 0 ? { cached } : {}
4460
+ ...cached !== void 0 ? { cached } : {},
4461
+ ...cacheWrite !== void 0 ? { cacheWrite } : {},
4462
+ ...reasoning !== void 0 ? { reasoning } : {}
4422
4463
  };
4423
4464
  }
4424
4465
 
@@ -5577,6 +5618,8 @@ function readOpenInferenceTokenUsage(attributes) {
5577
5618
  const completion = attributes["llm.token_count.completion"];
5578
5619
  const total = attributes["llm.token_count.total"];
5579
5620
  const cached = attributes["llm.token_count.prompt_details.cache_read"];
5621
+ const cacheWrite = attributes["llm.token_count.prompt_details.cache_write"] ?? attributes["llm.token_count.prompt_details.cache_creation"];
5622
+ const reasoning = attributes["llm.token_count.completion_details.reasoning"] ?? attributes["llm.token_count.completion_details.reasoning_tokens"];
5580
5623
  const usage = {};
5581
5624
  if (typeof prompt === "number" && Number.isFinite(prompt) && prompt >= 0) {
5582
5625
  usage.input = prompt;
@@ -5590,6 +5633,12 @@ function readOpenInferenceTokenUsage(attributes) {
5590
5633
  if (typeof cached === "number" && Number.isFinite(cached) && cached >= 0) {
5591
5634
  usage.cached = cached;
5592
5635
  }
5636
+ if (typeof cacheWrite === "number" && Number.isFinite(cacheWrite) && cacheWrite >= 0) {
5637
+ usage.cacheWrite = cacheWrite;
5638
+ }
5639
+ if (typeof reasoning === "number" && Number.isFinite(reasoning) && reasoning >= 0) {
5640
+ usage.reasoning = reasoning;
5641
+ }
5593
5642
  if (usage.total === void 0 && usage.input !== void 0 && usage.output !== void 0) {
5594
5643
  usage.total = usage.input + usage.output;
5595
5644
  }
@@ -8655,5 +8704,5 @@ async function runReadOnlyMcpServer(options = {}) {
8655
8704
  }
8656
8705
 
8657
8706
  export { MCP_MAX_REQUEST_BYTES, MCP_PROTOCOL_VERSION, MCP_SERVER_INSTRUCTIONS, READ_ONLY_TOOLS, TRACE_DATA_UNTRUSTED_WARNING, callReadOnlyTool, createMcpServerContext, handleMcpProtocolLine, runReadOnlyMcpServer };
8658
- //# sourceMappingURL=chunk-V6J5UBTW.mjs.map
8659
- //# sourceMappingURL=chunk-V6J5UBTW.mjs.map
8707
+ //# sourceMappingURL=chunk-BLLG3Q4N.mjs.map
8708
+ //# sourceMappingURL=chunk-BLLG3Q4N.mjs.map