Deliver complete Evidence directly through MCP with required nullable analysis profiles and immutable per-server delivery settings. Bind selected environments at construction and require typed cleanup outcomes with retained retry ownership. Remove test-only routing, duplicate session and snapshot metadata, producer-field repairs, and ambiguous provider arguments. Separate artifact byte identity from occurrence classification and retain typed source-map and partial native facts across CLI, MCP, and verifier consumers. BREAKING CHANGE: obsolete Evidence envelopes, session aliases, incomplete snapshots, and missing normalized producer facts are no longer accepted.
42 lines
1.6 KiB
TypeScript
42 lines
1.6 KiB
TypeScript
import { parseEvidence } from "../../../src/domain/evidence.js";
|
|
import type { CallToolResult } from "@modelcontextprotocol/server";
|
|
import { type JsonValue } from "../../../src/domain/jsonValue.js";
|
|
import { Client, InMemoryTransport } from "@modelcontextprotocol/client";
|
|
import type { AnalysisOperationPort } from "../../../src/application/AnalysisProvider.js";
|
|
import { createServer } from "../../../src/server/createServer.js";
|
|
|
|
export const PROCEDURES = {
|
|
"0x1": "_TtC7Fixture5Class",
|
|
"0x2": "_TtV7Fixture6Struct",
|
|
"0x3": "_TtP7Fixture8Protocol",
|
|
"0x4": "_TtO7Fixture4Enum",
|
|
"0x5": "_TtE7Fixture9Extension",
|
|
"0x6": "prefix_TtOther",
|
|
};
|
|
|
|
export const inventory = (values: Readonly<Record<string, string>>) =>
|
|
Object.entries(values).map(([address, value]) => ({ address, value }));
|
|
|
|
export const resources: Array<{ close(): Promise<void> }> = [];
|
|
|
|
export const connect = async (analysis: AnalysisOperationPort) => {
|
|
const server = createServer(analysis);
|
|
const client = new Client({ name: "enhanced-test", version: "1.0.0" });
|
|
const [clientTransport, serverTransport] =
|
|
InMemoryTransport.createLinkedPair();
|
|
resources.push(client, server);
|
|
await server.connect(serverTransport);
|
|
await client.connect(clientTransport);
|
|
return client;
|
|
};
|
|
|
|
/** Close every client/server pair opened by `connect` in this module. */
|
|
export const closeEnhancedToolResources = async (): Promise<void> => {
|
|
await Promise.all(
|
|
resources.splice(0).map(async (resource) => resource.close()),
|
|
);
|
|
};
|
|
|
|
export const jsonResult = (result: CallToolResult): JsonValue =>
|
|
parseEvidence(result.structuredContent).normalized_result;
|