@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.mjs CHANGED
@@ -1636,6 +1636,12 @@ async function searchTraces(metas, options) {
1636
1636
  ...sessionLabel ? { sessionId: sessionLabel } : {}
1637
1637
  });
1638
1638
  }
1639
+ results.sort((a, b) => {
1640
+ const ta = a.timestamp ?? 0;
1641
+ const tb = b.timestamp ?? 0;
1642
+ if (ta !== tb) return tb - ta;
1643
+ return a.runId.localeCompare(b.runId);
1644
+ });
1639
1645
  return results.slice(0, limit);
1640
1646
  }
1641
1647
  for (const m of filtered) {
@@ -1683,7 +1689,7 @@ async function searchTraces(metas, options) {
1683
1689
  results.sort((a, b) => {
1684
1690
  const ta = a.timestamp ?? 0;
1685
1691
  const tb = b.timestamp ?? 0;
1686
- if (ta !== tb) return ta - tb;
1692
+ if (ta !== tb) return tb - ta;
1687
1693
  const runCmp = a.runId.localeCompare(b.runId);
1688
1694
  if (runCmp !== 0) return runCmp;
1689
1695
  return (a.stepName ?? "").localeCompare(b.stepName ?? "");
@@ -2672,13 +2678,24 @@ function inc(map, key) {
2672
2678
  map[key] = (map[key] ?? 0) + 1;
2673
2679
  }
2674
2680
  function computeRunStatus(events) {
2681
+ let runTerminal;
2682
+ let sawRunEvent = false;
2683
+ for (const e of events) {
2684
+ if (e.kind !== "RUN") continue;
2685
+ sawRunEvent = true;
2686
+ if (e.status === "ok" || e.status === "error") {
2687
+ runTerminal = e.status;
2688
+ }
2689
+ }
2690
+ if (sawRunEvent) {
2691
+ return runTerminal ?? "running";
2692
+ }
2675
2693
  let hasRunning = false;
2676
2694
  for (const e of events) {
2677
2695
  if (e.status === "error") return "error";
2678
2696
  if (e.status === "running") hasRunning = true;
2679
2697
  }
2680
- if (hasRunning) return "running";
2681
- return "ok";
2698
+ return hasRunning ? "running" : "ok";
2682
2699
  }
2683
2700
  var TreeBuilder = class {
2684
2701
  constructor(options) {
@@ -4618,6 +4635,10 @@ function manualTraceEventsToComparableRun(events) {
4618
4635
  meta = { ...meta ?? {}, agent_inspect_diff_parent_missing: true };
4619
4636
  }
4620
4637
  const outputPreview = extractOutputPreview(meta);
4638
+ if (meta !== void 0 && ("outputPreview" in meta || "resultPreview" in meta)) {
4639
+ delete meta.outputPreview;
4640
+ delete meta.resultPreview;
4641
+ }
4621
4642
  const sc = {
4622
4643
  id: acc.id,
4623
4644
  name: acc.name,
@@ -5311,6 +5332,11 @@ function exportMarkdown(tree, options) {
5311
5332
  function hexFrom(seed, byteLen) {
5312
5333
  return crypto.createHash("sha256").update(seed, "utf8").digest("hex").slice(0, byteLen * 2);
5313
5334
  }
5335
+ function unixNano(ms) {
5336
+ const whole = Math.trunc(ms);
5337
+ const fractionNs = Math.round((ms - whole) * 1e6);
5338
+ return BigInt(whole) * 1000000n + BigInt(fractionNs);
5339
+ }
5314
5340
  function mapInspectKindToOI(kind, warnings) {
5315
5341
  switch (kind) {
5316
5342
  case "LLM":
@@ -5360,10 +5386,10 @@ function exportOpenInference(tree, options) {
5360
5386
  const ev = n.event;
5361
5387
  const spanId = hexFrom(`${tree.runId}:${ev.eventId}`, 8);
5362
5388
  const parentSpanHex = ev.parentId ? hexFrom(`${tree.runId}:${ev.parentId}`, 8) : void 0;
5363
- const startNs = Math.round(ev.timestamp * 1e6);
5389
+ const startNs = unixNano(ev.timestamp);
5364
5390
  let endNs;
5365
5391
  if (ev.durationMs !== void 0 && Number.isFinite(ev.durationMs)) {
5366
- endNs = startNs + Math.round(ev.durationMs * 1e6);
5392
+ endNs = startNs + unixNano(ev.durationMs);
5367
5393
  }
5368
5394
  const { openInferenceKind } = mapInspectKindToOI(ev.kind, warnings);
5369
5395
  const attrs = {
@@ -5411,8 +5437,8 @@ function exportOpenInference(tree, options) {
5411
5437
  span_id: spanId,
5412
5438
  parent_span_id: parentSpanHex,
5413
5439
  name: ev.name,
5414
- start_time_unix_nano: startNs,
5415
- end_time_unix_nano: endNs,
5440
+ start_time_unix_nano: startNs.toString(),
5441
+ end_time_unix_nano: endNs?.toString(),
5416
5442
  attributes: attrs,
5417
5443
  status
5418
5444
  });