@agent-inspect/mcp-server 6.31.32 → 6.31.33

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
@@ -3612,6 +3612,11 @@ function compareFindings(eventById) {
3612
3612
  if (STATUS_RANK[a.status] !== STATUS_RANK[b.status]) {
3613
3613
  return STATUS_RANK[a.status] - STATUS_RANK[b.status];
3614
3614
  }
3615
+ if (a.ruleId === "tool.usage") {
3616
+ const aHasEvent = a.evidence[0]?.eventId !== void 0;
3617
+ const bHasEvent = b.evidence[0]?.eventId !== void 0;
3618
+ if (aHasEvent !== bHasEvent) return aHasEvent ? -1 : 1;
3619
+ }
3615
3620
  const byRun = compareStrings(a.evidence[0]?.runId, b.evidence[0]?.runId);
3616
3621
  if (byRun !== 0) return byRun;
3617
3622
  const byTime = eventTimestamp(a, eventById).localeCompare(eventTimestamp(b, eventById));
@@ -3695,6 +3700,43 @@ function failFinding(ruleId, message, evidence, expected, actual, meta) {
3695
3700
  ...meta?.action !== void 0 ? { action: meta.action } : {}
3696
3701
  };
3697
3702
  }
3703
+ function formatToolNameForMessage(name) {
3704
+ const details = [];
3705
+ for (let index = 0; index < name.length; ) {
3706
+ const codePoint = name.codePointAt(index);
3707
+ const width = codePoint > 65535 ? 2 : 1;
3708
+ if (codePoint > 127) {
3709
+ details.push(
3710
+ `U+${codePoint.toString(16).toUpperCase().padStart(4, "0")} at index ${index}`
3711
+ );
3712
+ }
3713
+ index += width;
3714
+ }
3715
+ if (details.length === 0) return name;
3716
+ return `"${name}" (contains ${details.join("; ")})`;
3717
+ }
3718
+ function describeRunningEvent(event) {
3719
+ if (event.kind === "TOOL") {
3720
+ return `tool ${formatToolNameForMessage(resolveCanonicalToolName(event))}`;
3721
+ }
3722
+ if (event.kind === "LLM") {
3723
+ return `llm ${stepEndpointName(event)}`;
3724
+ }
3725
+ return `${event.kind} ${event.name}`;
3726
+ }
3727
+ function incompleteRunningMessage(prefix, running) {
3728
+ const labels = running.map(describeRunningEvent);
3729
+ if (labels.length === 1) {
3730
+ return `${prefix}: ${labels[0]} never completed.`;
3731
+ }
3732
+ return `${prefix}: ${labels.join("; ")}.`;
3733
+ }
3734
+ function stepEndpointName(event, kind) {
3735
+ for (const prefix of ["llm:", "generation:", "transcription:", "speech:"]) {
3736
+ if (event.name.startsWith(prefix)) return event.name.slice(prefix.length);
3737
+ }
3738
+ return event.name;
3739
+ }
3698
3740
  function semanticEvents(context) {
3699
3741
  return context.logicalEvents ?? context.events;
3700
3742
  }
@@ -3823,10 +3865,13 @@ function createRunStatusRule(options = {}) {
3823
3865
  findings.push(
3824
3866
  failFinding(
3825
3867
  "run.status",
3826
- "Run contains incomplete running events.",
3868
+ incompleteRunningMessage("Run contains incomplete running events", running),
3827
3869
  running.map((event) => eventEvidence(event)),
3828
3870
  "no running events",
3829
- running.length
3871
+ {
3872
+ count: running.length,
3873
+ unfinished: running.map(describeRunningEvent)
3874
+ }
3830
3875
  )
3831
3876
  );
3832
3877
  }