@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.
@@ -3602,6 +3602,11 @@ function compareFindings(eventById) {
3602
3602
  if (STATUS_RANK[a.status] !== STATUS_RANK[b.status]) {
3603
3603
  return STATUS_RANK[a.status] - STATUS_RANK[b.status];
3604
3604
  }
3605
+ if (a.ruleId === "tool.usage") {
3606
+ const aHasEvent = a.evidence[0]?.eventId !== void 0;
3607
+ const bHasEvent = b.evidence[0]?.eventId !== void 0;
3608
+ if (aHasEvent !== bHasEvent) return aHasEvent ? -1 : 1;
3609
+ }
3605
3610
  const byRun = compareStrings(a.evidence[0]?.runId, b.evidence[0]?.runId);
3606
3611
  if (byRun !== 0) return byRun;
3607
3612
  const byTime = eventTimestamp(a, eventById).localeCompare(eventTimestamp(b, eventById));
@@ -3685,6 +3690,43 @@ function failFinding(ruleId, message, evidence, expected, actual, meta) {
3685
3690
  ...meta?.action !== void 0 ? { action: meta.action } : {}
3686
3691
  };
3687
3692
  }
3693
+ function formatToolNameForMessage(name) {
3694
+ const details = [];
3695
+ for (let index = 0; index < name.length; ) {
3696
+ const codePoint = name.codePointAt(index);
3697
+ const width = codePoint > 65535 ? 2 : 1;
3698
+ if (codePoint > 127) {
3699
+ details.push(
3700
+ `U+${codePoint.toString(16).toUpperCase().padStart(4, "0")} at index ${index}`
3701
+ );
3702
+ }
3703
+ index += width;
3704
+ }
3705
+ if (details.length === 0) return name;
3706
+ return `"${name}" (contains ${details.join("; ")})`;
3707
+ }
3708
+ function describeRunningEvent(event) {
3709
+ if (event.kind === "TOOL") {
3710
+ return `tool ${formatToolNameForMessage(resolveCanonicalToolName(event))}`;
3711
+ }
3712
+ if (event.kind === "LLM") {
3713
+ return `llm ${stepEndpointName(event)}`;
3714
+ }
3715
+ return `${event.kind} ${event.name}`;
3716
+ }
3717
+ function incompleteRunningMessage(prefix, running) {
3718
+ const labels = running.map(describeRunningEvent);
3719
+ if (labels.length === 1) {
3720
+ return `${prefix}: ${labels[0]} never completed.`;
3721
+ }
3722
+ return `${prefix}: ${labels.join("; ")}.`;
3723
+ }
3724
+ function stepEndpointName(event, kind) {
3725
+ for (const prefix of ["llm:", "generation:", "transcription:", "speech:"]) {
3726
+ if (event.name.startsWith(prefix)) return event.name.slice(prefix.length);
3727
+ }
3728
+ return event.name;
3729
+ }
3688
3730
  function semanticEvents(context) {
3689
3731
  return context.logicalEvents ?? context.events;
3690
3732
  }
@@ -3813,10 +3855,13 @@ function createRunStatusRule(options = {}) {
3813
3855
  findings.push(
3814
3856
  failFinding(
3815
3857
  "run.status",
3816
- "Run contains incomplete running events.",
3858
+ incompleteRunningMessage("Run contains incomplete running events", running),
3817
3859
  running.map((event) => eventEvidence(event)),
3818
3860
  "no running events",
3819
- running.length
3861
+ {
3862
+ count: running.length,
3863
+ unfinished: running.map(describeRunningEvent)
3864
+ }
3820
3865
  )
3821
3866
  );
3822
3867
  }
@@ -9994,5 +10039,5 @@ async function runReadOnlyMcpServer(options = {}) {
9994
10039
  }
9995
10040
 
9996
10041
  export { MCP_MAX_REQUEST_BYTES, MCP_PROTOCOL_VERSION, MCP_SERVER_INSTRUCTIONS, READ_ONLY_TOOLS, TRACE_DATA_UNTRUSTED_WARNING, callReadOnlyTool, createMcpServerContext, handleMcpProtocolLine, runReadOnlyMcpServer };
9997
- //# sourceMappingURL=chunk-RAPCVULK.mjs.map
9998
- //# sourceMappingURL=chunk-RAPCVULK.mjs.map
10042
+ //# sourceMappingURL=chunk-B7FCFNLA.mjs.map
10043
+ //# sourceMappingURL=chunk-B7FCFNLA.mjs.map