mirror of
https://github.com/morluto/rea.git
synced 2026-10-19 04:19:54 -05:00
Explain recognized WASM v1 native-admission rejection with an exact call to the existing static inspection tool and its caller-supplied WABT prerequisites. Preserve selected paths, explicit raw-binary choices, typed missing-tool outcomes and connection usability. Refs #1852 Co-authored-by: SII-YDD <38822679+SII-YDD@users.noreply.github.com> Co-authored-by: Ysopwnable <161784452+N0zoM1z0@users.noreply.github.com> Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com> Co-authored-by: Kaoru0822 <208281322+kaoru0822-kitauji@users.noreply.github.com>
51 lines
1.6 KiB
TypeScript
51 lines
1.6 KiB
TypeScript
import { ok as resultOk } from "../../src/domain/result.js";
|
|
import { Client, InMemoryTransport } from "@modelcontextprotocol/client";
|
|
|
|
import { createTestBinarySession } from "./binarySession.js";
|
|
import type { BinarySession } from "../../src/application/binary/BinarySession.js";
|
|
import { observed } from "./analysisExecution.js";
|
|
import { createServer } from "../../src/server/createServer.js";
|
|
|
|
/** Owned MCP SDK session shared by application workflow scenarios. */
|
|
export interface ApplicationMcpHarness {
|
|
readonly client: Client;
|
|
readonly session: BinarySession;
|
|
readonly close: () => Promise<void>;
|
|
}
|
|
|
|
/** Connect application workflows through the production MCP registration. */
|
|
export async function createApplicationMcpHarness(
|
|
options: {
|
|
readonly session?: BinarySession;
|
|
readonly serverOptions?: Parameters<typeof createServer>[1];
|
|
} = {},
|
|
): Promise<ApplicationMcpHarness> {
|
|
const session =
|
|
options.session ??
|
|
createTestBinarySession(() => ({
|
|
execute: () => Promise.resolve(observed(null)),
|
|
close: () => Promise.resolve(resultOk(null)),
|
|
}));
|
|
const server = createServer(
|
|
{ kind: "session", session },
|
|
options.serverOptions,
|
|
);
|
|
const client = new Client({
|
|
name: "application-workflow-test",
|
|
version: "1",
|
|
});
|
|
const [clientTransport, serverTransport] =
|
|
InMemoryTransport.createLinkedPair();
|
|
|
|
await server.connect(serverTransport);
|
|
await client.connect(clientTransport);
|
|
|
|
return {
|
|
client,
|
|
session,
|
|
close: async () => {
|
|
await Promise.all([client.close(), server.close(), session.close()]);
|
|
},
|
|
};
|
|
}
|