@agent-inspect/mcp-server 6.7.2 → 6.7.4

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/index.cjs CHANGED
@@ -1646,6 +1646,12 @@ async function searchTraces(metas, options) {
1646
1646
  ...sessionLabel ? { sessionId: sessionLabel } : {}
1647
1647
  });
1648
1648
  }
1649
+ results.sort((a, b) => {
1650
+ const ta = a.timestamp ?? 0;
1651
+ const tb = b.timestamp ?? 0;
1652
+ if (ta !== tb) return tb - ta;
1653
+ return a.runId.localeCompare(b.runId);
1654
+ });
1649
1655
  return results.slice(0, limit);
1650
1656
  }
1651
1657
  for (const m of filtered) {
@@ -1693,7 +1699,7 @@ async function searchTraces(metas, options) {
1693
1699
  results.sort((a, b) => {
1694
1700
  const ta = a.timestamp ?? 0;
1695
1701
  const tb = b.timestamp ?? 0;
1696
- if (ta !== tb) return ta - tb;
1702
+ if (ta !== tb) return tb - ta;
1697
1703
  const runCmp = a.runId.localeCompare(b.runId);
1698
1704
  if (runCmp !== 0) return runCmp;
1699
1705
  return (a.stepName ?? "").localeCompare(b.stepName ?? "");
@@ -2682,13 +2688,24 @@ function inc(map, key) {
2682
2688
  map[key] = (map[key] ?? 0) + 1;
2683
2689
  }
2684
2690
  function computeRunStatus(events) {
2691
+ let runTerminal;
2692
+ let sawRunEvent = false;
2693
+ for (const e of events) {
2694
+ if (e.kind !== "RUN") continue;
2695
+ sawRunEvent = true;
2696
+ if (e.status === "ok" || e.status === "error") {
2697
+ runTerminal = e.status;
2698
+ }
2699
+ }
2700
+ if (sawRunEvent) {
2701
+ return runTerminal ?? "running";
2702
+ }
2685
2703
  let hasRunning = false;
2686
2704
  for (const e of events) {
2687
2705
  if (e.status === "error") return "error";
2688
2706
  if (e.status === "running") hasRunning = true;
2689
2707
  }
2690
- if (hasRunning) return "running";
2691
- return "ok";
2708
+ return hasRunning ? "running" : "ok";
2692
2709
  }
2693
2710
  var TreeBuilder = class {
2694
2711
  constructor(options) {
@@ -4628,6 +4645,10 @@ function manualTraceEventsToComparableRun(events) {
4628
4645
  meta = { ...meta ?? {}, agent_inspect_diff_parent_missing: true };
4629
4646
  }
4630
4647
  const outputPreview = extractOutputPreview(meta);
4648
+ if (meta !== void 0 && ("outputPreview" in meta || "resultPreview" in meta)) {
4649
+ delete meta.outputPreview;
4650
+ delete meta.resultPreview;
4651
+ }
4631
4652
  const sc = {
4632
4653
  id: acc.id,
4633
4654
  name: acc.name,
@@ -5321,6 +5342,11 @@ function exportMarkdown(tree, options) {
5321
5342
  function hexFrom(seed, byteLen) {
5322
5343
  return crypto__default.default.createHash("sha256").update(seed, "utf8").digest("hex").slice(0, byteLen * 2);
5323
5344
  }
5345
+ function unixNano(ms) {
5346
+ const whole = Math.trunc(ms);
5347
+ const fractionNs = Math.round((ms - whole) * 1e6);
5348
+ return BigInt(whole) * 1000000n + BigInt(fractionNs);
5349
+ }
5324
5350
  function mapInspectKindToOI(kind, warnings) {
5325
5351
  switch (kind) {
5326
5352
  case "LLM":
@@ -5370,10 +5396,10 @@ function exportOpenInference(tree, options) {
5370
5396
  const ev = n.event;
5371
5397
  const spanId = hexFrom(`${tree.runId}:${ev.eventId}`, 8);
5372
5398
  const parentSpanHex = ev.parentId ? hexFrom(`${tree.runId}:${ev.parentId}`, 8) : void 0;
5373
- const startNs = Math.round(ev.timestamp * 1e6);
5399
+ const startNs = unixNano(ev.timestamp);
5374
5400
  let endNs;
5375
5401
  if (ev.durationMs !== void 0 && Number.isFinite(ev.durationMs)) {
5376
- endNs = startNs + Math.round(ev.durationMs * 1e6);
5402
+ endNs = startNs + unixNano(ev.durationMs);
5377
5403
  }
5378
5404
  const { openInferenceKind } = mapInspectKindToOI(ev.kind, warnings);
5379
5405
  const attrs = {
@@ -5421,8 +5447,8 @@ function exportOpenInference(tree, options) {
5421
5447
  span_id: spanId,
5422
5448
  parent_span_id: parentSpanHex,
5423
5449
  name: ev.name,
5424
- start_time_unix_nano: startNs,
5425
- end_time_unix_nano: endNs,
5450
+ start_time_unix_nano: startNs.toString(),
5451
+ end_time_unix_nano: endNs?.toString(),
5426
5452
  attributes: attrs,
5427
5453
  status
5428
5454
  });