@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.
@@ -2096,6 +2096,7 @@ function buildEvidenceManifest(parts) {
2096
2096
  verificationPolicy: parts.verificationPolicy ?? parts.redactionProfile
2097
2097
  },
2098
2098
  assessment,
2099
+ ...parts.semantics !== void 0 ? { semantics: { ...parts.semantics } } : {},
2099
2100
  files: buildEvidenceFileEntries(parts.files)
2100
2101
  };
2101
2102
  }
@@ -2763,11 +2764,16 @@ function projectLogicalEvents(events) {
2763
2764
  }
2764
2765
  if (!remapped) {
2765
2766
  if (!logicalById.has(originalParentId) && !logicalByRawId.has(originalParentId)) {
2766
- diagnostics.push({
2767
- code: "AI_LOGICAL_PARENT_UNRESOLVED",
2768
- message: `Parent ${originalParentId} unresolved for ${event.eventId}.`,
2769
- eventIds: [event.eventId]
2770
- });
2767
+ const mapping = event.attributes?.parentMapping;
2768
+ const unresolved = mapping === "unresolved" || event.attributes?.parentUnresolved === true || event.attributes?.unresolvedParent === true || // LangGraph/framework scaffolding sentinel labels are not event ids.
2769
+ /^LangGraph$/i.test(originalParentId) || originalParentId.startsWith("unresolved:");
2770
+ if (!unresolved) {
2771
+ diagnostics.push({
2772
+ code: "AI_LOGICAL_PARENT_UNRESOLVED",
2773
+ message: `Parent ${originalParentId} unresolved for ${event.eventId}.`,
2774
+ eventIds: [event.eventId]
2775
+ });
2776
+ }
2771
2777
  }
2772
2778
  normalized.push(event);
2773
2779
  continue;
@@ -2798,6 +2804,84 @@ function projectLogicalEvents(events) {
2798
2804
  diagnostics: Object.freeze(diagnostics)
2799
2805
  };
2800
2806
  }
2807
+ function resolveCanonicalToolName(event) {
2808
+ const attrs = event.attributes;
2809
+ const direct = pickString(attrs, ["toolName", "tool"]);
2810
+ if (direct) return direct;
2811
+ const metadata = attrs?.metadata;
2812
+ if (isRecord6(metadata)) {
2813
+ const nested = pickString(metadata, ["toolName", "tool"]);
2814
+ if (nested) return nested;
2815
+ }
2816
+ for (const prefix of ["tool:", "function:", "mcp-tools:"]) {
2817
+ if (event.name.startsWith(prefix)) return event.name.slice(prefix.length);
2818
+ }
2819
+ return event.name;
2820
+ }
2821
+ function pickString(record, keys) {
2822
+ if (!record) return void 0;
2823
+ for (const key of keys) {
2824
+ const value = record[key];
2825
+ if (typeof value === "string" && value.trim() !== "") return value.trim();
2826
+ }
2827
+ return void 0;
2828
+ }
2829
+
2830
+ // packages/core/src/checks/trace-facts.ts
2831
+ function summarizeSemanticParity(events) {
2832
+ const projection = projectLogicalEvents(events);
2833
+ const logical = projection.logicalEvents;
2834
+ const finishedTools = logical.filter(
2835
+ (event) => event.kind === "TOOL" && event.status !== "running"
2836
+ );
2837
+ const finishedToolNames = Object.freeze(
2838
+ finishedTools.map((event) => resolveCanonicalToolName(event)).sort((a, b) => a.localeCompare(b))
2839
+ );
2840
+ return {
2841
+ rawEventCount: events.length,
2842
+ logicalEventCount: logical.length,
2843
+ runningLogicalCount: logical.filter((event) => event.status === "running").length,
2844
+ finishedToolNames,
2845
+ finishedToolCount: finishedTools.length,
2846
+ pairedCount: logical.filter((event) => event.projection.paired).length,
2847
+ parentRemapCount: projection.diagnostics.filter(
2848
+ (item) => item.code === "AI_LOGICAL_PARENT_REMAPPED"
2849
+ ).length,
2850
+ diagnostics: projection.diagnostics
2851
+ };
2852
+ }
2853
+ function buildTraceFacts(events) {
2854
+ const projection = projectLogicalEvents(events);
2855
+ const toolsByName = /* @__PURE__ */ new Map();
2856
+ const llmEvents = [];
2857
+ const outcomeEvents = [];
2858
+ for (const event of projection.logicalEvents) {
2859
+ if (event.kind === "TOOL" && event.status !== "running") {
2860
+ const name = resolveCanonicalToolName(event);
2861
+ const list = toolsByName.get(name) ?? [];
2862
+ list.push(event);
2863
+ toolsByName.set(name, list);
2864
+ }
2865
+ if (event.kind === "LLM" && event.status !== "running") {
2866
+ llmEvents.push(event);
2867
+ }
2868
+ if (event.kind === "OUTCOME") {
2869
+ outcomeEvents.push(event);
2870
+ }
2871
+ }
2872
+ for (const [name, list] of [...toolsByName.entries()]) {
2873
+ toolsByName.set(name, Object.freeze([...list]));
2874
+ }
2875
+ return {
2876
+ rawEvents: Object.freeze([...events]),
2877
+ logicalEvents: projection.logicalEvents,
2878
+ diagnostics: projection.diagnostics,
2879
+ toolsByName,
2880
+ llmEvents: Object.freeze(llmEvents),
2881
+ outcomeEvents: Object.freeze(outcomeEvents),
2882
+ summary: summarizeSemanticParity(events)
2883
+ };
2884
+ }
2801
2885
 
