mirror of
https://github.com/morluto/rea.git
synced 2026-10-23 14:22:30 -05:00
Validate the target-free probe against the named definition discovered from the complete production catalog. Preserve initialized server and inventory observations when the SDK rejects the probe, and retain the schema failure reason, absolute deadline and owned-child cleanup. The negative stdio replay regression fails on original main and passes the fix; actual production-boundary fault injection confirms rejection. Nine doctor/help tests, serial full static checks and real small-target CLI/MCP parity pass. Successful doctor reports remain byte-identical. No performance or model-token reduction is claimed. Closes #1454. Refs #1065, #723, #1433.
49 lines
1.4 KiB
JavaScript
49 lines
1.4 KiB
JavaScript
import { readFile } from "node:fs/promises";
|
|
import { createInterface } from "node:readline";
|
|
|
|
const snapshot = JSON.parse(await readFile(process.argv[2], "utf8"));
|
|
const reply = structuredClone(snapshot.reply);
|
|
if (process.argv[3] === "invalid") {
|
|
reply.structuredContent.schema_violation_control = true;
|
|
reply.content = reply.content.map((item) =>
|
|
item.type === "text"
|
|
? { ...item, text: JSON.stringify(reply.structuredContent) }
|
|
: item,
|
|
);
|
|
}
|
|
|
|
const input = createInterface({ input: process.stdin });
|
|
input.on("line", (line) => {
|
|
const request = JSON.parse(line);
|
|
if (request.id === undefined) return;
|
|
let result;
|
|
switch (request.method) {
|
|
case "initialize":
|
|
result = {
|
|
protocolVersion: snapshot.protocolVersion,
|
|
capabilities: { tools: {}, prompts: {} },
|
|
serverInfo: snapshot.serverInfo,
|
|
};
|
|
break;
|
|
case "tools/list":
|
|
result = snapshot.tools;
|
|
break;
|
|
case "prompts/list":
|
|
result = snapshot.prompts;
|
|
break;
|
|
case "tools/call":
|
|
if (request.params.name === "binary_session") result = reply;
|
|
break;
|
|
case "ping":
|
|
result = {};
|
|
break;
|
|
}
|
|
const response =
|
|
result === undefined
|
|
? { error: { code: -32601, message: "Unknown fixture method or tool" } }
|
|
: { result };
|
|
process.stdout.write(
|
|
`${JSON.stringify({ jsonrpc: "2.0", id: request.id, ...response })}\n`,
|
|
);
|
|
});
|