agent-inspect 6.7.2 → 6.7.3

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.
Files changed (39) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +1 -1
  3. package/docs/EXPORTS.md +9 -0
  4. package/docs/PERFORMANCE.md +18 -0
  5. package/docs/STANDARDS.md +4 -0
  6. package/package.json +2 -2
  7. package/packages/cli/dist/{chunk-M6PC5KUT.mjs → chunk-EMYDJREA.mjs} +26 -10
  8. package/packages/cli/dist/chunk-EMYDJREA.mjs.map +1 -0
  9. package/packages/cli/dist/index.cjs +46 -21
  10. package/packages/cli/dist/index.cjs.map +1 -1
  11. package/packages/cli/dist/index.mjs +23 -14
  12. package/packages/cli/dist/index.mjs.map +1 -1
  13. package/packages/cli/dist/{src-27LC2BB3.mjs → src-IPJNFV37.mjs} +3 -3
  14. package/packages/cli/dist/{src-27LC2BB3.mjs.map → src-IPJNFV37.mjs.map} +1 -1
  15. package/packages/core/dist/advanced.cjs +24 -8
  16. package/packages/core/dist/advanced.cjs.map +1 -1
  17. package/packages/core/dist/advanced.mjs +25 -9
  18. package/packages/core/dist/advanced.mjs.map +1 -1
  19. package/packages/core/dist/checks.cjs +56 -4
  20. package/packages/core/dist/checks.cjs.map +1 -1
  21. package/packages/core/dist/checks.mjs +1 -1
  22. package/packages/core/dist/{chunk-EWHN6NA4.mjs → chunk-EQVXDGGU.mjs} +58 -6
  23. package/packages/core/dist/chunk-EQVXDGGU.mjs.map +1 -0
  24. package/packages/core/dist/diff.cjs +4 -0
  25. package/packages/core/dist/diff.cjs.map +1 -1
  26. package/packages/core/dist/diff.mjs +4 -0
  27. package/packages/core/dist/diff.mjs.map +1 -1
  28. package/packages/core/dist/exporters.cjs +9 -4
  29. package/packages/core/dist/exporters.cjs.map +1 -1
  30. package/packages/core/dist/exporters.d.cts +3 -2
  31. package/packages/core/dist/exporters.d.ts +3 -2
  32. package/packages/core/dist/exporters.mjs +9 -4
  33. package/packages/core/dist/exporters.mjs.map +1 -1
  34. package/packages/core/dist/logs.cjs +3 -2
  35. package/packages/core/dist/logs.cjs.map +1 -1
  36. package/packages/core/dist/logs.mjs +3 -2
  37. package/packages/core/dist/logs.mjs.map +1 -1
  38. package/packages/cli/dist/chunk-M6PC5KUT.mjs.map +0 -1
  39. package/packages/core/dist/chunk-EWHN6NA4.mjs.map +0 -1
@@ -8489,7 +8489,9 @@ function compareCohortAggregates(groups, options) {
8489
8489
  metric,
8490
8490
  "Average duration (ms)",
8491
8491
  baselineAgg?.avgDurationMs,
8492
- candidateAgg?.avgDurationMs
8492
+ candidateAgg?.avgDurationMs,
8493
+ true,
8494
+ tolerance
8493
8495
  );
8494
8496
  if (item) comparisons.push(item);
8495
8497
  break;
@@ -8499,7 +8501,9 @@ function compareCohortAggregates(groups, options) {
8499
8501
  metric,
8500
8502
  "Average LLM calls",
8501
8503
  baselineAgg?.avgLlmCallCount,
8502
- candidateAgg?.avgLlmCallCount
8504
+ candidateAgg?.avgLlmCallCount,
8505
+ true,
8506
+ tolerance
8503
8507
  );
8504
8508
  if (item) comparisons.push(item);
8505
8509
  break;
@@ -8509,7 +8513,9 @@ function compareCohortAggregates(groups, options) {
8509
8513
  metric,
8510
8514
  "Average token usage",
8511
8515
  baselineAgg?.avgTokenUsage,
8512
- candidateAgg?.avgTokenUsage
8516
+ candidateAgg?.avgTokenUsage,
8517
+ true,
8518
+ tolerance
8513
8519
  );
8514
8520
  if (item) comparisons.push(item);
8515
8521
  break;
@@ -8519,7 +8525,9 @@ function compareCohortAggregates(groups, options) {
8519
8525
  metric,
8520
8526
  "Average retries",
8521
8527
  baselineAgg?.avgRetryCount,
8522
- candidateAgg?.avgRetryCount
8528
+ candidateAgg?.avgRetryCount,
8529
+ true,
8530
+ tolerance
8523
8531
  );
8524
8532
  if (item) comparisons.push(item);
8525
8533
  break;
