@agent-inspect/mcp-server 6.12.2 → 6.14.0

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.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { runReadOnlyMcpServer } from './chunk-J72IWHQK.mjs';
1
+ import { runReadOnlyMcpServer } from './chunk-C6EBJS57.mjs';
2
2
  import { readFileSync } from 'fs';
3
3
  import path from 'path';
4
4
  import { fileURLToPath } from 'url';
package/dist/index.cjs CHANGED
@@ -2106,6 +2106,7 @@ function buildEvidenceManifest(parts) {
2106
2106
  verificationPolicy: parts.verificationPolicy ?? parts.redactionProfile
2107
2107
  },
2108
2108
  assessment,
2109
+ ...parts.semantics !== void 0 ? { semantics: { ...parts.semantics } } : {},
2109
2110
  files: buildEvidenceFileEntries(parts.files)
2110
2111
  };
2111
2112
  }
@@ -2773,11 +2774,16 @@ function projectLogicalEvents(events) {
2773
2774
  }
2774
2775
  if (!remapped) {
2775
2776
  if (!logicalById.has(originalParentId) && !logicalByRawId.has(originalParentId)) {
2776
- diagnostics.push({
2777
- code: "AI_LOGICAL_PARENT_UNRESOLVED",
2778
- message: `Parent ${originalParentId} unresolved for ${event.eventId}.`,
2779
- eventIds: [event.eventId]
2780
- });
2777
+ const mapping = event.attributes?.parentMapping;
2778
+ const unresolved = mapping === "unresolved" || event.attributes?.parentUnresolved === true || event.attributes?.unresolvedParent === true || // LangGraph/framework scaffolding sentinel labels are not event ids.
2779
+ /^LangGraph$/i.test(originalParentId) || originalParentId.startsWith("unresolved:");
2780
+ if (!unresolved) {
2781
+ diagnostics.push({
2782
+ code: "AI_LOGICAL_PARENT_UNRESOLVED",
2783
+ message: `Parent ${originalParentId} unresolved for ${event.eventId}.`,
2784
+ eventIds: [event.eventId]
2785
+ });
2786
+ }
2781
2787
  }
2782
2788
  normalized.push(event);
2783
2789
  continue;
@@ -2808,6 +2814,84 @@ function projectLogicalEvents(events) {
2808
2814
  diagnostics: Object.freeze(diagnostics)
2809
2815
  };
2810
2816
  }
