@agent-inspect/mcp-server 6.31.12 → 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.
@@ -4967,18 +4967,16 @@ var TreeBuilder = class {
4967
4967
  inc(confidenceBreakdown, e.confidence);
4968
4968
  kinds[e.kind] = (kinds[e.kind] ?? 0) + 1;
4969
4969
  }
4970
- const startedAt = sorted.length > 0 ? sorted[0].timestamp : void 0;
4971
- const endedAt = sorted.length > 0 ? sorted[sorted.length - 1].timestamp : void 0;
4972
- const status = computeRunStatus(sorted);
4973
- const durationMs = startedAt !== void 0 && endedAt !== void 0 && Number.isFinite(startedAt) && Number.isFinite(endedAt) && endedAt >= startedAt && status !== "running" ? endedAt - startedAt : void 0;
4974
4970
  const name = sorted.find((e) => e.kind === "RUN")?.name;
4971
+ const status = computeRunStatus(sorted);
4972
+ const timing = resolveRunTiming(sorted, status);
4975
4973
  out.push({
4976
4974
  runId,
4977
4975
  name,
4978
4976
  status,
4979
- startedAt,
4980
- endedAt: status === "running" ? void 0 : endedAt,
4981
- durationMs,
4977
+ startedAt: timing.startedAt,
4978
+ endedAt: timing.endedAt,
4979
+ durationMs: timing.durationMs,
4982
4980
  children: roots,
4983
4981
  metadata: {
4984
4982
  totalEvents: sorted.length,
@@ -4992,6 +4990,57 @@ var TreeBuilder = class {
4992
4990
  return out;
4993
4991
  }
4994
4992
  };
4993
+ function resolveRunTiming(sorted, status) {
4994
+ let startedAtMs;
4995
+ let endedAtMs;
4996
+ let explicitDurationMs;
4997
+ for (const event of sorted) {
4998
+ if (event.kind !== "RUN") continue;
4999
+ const attrs2 = event.attributes ?? {};
5000
+ if (typeof attrs2.startedAtMs === "number" && Number.isFinite(attrs2.startedAtMs)) {
5001
+ startedAtMs = startedAtMs === void 0 ? attrs2.startedAtMs : Math.min(startedAtMs, attrs2.startedAtMs);
5002
+ }
5003
+ if (typeof attrs2.endedAtMs === "number" && Number.isFinite(attrs2.endedAtMs)) {
5004
+ endedAtMs = endedAtMs === void 0 ? attrs2.endedAtMs : Math.max(endedAtMs, attrs2.endedAtMs);
5005
+ }
5006
+ if ((event.status === "ok" || event.status === "error") && typeof event.durationMs === "number" && Number.isFinite(event.durationMs) && event.durationMs >= 0) {
5007
+ explicitDurationMs = event.durationMs;
5008
+ if (endedAtMs === void 0 && startedAtMs !== void 0) {
5009
+ endedAtMs = startedAtMs + event.durationMs;
5010
+ } else if (endedAtMs === void 0 && Number.isFinite(event.timestamp)) {
5011
+ endedAtMs = event.timestamp + event.durationMs;
5012
+ if (startedAtMs === void 0) {
5013
+ startedAtMs = event.timestamp;
5014
+ }
5015
+ }
5016
+ }
5017
+ if (startedAtMs === void 0 && event.status === "running" && Number.isFinite(event.timestamp)) {
5018
+ startedAtMs = event.timestamp;
5019
+ }
5020
+ }
5021
+ if (startedAtMs !== void 0 && endedAtMs !== void 0 && Number.isFinite(startedAtMs) && Number.isFinite(endedAtMs) && endedAtMs >= startedAtMs && status !== "running") {
5022
+ return {
5023
+ startedAt: startedAtMs,
5024
+ endedAt: endedAtMs,
5025
+ durationMs: endedAtMs - startedAtMs
5026
+ };
5027
+ }
5028
+ if (startedAtMs !== void 0 && explicitDurationMs !== void 0 && status !== "running") {
5029
+ return {
5030
+ startedAt: startedAtMs,
5031
+ endedAt: startedAtMs + explicitDurationMs,
5032
+ durationMs: explicitDurationMs
5033
+ };
5034
+ }
5035
+ const startedAt = sorted.length > 0 ? sorted[0].timestamp : void 0;
5036
+ const endedAt = sorted.length > 0 ? sorted[sorted.length - 1].timestamp : void 0;
5037
+ const durationMs = startedAt !== void 0 && endedAt !== void 0 && Number.isFinite(startedAt) && Number.isFinite(endedAt) && endedAt >= startedAt && status !== "running" ? endedAt - startedAt : void 0;
5038
+ return {
5039
+ startedAt,
5040
+ endedAt: status === "running" ? void 0 : endedAt,
5041
+ durationMs
5042
+ };
5043
+ }
4995
5044
 
4996
5045
  // packages/core/src/persisted/to-inspect-event.ts
4997
5046
  function compactAttributes3(entries) {
@@ -9311,5 +9360,5 @@ async function runReadOnlyMcpServer(options = {}) {
9311
9360
  }
9312
9361
 
9313
9362
  export { MCP_MAX_REQUEST_BYTES, MCP_PROTOCOL_VERSION, MCP_SERVER_INSTRUCTIONS, READ_ONLY_TOOLS, TRACE_DATA_UNTRUSTED_WARNING, callReadOnlyTool, createMcpServerContext, handleMcpProtocolLine, runReadOnlyMcpServer };
9314
- //# sourceMappingURL=chunk-74ILQJUL.mjs.map
9315
- //# sourceMappingURL=chunk-74ILQJUL.mjs.map
9363
+ //# sourceMappingURL=chunk-ITYQ6FXK.mjs.map
9364
+ //# sourceMappingURL=chunk-ITYQ6FXK.mjs.map