@@ -8529,7 +8537,9 @@ function compareCohortAggregates(groups, options) {
8529
8537
  metric,
8530
8538
  "Observation failure rate",
8531
8539
  baselineAgg?.observationFailureRate,
8532
- candidateAgg?.observationFailureRate
8540
+ candidateAgg?.observationFailureRate,
8541
+ true,
8542
+ tolerance
8533
8543
  );
8534
8544
  if (item) comparisons.push(item);
8535
8545
  break;
@@ -8565,7 +8575,9 @@ function compareCohortAggregates(groups, options) {
8565
8575
  metric,
8566
8576
  "Guardrail failures",
8567
8577
  baselineAgg?.avgGuardrailFailures,
8568
- candidateAgg?.avgGuardrailFailures
8578
+ candidateAgg?.avgGuardrailFailures,
8579
+ true,
8580
+ tolerance
8569
8581
  );
8570
8582
  if (item) comparisons.push(item);
8571
8583
  break;
@@ -8575,7 +8587,9 @@ function compareCohortAggregates(groups, options) {
8575
8587
  metric,
8576
8588
  "Circuit violations",
8577
8589
  baselineAgg?.avgCircuitViolations,
8578
- candidateAgg?.avgCircuitViolations
8590
+ candidateAgg?.avgCircuitViolations,
8591
+ true,
8592
+ tolerance
8579
8593
  );
8580
8594
  if (item) comparisons.push(item);
8581
8595
  break;
@@ -8585,7 +8599,9 @@ function compareCohortAggregates(groups, options) {
8585
8599
  metric,
8586
8600
  "Redaction warnings",
8587
8601
  baselineAgg?.avgRedactionWarnings,
8588
- candidateAgg?.avgRedactionWarnings
8602
+ candidateAgg?.avgRedactionWarnings,
8603
+ true,
8604
+ tolerance
8589
8605
  );
8590
8606
  if (item) comparisons.push(item);
8591
8607
  break;
