agent-inspect 6.19.0 → 6.20.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/CHANGELOG.md +12 -0
- package/README.md +3 -1
- package/SECURITY.md +2 -0
- package/docs/ARCHITECTURE.md +28 -16
- package/docs/KNOWN-ISSUES.md +3 -3
- package/docs/LIMITATIONS.md +5 -4
- package/docs/PERFORMANCE.md +1 -1
- package/docs/SUPPORT-LEVELS.md +2 -1
- package/docs/TRACE-CONTRACTS.md +64 -52
- package/package.json +3 -2
- package/packages/cli/dist/{chunk-R7Y5SGH5.mjs → chunk-QPRJUVLH.mjs} +57 -17
- package/packages/cli/dist/chunk-QPRJUVLH.mjs.map +1 -0
- package/packages/cli/dist/index.cjs +69 -18
- package/packages/cli/dist/index.cjs.map +1 -1
- package/packages/cli/dist/index.mjs +9 -6
- package/packages/cli/dist/index.mjs.map +1 -1
- package/packages/cli/dist/{src-T4EZERCX.mjs → src-6W5ZR3I7.mjs} +3 -3
- package/packages/cli/dist/{src-T4EZERCX.mjs.map → src-6W5ZR3I7.mjs.map} +1 -1
- package/packages/core/dist/advanced.cjs +118 -18
- package/packages/core/dist/advanced.cjs.map +1 -1
- package/packages/core/dist/advanced.d.cts +2 -2
- package/packages/core/dist/advanced.d.ts +2 -2
- package/packages/core/dist/advanced.mjs +8 -8
- package/packages/core/dist/checks.cjs +443 -9
- package/packages/core/dist/checks.cjs.map +1 -1
- package/packages/core/dist/checks.d.cts +78 -16
- package/packages/core/dist/checks.d.ts +78 -16
- package/packages/core/dist/checks.mjs +3 -3
- package/packages/core/dist/{chunk-VFO76UH3.mjs → chunk-3XS5O4JI.mjs} +3 -3
- package/packages/core/dist/{chunk-VFO76UH3.mjs.map → chunk-3XS5O4JI.mjs.map} +1 -1
- package/packages/core/dist/{chunk-ZWA5RWMV.mjs → chunk-5YFJJFXU.mjs} +4 -4
- package/packages/core/dist/{chunk-ZWA5RWMV.mjs.map → chunk-5YFJJFXU.mjs.map} +1 -1
- package/packages/core/dist/{chunk-NABMW5DX.mjs → chunk-G47KQB42.mjs} +445 -13
- package/packages/core/dist/chunk-G47KQB42.mjs.map +1 -0
- package/packages/core/dist/{chunk-SGL4JGCD.mjs → chunk-JBNRJLIV.mjs} +58 -18
- package/packages/core/dist/chunk-JBNRJLIV.mjs.map +1 -0
- package/packages/core/dist/{chunk-ULCGIRTC.mjs → chunk-U25RHRSU.mjs} +65 -5
- package/packages/core/dist/chunk-U25RHRSU.mjs.map +1 -0
- package/packages/core/dist/{context-Ca5yK8Cs.d.cts → context-C5ye_xcS.d.cts} +0 -4
- package/packages/core/dist/{context-D6cS4XIL.d.ts → context-CNsNSgE2.d.ts} +0 -4
- package/packages/core/dist/exporters.cjs +55 -15
- package/packages/core/dist/exporters.cjs.map +1 -1
- package/packages/core/dist/exporters.mjs +3 -3
- package/packages/core/dist/{index-DKwuGSe-.d.ts → index-Bg9ZdsdS.d.ts} +10 -0
- package/packages/core/dist/{index-DCR816Yt.d.cts → index-rVpX5PPh.d.cts} +10 -0
- package/packages/core/dist/index.cjs +63 -3
- package/packages/core/dist/index.cjs.map +1 -1
- package/packages/core/dist/index.d.cts +1 -1
- package/packages/core/dist/index.d.ts +1 -1
- package/packages/core/dist/index.mjs +4 -4
- package/packages/core/dist/writers.cjs +33 -2
- package/packages/core/dist/writers.cjs.map +1 -1
- package/packages/core/dist/writers.mjs +1 -1
- package/packages/cli/dist/chunk-R7Y5SGH5.mjs.map +0 -1
- package/packages/core/dist/chunk-NABMW5DX.mjs.map +0 -1
- package/packages/core/dist/chunk-SGL4JGCD.mjs.map +0 -1
- package/packages/core/dist/chunk-ULCGIRTC.mjs.map +0 -1
|
@@ -1455,9 +1455,63 @@ function formatTimestamp(timestamp) {
|
|
|
1455
1455
|
function isFiniteNumber(v) {
|
|
1456
1456
|
return typeof v === "number" && Number.isFinite(v);
|
|
1457
1457
|
}
|
|
1458
|
+
var ROOT_STEP_DEPTH = 0;
|
|
1459
|
+
var MAX_RUN_SUMMARY_DEPTH = 1e3;
|
|
1458
1460
|
function isNonNegativeFiniteNumber(value) {
|
|
1459
1461
|
return typeof value === "number" && Number.isFinite(value) && value >= 0;
|
|
1460
1462
|
}
|
|
1463
|
+
function resolveParentStepId(step, steps) {
|
|
1464
|
+
const parentId = step.parentId;
|
|
1465
|
+
if (typeof parentId !== "string" || parentId.trim() === "") {
|
|
1466
|
+
return void 0;
|
|
1467
|
+
}
|
|
1468
|
+
return steps.has(parentId) ? parentId : void 0;
|
|
1469
|
+
}
|
|
1470
|
+
function computeStepDepth(stepId, steps, depthCache) {
|
|
1471
|
+
const cached = depthCache.get(stepId);
|
|
1472
|
+
if (cached !== void 0) return cached;
|
|
1473
|
+
const ancestry = [];
|
|
1474
|
+
const ancestryIndexes = /* @__PURE__ */ new Map();
|
|
1475
|
+
let currentStepId = stepId;
|
|
1476
|
+
let resolvedDepth;
|
|
1477
|
+
while (resolvedDepth === void 0) {
|
|
1478
|
+
const cachedDepth = depthCache.get(currentStepId);
|
|
1479
|
+
if (cachedDepth !== void 0) {
|
|
1480
|
+
resolvedDepth = cachedDepth;
|
|
1481
|
+
continue;
|
|
1482
|
+
}
|
|
1483
|
+
const cycleStart = ancestryIndexes.get(currentStepId);
|
|
1484
|
+
if (cycleStart !== void 0) {
|
|
1485
|
+
const cycleStepIds = ancestry.splice(cycleStart);
|
|
1486
|
+
for (const cycleStepId of cycleStepIds) {
|
|
1487
|
+
depthCache.set(cycleStepId, ROOT_STEP_DEPTH);
|
|
1488
|
+
}
|
|
1489
|
+
resolvedDepth = ROOT_STEP_DEPTH;
|
|
1490
|
+
continue;
|
|
1491
|
+
}
|
|
1492
|
+
const currentStep = steps.get(currentStepId);
|
|
1493
|
+
if (!currentStep) {
|
|
1494
|
+
resolvedDepth = ROOT_STEP_DEPTH;
|
|
1495
|
+
continue;
|
|
1496
|
+
}
|
|
1497
|
+
ancestryIndexes.set(currentStepId, ancestry.length);
|
|
1498
|
+
ancestry.push(currentStepId);
|
|
1499
|
+
const parentStepId = resolveParentStepId(currentStep, steps);
|
|
1500
|
+
if (parentStepId === void 0) {
|
|
1501
|
+
ancestry.pop();
|
|
1502
|
+
depthCache.set(currentStepId, ROOT_STEP_DEPTH);
|
|
1503
|
+
resolvedDepth = ROOT_STEP_DEPTH;
|
|
1504
|
+
continue;
|
|
1505
|
+
}
|
|
1506
|
+
currentStepId = parentStepId;
|
|
1507
|
+
}
|
|
1508
|
+
ancestry.reverse();
|
|
1509
|
+
for (const ancestorStepId of ancestry) {
|
|
1510
|
+
resolvedDepth = Math.min(MAX_RUN_SUMMARY_DEPTH, resolvedDepth + 1);
|
|
1511
|
+
depthCache.set(ancestorStepId, resolvedDepth);
|
|
1512
|
+
}
|
|
1513
|
+
return depthCache.get(stepId) ?? ROOT_STEP_DEPTH;
|
|
1514
|
+
}
|
|
1461
1515
|
function buildRunSummary(events) {
|
|
1462
1516
|
const started = events.find(
|
|
1463
1517
|
(e) => e.event === "run_started"
|
|
@@ -1511,27 +1565,13 @@ function buildRunSummary(events) {
|
|
|
1511
1565
|
let stepsWithKnownTotal = 0;
|
|
1512
1566
|
let hasCachedTokens = false;
|
|
1513
1567
|
const depthCache = /* @__PURE__ */ new Map();
|
|
1514
|
-
const computeDepth = (stepId) => {
|
|
1515
|
-
const cached = depthCache.get(stepId);
|
|
1516
|
-
if (cached !== void 0) return cached;
|
|
1517
|
-
const node = steps.get(stepId);
|
|
1518
|
-
if (!node) return 0;
|
|
1519
|
-
const parent = node.parentId;
|
|
1520
|
-
if (typeof parent !== "string" || parent.trim() === "" || !steps.has(parent)) {
|
|
1521
|
-
depthCache.set(stepId, 0);
|
|
1522
|
-
return 0;
|
|
1523
|
-
}
|
|
1524
|
-
const d = Math.min(1e3, computeDepth(parent) + 1);
|
|
1525
|
-
depthCache.set(stepId, d);
|
|
1526
|
-
return d;
|
|
1527
|
-
};
|
|
1528
1568
|
for (const [id, s] of steps.entries()) {
|
|
1529
1569
|
totalSteps += 1;
|
|
1530
1570
|
if (s.type === "llm") llmSteps += 1;
|
|
1531
1571
|
else if (s.type === "tool") toolSteps += 1;
|
|
1532
1572
|
else logicSteps += 1;
|
|
1533
1573
|
if (s.status === "error") errorSteps += 1;
|
|
1534
|
-
const depth =
|
|
1574
|
+
const depth = computeStepDepth(id, steps, depthCache);
|
|
1535
1575
|
if (depth > maxDepth) maxDepth = depth;
|
|
1536
1576
|
if (typeof s.durationMs === "number" && Number.isFinite(s.durationMs)) {
|
|
1537
1577
|
if (!longestStep || s.durationMs > longestStep.durationMs) {
|