import type { FsDuplex } from "../fs-duplex/common.js"; export declare class DuplexClosedError extends Error { constructor(reason: string); } export declare class WaitTimeoutError extends Error { constructor(timeout: number); } interface WaitOptions { /** * Timeout in milliseconds. If the promise is not resolved within this time, it will be rejected. */ timeout?: number; /** * An optional filter function to apply to the data. The promise will only resolve if the data passes this filter. */ filter?: (data: T) => boolean; } /** * Waits for the next data event from an FsDuplex instance, with built-in safeguards. * This is a core utility for creating linear, async/await-based protocol handlers. * * @param duplex The FsDuplex instance to listen on. * @param options Optional configuration for timeout and filtering. * @returns A promise that resolves with the next data payload. * @rejects {DuplexClosedError} If the duplex channel closes while waiting. * @rejects {WaitTimeoutError} If the timeout is reached before data is received. */ export declare function waitNextTask(duplex: FsDuplex, options?: WaitOptions): Promise; export {}; //# sourceMappingURL=utils.d.ts.map