@@ -9677,7 +9693,7 @@ var require_bindings = __commonJS({
9677
9693
  "node_modules/.pnpm/bindings@1.5.0/node_modules/bindings/bindings.js"(exports$1, module) {
9678
9694
  var fs = __require("fs");
9679
9695
  var path37 = __require("path");
9680
- var fileURLToPath2 = require_file_uri_to_path();
9696
+ var fileURLToPath3 = require_file_uri_to_path();
9681
9697
  var join = path37.join;
9682
9698
  var dirname = path37.dirname;
9683
9699
  var exists2 = fs.accessSync && function(path38) {
@@ -9789,7 +9805,7 @@ var require_bindings = __commonJS({
9789
9805
  Error.stackTraceLimit = origSTL;
9790
9806
  var fileSchema = "file://";
9791
9807
  if (fileName.indexOf(fileSchema) === 0) {
9792
- fileName = fileURLToPath2(fileName);
9808
+ fileName = fileURLToPath3(fileName);
9793
9809
  }
9794
9810
  return fileName;
9795
9811
  };
@@ -10788,7 +10804,7 @@ var init_src = __esm({
10788
10804
  });
10789
10805
 
10790
10806
  // package.json
10791
- var version = "6.7.2";
10807
+ var version = "6.7.3";
10792
10808
 
10793
10809
  // packages/cli/src/list.ts
10794
10810
  init_advanced();
@@ -11749,13 +11765,14 @@ function parseTimestamp(v) {
11749
11765
  function hasToken(hay, token) {
11750
11766
  return hay.includes(token);
11751
11767
  }
11768
+ var ERROR_TOKEN_RE = /\.(error|failed)(\.|$)/;
11752
11769
  function inferKind(eventName) {
11753
11770
  if (hasToken(eventName, ".llm.")) return "LLM";
11754
11771
  if (hasToken(eventName, ".tool.")) return "TOOL";
11755
11772
  if (hasToken(eventName, ".agent.")) return "AGENT";
11756
11773
  if (hasToken(eventName, ".retriever.")) return "RETRIEVER";
11757
11774
  if (hasToken(eventName, ".result.")) return "RESULT";
11758
- if (eventName.endsWith(".error") || eventName.endsWith(".failed") || eventName.includes(".error") || eventName.includes(".failed")) {
11775
+ if (ERROR_TOKEN_RE.test(eventName)) {
11759
11776
  return "ERROR";
11760
11777
  }
11761
11778
  return "LOG";
@@ -11835,7 +11852,7 @@ var EventNormalizer = class {
11835
11852
  status = mapping.status;
11836
11853
  } else if (mapping?.kind === "ERROR") {
11837
11854
  status = "error";
11838
- } else if (eventName.includes(".failed") || eventName.includes(".error")) {
11855
+ } else if (ERROR_TOKEN_RE.test(eventName)) {
11839
11856
  status = "error";
11840
11857
  } else if (mapping?.startsRun || mapping?.startsStep) {
11841
11858
  status = "running";
@@ -13038,6 +13055,11 @@ init_helpers();
13038
13055
  function hexFrom(seed, byteLen) {
13039
13056
  return crypto__default.default.createHash("sha256").update(seed, "utf8").digest("hex").slice(0, byteLen * 2);
13040
13057
  }
13058
+ function unixNano(ms) {
13059
+ const whole = Math.trunc(ms);
13060
+ const fractionNs = Math.round((ms - whole) * 1e6);
13061
+ return BigInt(whole) * 1000000n + BigInt(fractionNs);
13062
+ }
13041
13063
  function mapInspectKindToOI(kind, warnings) {
13042
13064
  switch (kind) {
13043
13065
  case "LLM":
@@ -13087,10 +13109,10 @@ function exportOpenInference(tree, options) {
13087
13109
  const ev = n.event;
13088
13110
  const spanId = hexFrom(`${tree.runId}:${ev.eventId}`, 8);
13089
13111
  const parentSpanHex = ev.parentId ? hexFrom(`${tree.runId}:${ev.parentId}`, 8) : void 0;
13090
- const startNs = Math.round(ev.timestamp * 1e6);
13112
+ const startNs = unixNano(ev.timestamp);
13091
13113
  let endNs;
13092
13114
  if (ev.durationMs !== void 0 && Number.isFinite(ev.durationMs)) {
13093
- endNs = startNs + Math.round(ev.durationMs * 1e6);
13115
+ endNs = startNs + unixNano(ev.durationMs);
13094
13116
  }
13095
13117
  const { openInferenceKind } = mapInspectKindToOI(ev.kind, warnings);
13096
13118
  const attrs = {
@@ -13138,8 +13160,8 @@ function exportOpenInference(tree, options) {
13138
13160
  span_id: spanId,
13139
13161
  parent_span_id: parentSpanHex,
13140
13162
  name: ev.name,
13141
- start_time_unix_nano: startNs,
13142
- end_time_unix_nano: endNs,
13163
+ start_time_unix_nano: startNs.toString(),
13164
+ end_time_unix_nano: endNs?.toString(),
13143
13165
  attributes: attrs,
13144
13166
  status
13145
13167
  });
@@ -13891,6 +13913,10 @@ function manualTraceEventsToComparableRun(events) {
13891
13913
  meta2 = { ...meta2 ?? {}, agent_inspect_diff_parent_missing: true };
13892
13914
  }
13893
13915
  const outputPreview = extractOutputPreview(meta2);
13916
+ if (meta2 !== void 0 && ("outputPreview" in meta2 || "resultPreview" in meta2)) {
13917
+ delete meta2.outputPreview;
13918
+ delete meta2.resultPreview;
13919
+ }
13894
13920
  const sc = {
13895
13921
  id: acc.id,
13896
13922
  name: acc.name,
@@ -14540,6 +14566,7 @@ async function searchCommand(options = {}) {
14540
14566
  console.log(`Session not found: ${sessionId}`);
14541
14567
  console.log(`Trace directory: ${traceDir}`);
14542
14568
  }
14569
+ process.exitCode = 1;
14543
14570
  return;
14544
14571
  }
14545
14572
  metas = scoped.metas;
@@ -18127,13 +18154,11 @@ async function studioCommand(options = {}) {
18127
18154
  await new Promise(() => {
18128
18155
  });
18129
18156
  }
18130
-
18131
- // packages/eval/src/index.ts
18132
18157
  function isTraceReadResult(value) {
18133
18158
  return value !== null && typeof value === "object" && "runs" in value && "events" in value && "format" in value;
18134
18159
  }
18135
18160
  function traceInputFrom(value) {
18136
- return { type: "file", path: value instanceof URL ? value.pathname : value };
18161
+ return { type: "file", path: value instanceof URL ? url.fileURLToPath(value) : value };
18137
18162
  }
18138
18163
  async function resolveRead(input3, options) {
18139
18164
  try {
@@ -20457,7 +20482,7 @@ jobs:
20457
20482
  async function planInit(options = {}) {
20458
20483
  const framework = normalizeFramework(options.framework);
20459
20484
  const cwd = path26__default.default.resolve(options.cwd ?? process.cwd());
20460
- const demoPath = framework === "custom" ? path26__default.default.join("examples", "agent-inspect-demo.mjs") : path26__default.default.join("examples", `agent-inspect-${framework}-demo.mjs`);
20485
+ const demoPath = framework === "custom" ? "examples/agent-inspect-demo.mjs" : `examples/agent-inspect-${framework}-demo.mjs`;
20461
20486
  const candidates = [
20462
20487
  { rel: CONFIG_FILE, content: configTemplate(framework) },
20463
20488
  { rel: GITKEEP, content: "" },