fix(interactive-subagents): harden parallel lifecycle delivery
This commit is contained in:
@@ -112,8 +112,27 @@ export async function readScreenAsync(surface: string, lines = 50): Promise<stri
|
||||
return stdout;
|
||||
}
|
||||
|
||||
export async function isSurfaceAlive(surface: string, signal?: AbortSignal): Promise<boolean> {
|
||||
requireTmux();
|
||||
try {
|
||||
await execFileAsync("tmux", ["display-message", "-p", "-t", surface, "#{pane_id}"], {
|
||||
encoding: "utf8",
|
||||
timeout: 5_000,
|
||||
killSignal: "SIGKILL",
|
||||
signal,
|
||||
});
|
||||
return true;
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
export function closeSurface(surface: string): void {
|
||||
requireTmux();
|
||||
execFileSync("tmux", ["kill-pane", "-t", surface], { encoding: "utf8" });
|
||||
try {
|
||||
execFileSync("tmux", ["kill-pane", "-t", surface], { encoding: "utf8" });
|
||||
} catch {
|
||||
// Replaced-shell launches may close their own pane before cleanup.
|
||||
}
|
||||
rebalanceSurfaces();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user