2817
+ function resolveCanonicalToolName(event) {
2818
+ const attrs = event.attributes;
2819
+ const direct = pickString(attrs, ["toolName", "tool"]);
2820
+ if (direct) return direct;
2821
+ const metadata = attrs?.metadata;
2822
+ if (isRecord6(metadata)) {
2823
+ const nested = pickString(metadata, ["toolName", "tool"]);
2824
+ if (nested) return nested;
2825
+ }
2826
+ for (const prefix of ["tool:", "function:", "mcp-tools:"]) {
2827
+ if (event.name.startsWith(prefix)) return event.name.slice(prefix.length);
2828
+ }
2829
+ return event.name;
2830
+ }
2831
+ function pickString(record, keys) {
2832
+ if (!record) return void 0;
2833
+ for (const key of keys) {
2834
+ const value = record[key];
2835
+ if (typeof value === "string" && value.trim() !== "") return value.trim();
2836
+ }
2837
+ return void 0;
2838
+ }
2839
+
2840
+ // packages/core/src/checks/trace-facts.ts
2841
+ function summarizeSemanticParity(events) {
2842
+ const projection = projectLogicalEvents(events);
2843
+ const logical = projection.logicalEvents;
2844
+ const finishedTools = logical.filter(
2845
+ (event) => event.kind === "TOOL" && event.status !== "running"
2846
+ );
2847
+ const finishedToolNames = Object.freeze(
2848
+ finishedTools.map((event) => resolveCanonicalToolName(event)).sort((a, b) => a.localeCompare(b))
2849
+ );
2850
+ return {
2851
+ rawEventCount: events.length,
2852
+ logicalEventCount: logical.length,
2853
+ runningLogicalCount: logical.filter((event) => event.status === "running").length,
2854
+ finishedToolNames,
2855
+ finishedToolCount: finishedTools.length,
2856
+ pairedCount: logical.filter((event) => event.projection.paired).length,
2857
+ parentRemapCount: projection.diagnostics.filter(
2858
+ (item) => item.code === "AI_LOGICAL_PARENT_REMAPPED"
2859
+ ).length,
2860
+ diagnostics: projection.diagnostics
2861
+ };
2862
+ }
2863
+ function buildTraceFacts(events) {
2864
+ const projection = projectLogicalEvents(events);
2865
+ const toolsByName = /* @__PURE__ */ new Map();
2866
+ const llmEvents = [];
2867
+ const outcomeEvents = [];
2868
+ for (const event of projection.logicalEvents) {
2869
+ if (event.kind === "TOOL" && event.status !== "running") {
2870
+ const name = resolveCanonicalToolName(event);
2871
+ const list = toolsByName.get(name) ?? [];
2872
+ list.push(event);
2873
+ toolsByName.set(name, list);
2874
+ }
2875
+ if (event.kind === "LLM" && event.status !== "running") {
2876
+ llmEvents.push(event);
2877
+ }
2878
+ if (event.kind === "OUTCOME") {
2879
+ outcomeEvents.push(event);
2880
+ }
2881
+ }
2882
+ for (const [name, list] of [...toolsByName.entries()]) {
2883
+ toolsByName.set(name, Object.freeze([...list]));
2884
+ }
2885
+ return {
2886
+ rawEvents: Object.freeze([...events]),
2887
+ logicalEvents: projection.logicalEvents,
2888
+ diagnostics: projection.diagnostics,
2889
+ toolsByName,
2890
+ llmEvents: Object.freeze(llmEvents),
2891
+ outcomeEvents: Object.freeze(outcomeEvents),
2892
+ summary: summarizeSemanticParity(events)
2893
+ };
2894
+ }
2811
2895
 
2812
2896
  // packages/core/src/checks/index.ts
2813
2897
  var SEVERITY_RANK = {
@@ -6880,6 +6964,11 @@ var FLAGSHIP_TOOLS = [
6880
6964
  name: "get_adapter_diagnostics",
6881
6965
  description: "Bounded adapter/source diagnostics for one run.",
6882
6966
  inputSchema: RUN_ID_SCHEMA
6967
+ },
6968
+ {
6969
+ name: "get_trace_facts",
6970
+ description: "Bounded TraceFacts summary for one run (logical projection counts and finished tool names; no raw prompts).",
6971
+ inputSchema: RUN_ID_SCHEMA
6883
6972
  }
6884
6973
  ];
6885
6974
  var LEGACY_TOOLS = [
@@ -7046,7 +7135,25 @@ async function callReadOnlyTool(context, name, args = {}) {
7046
7135
  sourceFile: path14__default.default.basename(meta.filePath),
7047
7136
  warnings: read.warnings.slice(0, 20),
7048
7137
  unsupportedFields: read.unsupportedFields.slice(0, 20),
7049
- note: "Bounded local diagnostics only; not a network health check."
7138
+ semanticParity: summarizeSemanticParity(read.events),
7139
+ note: "Bounded local diagnostics only; not a network health check. semanticParity uses logicalEvents projection."
7140
+ },
7141
+ context
7142
+ );
7143
+ }
7144
+ if (name === "get_trace_facts") {
7145
+ const runId = String(args.runId ?? "");
7146
+ const { read } = await openRunTrace(context, runId);
7147
+ const facts = buildTraceFacts(read.events);
7148
+ return deliverMcpPayload(
7149
+ {
7150
+ runId,
7151
+ projectionVersion: "logical-lifecycle-0.1",
7152
+ summary: facts.summary,
7153
+ toolNames: [...facts.toolsByName.keys()].sort((a, b) => a.localeCompare(b)),
7154
+ llmCount: facts.llmEvents.length,
7155
+ outcomeCount: facts.outcomeEvents.length,
7156
+ note: "Bounded TraceFacts summary only; raw events and prompts are not included."
7050
7157
  },
7051
7158
  context
7052
7159
  );