export type OutputStream = { off?(event: "error", listener: (error: unknown) => void): void; on?(event: "error", listener: (error: unknown) => void): void; write(chunk: string): void; }; export type BrokenPipeState = { closed: boolean; }; export declare function createBrokenPipeState(): BrokenPipeState; export declare function createSafeOutputStream(stream: OutputStream, brokenPipe: BrokenPipeState): OutputStream; export declare function withBrokenPipeGuard(streams: readonly OutputStream[], brokenPipe: BrokenPipeState, callback: () => Promise): Promise; export declare function addBrokenPipeListener(stream: OutputStream, brokenPipe: BrokenPipeState): () => void;