export declare class TimeoutError extends Error { readonly timeoutKind?: "idle" | "hard"; readonly lastProgress?: string; constructor(label: string, timeoutMs: number, details?: { kind?: "idle" | "hard"; lastProgress?: string; }); } export interface ProgressTimeoutControl { /** Aborted when a local deadline or the caller-owned signal is reached. */ signal: AbortSignal; /** Reset the idle deadline after a concrete unit of work completes. */ mark(label: string): void; } export interface ProgressTimeoutOptions { label: string; idleTimeoutMs: number; /** Optional local hard cap. Omit when the caller already owns the total deadline. */ hardTimeoutMs?: number; /** Optional deadline owned by the operation's caller. */ signal?: AbortSignal; } export interface TimeoutOptions { /** Optional caller-owned abort signal that should reject the waiter immediately. */ signal?: AbortSignal; /** Called when the caller-owned signal aborts; failures do not replace the abort reason. */ onAbort?: (reason: unknown) => void; /** Called when the local timeout fires; failures do not replace the timeout error. */ onTimeout?: (error: TimeoutError) => void; } export declare function withTimeout(promise: Promise, timeoutMs: number, label: string): Promise; export declare function withTimeoutThrow(promise: Promise, timeoutMs: number, label: string, options?: TimeoutOptions): Promise; /** * Run an operation with a resettable idle deadline and an optional hard cap. * * Callers must only call `mark` after meaningful progress. Use `hardTimeoutMs` * when this helper owns the total deadline. Omit it when an outer operation * already enforces that deadline. The supplied signal lets cooperative work * stop after either configured deadline. */ export declare function withProgressTimeoutThrow(operation: (control: ProgressTimeoutControl) => Promise, options: ProgressTimeoutOptions): Promise; export declare class StreamTimeoutError extends Error { readonly partialContent: string; constructor(timeoutMs: number, partialContent: string); } export declare class StreamSizeLimitError extends Error { readonly maxBytes: number; readonly bytesRead: number; constructor(maxBytes: number, bytesRead: number); } export declare function streamToString(stream: ReadableStream, timeoutMs?: number, maxBytes?: number): Promise; //# sourceMappingURL=stream-utils.d.ts.map