chore(vendor): import pi 1.3.0
Imported as a linear vendor commit so forge rebases do not replay the upstream root tree. git-subtree-dir: third_party/pi git-subtree-split: 71023aec1546d6d677a65669c5665c0927ce0dd0
This commit is contained in:
1 parent
719370c8f7
commit
6081e3e325
1743 files changed
+205459
-131704
No files matched your search
@@ -0,0 +1,27 @@
|
||||
import { createInterface } from "node:readline";
|
||||
|
||||
console.error("stdio fixture ready");
|
||||
const lines = createInterface({ input: process.stdin, crlfDelay: Infinity });
|
||||
|
||||
for await (const line of lines) {
|
||||
const message = JSON.parse(line);
|
||||
if (!("id" in message)) continue;
|
||||
let result;
|
||||
if (message.method === "initialize") {
|
||||
result = {
|
||||
protocolVersion: "2025-06-18",
|
||||
capabilities: { tools: {} },
|
||||
serverInfo: { name: "stdio-fixture", version: "1.0.0" },
|
||||
};
|
||||
} else if (message.method === "tools/list") {
|
||||
result = { tools: [{ name: "echo", inputSchema: { type: "object" } }] };
|
||||
} else if (message.method === "tools/call") {
|
||||
result = { content: [{ type: "text", text: String(message.params.arguments.text) }] };
|
||||
} else if (message.method === "ping") {
|
||||
result = {};
|
||||
} else {
|
||||
process.stdout.write(`${JSON.stringify({ jsonrpc: "2.0", id: message.id, error: { code: -32601, message: "not found" } })}\n`);
|
||||
continue;
|
||||
}
|
||||
process.stdout.write(`${JSON.stringify({ jsonrpc: "2.0", id: message.id, result })}\n`);
|
||||
}
|
||||
Reference in new issue
Block a user