fix(interactive-subagents): avoid Orca polling fan-out
This commit is contained in:
@@ -14,6 +14,7 @@ const execFileAsync = promisify(execFile);
|
||||
|
||||
/** GNOME screen reader path — never a valid Orca CLI. */
|
||||
const GNOME_SCREEN_READER = "/usr/bin/orca";
|
||||
const ASYNC_READ_SCREEN_TIMEOUT_MS = 5_000;
|
||||
|
||||
let cachedCli: string | null | undefined;
|
||||
|
||||
@@ -275,14 +276,26 @@ export function readScreen(surface: string, lines = 50): string {
|
||||
return parseReadTail(output);
|
||||
}
|
||||
|
||||
export async function readScreenAsync(surface: string, lines = 50): Promise<string> {
|
||||
const cli = requireOrca();
|
||||
async function readScreenWithCli(
|
||||
cli: string,
|
||||
surface: string,
|
||||
lines: number,
|
||||
timeout = ASYNC_READ_SCREEN_TIMEOUT_MS,
|
||||
): Promise<string> {
|
||||
const { stdout } = await execFileAsync(cli, readScreenArgs(surface, lines), {
|
||||
encoding: "utf8",
|
||||
timeout,
|
||||
killSignal: "SIGKILL",
|
||||
});
|
||||
return parseReadTail(stdout);
|
||||
}
|
||||
|
||||
export async function readScreenAsync(surface: string, lines = 50): Promise<string> {
|
||||
return readScreenWithCli(requireOrca(), surface, lines);
|
||||
}
|
||||
|
||||
export const __orcaTest__ = { readScreenWithCli };
|
||||
|
||||
export function closeSurface(surface: string): void {
|
||||
const cli = requireOrca();
|
||||
const args = ["terminal", "close", "--terminal", surface];
|
||||
|
||||
Reference in New Issue
Block a user