mirror of
https://github.com/morluto/rea.git
synced 2026-11-11 01:13:39 +00:00
* test: focus configuration diagnostics on their owners Preserve shape errors, selected paths, recovery guidance, and unchanged-file behavior across parser, setup, and uninstall boundaries. * test: focus artifact and evidence checks on behavior Retain format, identity, malformed-input, and cleanup coverage while removing fixed prose and closing the admitted test source. * refactor(debugger): use configured session admission limits * test: focus evidence and diagnostics on behavior * fix(test): restore verifier export and formatting * test(config): verify debugger limit ranges * test(rizin): keep fixture executable authoritative * test(rizin): isolate debugger fixture environment
57 lines
1.7 KiB
JavaScript
57 lines
1.7 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] === "inventory") {
|
|
const removed = snapshot.tools.tools.findIndex(
|
|
(tool) => tool.name !== "binary_session",
|
|
);
|
|
const [template] = snapshot.tools.tools.splice(removed, 1);
|
|
const unexpected = { ...template, name: "doctor_unexpected_fixture" };
|
|
snapshot.tools.tools.push(unexpected, unexpected);
|
|
}
|
|
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`,
|
|
);
|
|
});
|