@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.
- package/dist/{chunk-V6J5UBTW.mjs → chunk-BLLG3Q4N.mjs} +57 -8
- package/dist/chunk-BLLG3Q4N.mjs.map +1 -0
- package/dist/cli.cjs +55 -6
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.mjs +1 -1
- package/dist/index.cjs +55 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +3 -3
- package/dist/chunk-V6J5UBTW.mjs.map +0 -1
package/dist/cli.mjs
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -351,6 +351,8 @@ function isPersistedTokenUsage(value) {
|
|
|
351
351
|
if (!isOptionalNonNegativeNumber(value.output)) return false;
|
|
352
352
|
if (!isOptionalNonNegativeNumber(value.total)) return false;
|
|
353
353
|
if (!isOptionalNonNegativeNumber(value.cached)) return false;
|
|
354
|
+
if (!isOptionalNonNegativeNumber(value.cacheWrite)) return false;
|
|
355
|
+
if (!isOptionalNonNegativeNumber(value.reasoning)) return false;
|
|
354
356
|
return true;
|
|
355
357
|
}
|
|
356
358
|
function isPersistedTraceContext(value) {
|
|
@@ -1253,7 +1255,13 @@ function buildRunSummary(events) {
|
|
|
1253
1255
|
tokensInput: isNonNegativeFiniteNumber(s.metadata?.tokens?.input) ? s.metadata.tokens.input : void 0,
|
|
1254
1256
|
tokensOutput: isNonNegativeFiniteNumber(s.metadata?.tokens?.output) ? s.metadata.tokens.output : void 0,
|
|
1255
1257
|
tokensTotal: isNonNegativeFiniteNumber(s.metadata?.tokens?.total) ? s.metadata.tokens.total : void 0,
|
|
1256
|
-
tokensCached: isNonNegativeFiniteNumber(s.metadata?.tokens?.cached) ? s.metadata.tokens.cached : void 0
|
|
1258
|
+
tokensCached: isNonNegativeFiniteNumber(s.metadata?.tokens?.cached) ? s.metadata.tokens.cached : void 0,
|
|
1259
|
+
tokensCacheWrite: isNonNegativeFiniteNumber(
|
|
1260
|
+
s.metadata?.tokens?.cacheWrite
|
|
1261
|
+
) ? s.metadata.tokens.cacheWrite : void 0,
|
|
1262
|
+
tokensReasoning: isNonNegativeFiniteNumber(
|
|
1263
|
+
s.metadata?.tokens?.reasoning
|
|
1264
|
+
) ? s.metadata.tokens.reasoning : void 0
|
|
1257
1265
|
});
|
|
1258
1266
|
}
|
|
1259
1267
|
}
|
|
@@ -1277,9 +1285,13 @@ function buildRunSummary(events) {
|
|
|
1277
1285
|
let totalTokensOutput = 0;
|
|
1278
1286
|
let totalTokensTotal = 0;
|
|
1279
1287
|
let totalTokensCached = 0;
|
|
1288
|
+
let totalTokensCacheWrite = 0;
|
|
1289
|
+
let totalTokensReasoning = 0;
|
|
1280
1290
|
let tokenBearingSteps = 0;
|
|
1281
1291
|
let stepsWithKnownTotal = 0;
|
|
1282
1292
|
let hasCachedTokens = false;
|
|
1293
|
+
let hasCacheWriteTokens = false;
|
|
1294
|
+
let hasReasoningTokens = false;
|
|
1283
1295
|
const depthCache = /* @__PURE__ */ new Map();
|
|
1284
1296
|
for (const [id, s] of steps.entries()) {
|
|
1285
1297
|
totalSteps += 1;
|
|
@@ -1294,7 +1306,7 @@ function buildRunSummary(events) {
|
|
|
1294
1306
|
longestStep = { name: s.name, durationMs: s.durationMs, type: s.type };
|
|
1295
1307
|
}
|
|
1296
1308
|
}
|
|
1297
|
-
if (s.tokensInput !== void 0 || s.tokensOutput !== void 0 || s.tokensTotal !== void 0 || s.tokensCached !== void 0) {
|
|
1309
|
+
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) {
|
|
1298
1310
|
tokenBearingSteps += 1;
|
|
1299
1311
|
if (s.tokensInput !== void 0) totalTokensInput += s.tokensInput;
|
|
1300
1312
|
if (s.tokensOutput !== void 0) totalTokensOutput += s.tokensOutput;
|
|
@@ -1309,6 +1321,14 @@ function buildRunSummary(events) {
|
|
|
1309
1321
|
totalTokensCached += s.tokensCached;
|
|
1310
1322
|
hasCachedTokens = true;
|
|
1311
1323
|
}
|
|
1324
|
+
if (s.tokensCacheWrite !== void 0) {
|
|
1325
|
+
totalTokensCacheWrite += s.tokensCacheWrite;
|
|
1326
|
+
hasCacheWriteTokens = true;
|
|
1327
|
+
}
|
|
1328
|
+
if (s.tokensReasoning !== void 0) {
|
|
1329
|
+
totalTokensReasoning += s.tokensReasoning;
|
|
1330
|
+
hasReasoningTokens = true;
|
|
1331
|
+
}
|
|
1312
1332
|
}
|
|
1313
1333
|
}
|
|
1314
1334
|
const summary = {
|
|
@@ -1328,7 +1348,9 @@ function buildRunSummary(events) {
|
|
|
1328
1348
|
input: totalTokensInput,
|
|
1329
1349
|
output: totalTokensOutput,
|
|
1330
1350
|
...stepsWithKnownTotal === tokenBearingSteps ? { total: totalTokensTotal } : {},
|
|
1331
|
-
...hasCachedTokens ? { cached: totalTokensCached } : {}
|
|
1351
|
+
...hasCachedTokens ? { cached: totalTokensCached } : {},
|
|
1352
|
+
...hasCacheWriteTokens ? { cacheWrite: totalTokensCacheWrite } : {},
|
|
1353
|
+
...hasReasoningTokens ? { reasoning: totalTokensReasoning } : {}
|
|
1332
1354
|
}
|
|
1333
1355
|
} : {}
|
|
1334
1356
|
};
|
|
@@ -1599,6 +1621,12 @@ function renderRunWhat(summary, options = {}) {
|
|
|
1599
1621
|
if (summary.totalTokens.cached !== void 0) {
|
|
1600
1622
|
tokenParts.push(`${summary.totalTokens.cached} cached`);
|
|
1601
1623
|
}
|
|
1624
|
+
if (summary.totalTokens.cacheWrite !== void 0) {
|
|
1625
|
+
tokenParts.push(`${summary.totalTokens.cacheWrite} cache-write`);
|
|
1626
|
+
}
|
|
1627
|
+
if (summary.totalTokens.reasoning !== void 0) {
|
|
1628
|
+
tokenParts.push(`${summary.totalTokens.reasoning} reasoning`);
|
|
1629
|
+
}
|
|
1602
1630
|
lines.push(`Tokens: ${tokenParts.join(" / ")}`);
|
|
1603
1631
|
}
|
|
1604
1632
|
if (showCorrelation && summary.correlation) {
|
|
@@ -3271,6 +3299,9 @@ var SAFE_USAGE_LEAF_KEYS = /* @__PURE__ */ new Set([
|
|
|
3271
3299
|
"output",
|
|
3272
3300
|
"total",
|
|
3273
3301
|
"cached",
|
|
3302
|
+
"cachewrite",
|
|
3303
|
+
"cache_write",
|
|
3304
|
+
"reasoning",
|
|
3274
3305
|
"input_tokens",
|
|
3275
3306
|
"inputtokens",
|
|
3276
3307
|
"output_tokens",
|
|
@@ -3280,7 +3311,13 @@ var SAFE_USAGE_LEAF_KEYS = /* @__PURE__ */ new Set([
|
|
|
3280
3311
|
"prompt_tokens",
|
|
3281
3312
|
"prompttokens",
|
|
3282
3313
|
"completion_tokens",
|
|
3283
|
-
"completiontokens"
|
|
3314
|
+
"completiontokens",
|
|
3315
|
+
"cache_read",
|
|
3316
|
+
"cacheread",
|
|
3317
|
+
"cache_creation",
|
|
3318
|
+
"cachecreation",
|
|
3319
|
+
"reasoning_tokens",
|
|
3320
|
+
"reasoningtokens"
|
|
3284
3321
|
]);
|
|
3285
3322
|
var DEFAULT_SECRET_PATTERNS = [
|
|
3286
3323
|
{ id: "bearer-token", pattern: /Bearer\s+[A-Za-z0-9._~+/-]{12,}=*/ },
|
|
@@ -4419,16 +4456,20 @@ function normalizeTokenUsage(value) {
|
|
|
4419
4456
|
const output = nonNegativeFinite(value.output);
|
|
4420
4457
|
const suppliedTotal = nonNegativeFinite(value.total);
|
|
4421
4458
|
const cached = nonNegativeFinite(value.cached);
|
|
4459
|
+
const cacheWrite = nonNegativeFinite(value.cacheWrite);
|
|
4460
|
+
const reasoning = nonNegativeFinite(value.reasoning);
|
|
4422
4461
|
const derivedTotal = input !== void 0 && output !== void 0 && Number.isFinite(input + output) ? input + output : void 0;
|
|
4423
4462
|
const total = suppliedTotal ?? derivedTotal;
|
|
4424
|
-
if (input === void 0 && output === void 0 && total === void 0 && cached === void 0) {
|
|
4463
|
+
if (input === void 0 && output === void 0 && total === void 0 && cached === void 0 && cacheWrite === void 0 && reasoning === void 0) {
|
|
4425
4464
|
return void 0;
|
|
4426
4465
|
}
|
|
4427
4466
|
return {
|
|
4428
4467
|
...input !== void 0 ? { input } : {},
|
|
4429
4468
|
...output !== void 0 ? { output } : {},
|
|
4430
4469
|
...total !== void 0 ? { total } : {},
|
|
4431
|
-
...cached !== void 0 ? { cached } : {}
|
|
4470
|
+
...cached !== void 0 ? { cached } : {},
|
|
4471
|
+
...cacheWrite !== void 0 ? { cacheWrite } : {},
|
|
4472
|
+
...reasoning !== void 0 ? { reasoning } : {}
|
|
4432
4473
|
};
|
|
4433
4474
|
}
|
|
4434
4475
|
|
|
@@ -5587,6 +5628,8 @@ function readOpenInferenceTokenUsage(attributes) {
|
|
|
5587
5628
|
const completion = attributes["llm.token_count.completion"];
|
|
5588
5629
|
const total = attributes["llm.token_count.total"];
|
|
5589
5630
|
const cached = attributes["llm.token_count.prompt_details.cache_read"];
|
|
5631
|
+
const cacheWrite = attributes["llm.token_count.prompt_details.cache_write"] ?? attributes["llm.token_count.prompt_details.cache_creation"];
|
|
5632
|
+
const reasoning = attributes["llm.token_count.completion_details.reasoning"] ?? attributes["llm.token_count.completion_details.reasoning_tokens"];
|
|
5590
5633
|
const usage = {};
|
|
5591
5634
|
if (typeof prompt === "number" && Number.isFinite(prompt) && prompt >= 0) {
|
|
5592
5635
|
usage.input = prompt;
|
|
@@ -5600,6 +5643,12 @@ function readOpenInferenceTokenUsage(attributes) {
|
|
|
5600
5643
|
if (typeof cached === "number" && Number.isFinite(cached) && cached >= 0) {
|
|
5601
5644
|
usage.cached = cached;
|
|
5602
5645
|
}
|
|
5646
|
+
if (typeof cacheWrite === "number" && Number.isFinite(cacheWrite) && cacheWrite >= 0) {
|
|
5647
|
+
usage.cacheWrite = cacheWrite;
|
|
5648
|
+
}
|
|
5649
|
+
if (typeof reasoning === "number" && Number.isFinite(reasoning) && reasoning >= 0) {
|
|
5650
|
+
usage.reasoning = reasoning;
|
|
5651
|
+
}
|
|
5603
5652
|
if (usage.total === void 0 && usage.input !== void 0 && usage.output !== void 0) {
|
|
5604
5653
|
usage.total = usage.input + usage.output;
|
|
5605
5654
|
}
|