feat: rpc bridge
This commit is contained in:
@@ -14,7 +14,7 @@ const packageJson = JSON.parse(readFileSync(join(__dirname, "../package.json"),
|
||||
|
||||
function printHelp(): void {
|
||||
console.log(
|
||||
`orchestrator v${packageJson.version}\n\nUsage:\n orchestrator serve\n orchestrator list\n orchestrator spawn [--cwd <path>] [--label <label>]\n orchestrator status <instance-id>\n orchestrator stop <instance-id>\n orchestrator --help\n orchestrator --version`,
|
||||
`orchestrator v${packageJson.version}\n\nUsage:\n orchestrator serve\n orchestrator list\n orchestrator spawn [--cwd <path>] [--label <label>]\n orchestrator status <instance-id>\n orchestrator stop <instance-id>\n orchestrator rpc <instance-id> <json-command>\n orchestrator --help\n orchestrator --version`,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -80,6 +80,23 @@ async function main(): Promise<void> {
|
||||
return;
|
||||
}
|
||||
|
||||
if (args[0] === "rpc") {
|
||||
const instanceId = args[1];
|
||||
const commandJson = args[2];
|
||||
if (!instanceId || !commandJson) {
|
||||
console.error("Usage: orchestrator rpc <instance-id> <json-command>");
|
||||
process.exit(1);
|
||||
}
|
||||
printResponse(
|
||||
await sendIpcRequest({
|
||||
type: "rpc",
|
||||
instanceId,
|
||||
command: JSON.parse(commandJson),
|
||||
}),
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
console.error(`Unknown command: ${args[0]}`);
|
||||
printHelp();
|
||||
process.exit(1);
|
||||
|
||||
Reference in New Issue
Block a user