2802
2886
  // packages/core/src/checks/index.ts
2803
2887
  var SEVERITY_RANK = {
@@ -6870,6 +6954,11 @@ var FLAGSHIP_TOOLS = [
6870
6954
  name: "get_adapter_diagnostics",
6871
6955
  description: "Bounded adapter/source diagnostics for one run.",
6872
6956
  inputSchema: RUN_ID_SCHEMA
6957
+ },
6958
+ {
6959
+ name: "get_trace_facts",
6960
+ description: "Bounded TraceFacts summary for one run (logical projection counts and finished tool names; no raw prompts).",
6961
+ inputSchema: RUN_ID_SCHEMA
6873
6962
  }
6874
6963
  ];
6875
6964
  var LEGACY_TOOLS = [
@@ -7036,7 +7125,25 @@ async function callReadOnlyTool(context, name, args = {}) {
7036
7125
  sourceFile: path14.basename(meta.filePath),
7037
7126
  warnings: read.warnings.slice(0, 20),
7038
7127
  unsupportedFields: read.unsupportedFields.slice(0, 20),
7039
- note: "Bounded local diagnostics only; not a network health check."
7128
+ semanticParity: summarizeSemanticParity(read.events),
7129
+ note: "Bounded local diagnostics only; not a network health check. semanticParity uses logicalEvents projection."
7130
+ },
7131
+ context
7132
+ );
7133
+ }
7134
+ if (name === "get_trace_facts") {
7135
+ const runId = String(args.runId ?? "");
7136
+ const { read } = await openRunTrace(context, runId);
7137
+ const facts = buildTraceFacts(read.events);
7138
+ return deliverMcpPayload(
7139
+ {
7140
+ runId,
7141
+ projectionVersion: "logical-lifecycle-0.1",
7142
+ summary: facts.summary,
7143
+ toolNames: [...facts.toolsByName.keys()].sort((a, b) => a.localeCompare(b)),
7144
+ llmCount: facts.llmEvents.length,
7145
+ outcomeCount: facts.outcomeEvents.length,
7146
+ note: "Bounded TraceFacts summary only; raw events and prompts are not included."
7040
7147
  },
7041
7148
  context
7042
7149
  );
@@ -7479,5 +7586,5 @@ async function runReadOnlyMcpServer(options = {}) {
7479
7586
  }
7480
7587
 
7481
7588
  export { MCP_MAX_REQUEST_BYTES, MCP_PROTOCOL_VERSION, READ_ONLY_TOOLS, callReadOnlyTool, createMcpServerContext, handleMcpProtocolLine, runReadOnlyMcpServer };
7482
- //# sourceMappingURL=chunk-J72IWHQK.mjs.map
7483
- //# sourceMappingURL=chunk-J72IWHQK.mjs.map
7589
+ //# sourceMappingURL=chunk-C6EBJS57.mjs.map
7590
+ //# sourceMappingURL=chunk-C6EBJS57.mjs.map