Switch to clawdis RPC mode and complete rebrand

This commit is contained in:
Peter Steinberger
2025-12-05 17:22:53 +00:00
parent 20cb709ae3
commit b3e50cbb33
26 changed files with 151 additions and 103 deletions

View File

@@ -46,6 +46,7 @@ export type SpawnResult = {
export type CommandOptions = {
timeoutMs: number;
cwd?: string;
input?: string;
};
export async function runCommandWithTimeout(
@@ -56,12 +57,12 @@ export async function runCommandWithTimeout(
typeof optionsOrTimeout === "number"
? { timeoutMs: optionsOrTimeout }
: optionsOrTimeout;
const { timeoutMs, cwd } = options;
const { timeoutMs, cwd, input } = options;
// Spawn with inherited stdin (TTY) so tools like `claude` don't hang.
return await new Promise((resolve, reject) => {
const child = spawn(argv[0], argv.slice(1), {
stdio: ["inherit", "pipe", "pipe"],
stdio: [input ? "pipe" : "inherit", "pipe", "pipe"],
cwd,
});
let stdout = "";
@@ -71,6 +72,11 @@ export async function runCommandWithTimeout(
child.kill("SIGKILL");
}, timeoutMs);
if (input && child.stdin) {
child.stdin.write(input);
child.stdin.end();
}
child.stdout?.on("data", (d) => {
stdout += d.toString();
});