@agent-inspect/mcp-server 6.31.11 → 6.31.13

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/cli.cjs CHANGED
@@ -4977,18 +4977,16 @@ var TreeBuilder = class {
4977
4977
  inc(confidenceBreakdown, e.confidence);
4978
4978
  kinds[e.kind] = (kinds[e.kind] ?? 0) + 1;
4979
4979
  }
4980
- const startedAt = sorted.length > 0 ? sorted[0].timestamp : void 0;
4981
- const endedAt = sorted.length > 0 ? sorted[sorted.length - 1].timestamp : void 0;
4982
- const status = computeRunStatus(sorted);
4983
- const durationMs = startedAt !== void 0 && endedAt !== void 0 && Number.isFinite(startedAt) && Number.isFinite(endedAt) && endedAt >= startedAt && status !== "running" ? endedAt - startedAt : void 0;
4984
4980
  const name = sorted.find((e) => e.kind === "RUN")?.name;
4981
+ const status = computeRunStatus(sorted);
4982
+ const timing = resolveRunTiming(sorted, status);
4985
4983
  out.push({
4986
4984
  runId,
4987
4985
  name,
4988
4986
  status,
4989
- startedAt,
4990
- endedAt: status === "running" ? void 0 : endedAt,
4991
- durationMs,
4987
+ startedAt: timing.startedAt,
4988
+ endedAt: timing.endedAt,
4989
+ durationMs: timing.durationMs,
4992
4990
  children: roots,
4993
4991
  metadata: {
4994
4992
  totalEvents: sorted.length,
@@ -5002,6 +5000,57 @@ var TreeBuilder = class {
5002
5000
  return out;
5003
5001
  }
5004
5002
  };
5003
+ function resolveRunTiming(sorted, status) {
5004
+ let startedAtMs;
5005
+ let endedAtMs;
5006
+ let explicitDurationMs;
5007
+ for (const event of sorted) {
5008
+ if (event.kind !== "RUN") continue;
5009
+ const attrs2 = event.attributes ?? {};
5010
+ if (typeof attrs2.startedAtMs === "number" && Number.isFinite(attrs2.startedAtMs)) {
5011
+ startedAtMs = startedAtMs === void 0 ? attrs2.startedAtMs : Math.min(startedAtMs, attrs2.startedAtMs);
5012
+ }
5013
+ if (typeof attrs2.endedAtMs === "number" && Number.isFinite(attrs2.endedAtMs)) {
5014
+ endedAtMs = endedAtMs === void 0 ? attrs2.endedAtMs : Math.max(endedAtMs, attrs2.endedAtMs);
5015
+ }
5016
+ if ((event.status === "ok" || event.status === "error") && typeof event.durationMs === "number" && Number.isFinite(event.durationMs) && event.durationMs >= 0) {
5017
+ explicitDurationMs = event.durationMs;
5018
+ if (endedAtMs === void 0 && startedAtMs !== void 0) {
5019
+ endedAtMs = startedAtMs + event.durationMs;
5020
+ } else if (endedAtMs === void 0 && Number.isFinite(event.timestamp)) {
5021
+ endedAtMs = event.timestamp + event.durationMs;
5022
+ if (startedAtMs === void 0) {
5023
+ startedAtMs = event.timestamp;
5024
+ }
5025
+ }
5026
+ }
5027
+ if (startedAtMs === void 0 && event.status === "running" && Number.isFinite(event.timestamp)) {
5028
+ startedAtMs = event.timestamp;
5029
+ }
5030
+ }
5031
+ if (startedAtMs !== void 0 && endedAtMs !== void 0 && Number.isFinite(startedAtMs) && Number.isFinite(endedAtMs) && endedAtMs >= startedAtMs && status !== "running") {
5032
+ return {
5033
+ startedAt: startedAtMs,
5034
+ endedAt: endedAtMs,
5035
+ durationMs: endedAtMs - startedAtMs
5036
+ };
5037
+ }
5038
+ if (startedAtMs !== void 0 && explicitDurationMs !== void 0 && status !== "running") {
5039
+ return {
5040
+ startedAt: startedAtMs,
5041
+ endedAt: startedAtMs + explicitDurationMs,
5042
+ durationMs: explicitDurationMs
5043
+ };
5044
+ }
5045
+ const startedAt = sorted.length > 0 ? sorted[0].timestamp : void 0;
5046
+ const endedAt = sorted.length > 0 ? sorted[sorted.length - 1].timestamp : void 0;
5047
+ const durationMs = startedAt !== void 0 && endedAt !== void 0 && Number.isFinite(startedAt) && Number.isFinite(endedAt) && endedAt >= startedAt && status !== "running" ? endedAt - startedAt : void 0;
5048
+ return {
5049
+ startedAt,
5050
+ endedAt: status === "running" ? void 0 : endedAt,
5051
+ durationMs
5052
+ };
5053
+ }
5005
5054
 
5006
5055
  // packages/core/src/persisted/to-inspect-event.ts
5007
5056
  function compactAttributes3(entries) {