/**
 * Stream Processor
 *
 * Core stream processing functionality for handling async iterables
 * with support for buffering, error handling, and lifecycle management.
 */
import { EventEmitter } from 'events';
export interface StreamProcessorOptions {
    /** Maximum buffer size before applying backpressure */
    maxBufferSize?: number;
    /** Timeout for stream operations in milliseconds */
    timeout?: number;
    /** Enable automatic retry on transient errors */
    autoRetry?: boolean;
    /** Maximum retry attempts */
    maxRetries?: number;
    /** Base delay for exponential backoff in milliseconds */
    retryBaseDelay?: number;
}
export interface StreamStats {
    chunksProcessed: number;
    bytesProcessed: number;
    startTime: number;
    endTime?: number;
    errors: number;
    retries: number;
}
export type StreamState = 'idle' | 'streaming' | 'paused' | 'completed' | 'error' | 'aborted';
export declare class StreamProcessor<T> extends EventEmitter {
    private buffer;
    private state;
    private stats;
    private abortController;
    private options;
    private pausePromise;
    private pauseResolve;
    constructor(options?: StreamProcessorOptions);
    private createInitialStats;
    /**
     * Process an async iterable stream
     */
    process(source: AsyncIterable<T>, transform?: (chunk: T) => T | Promise<T>): AsyncGenerator<T, void, unknown>;
    /**
     * Process stream with automatic retry on failure
     */
    processWithRetry(sourceFactory: () => AsyncIterable<T>, transform?: (chunk: T) => T | Promise<T>): AsyncGenerator<T, void, unknown>;
    /**
     * Collect all chunks from a stream
     */
    collect(source: AsyncIterable<T>): Promise<T[]>;
    /**
     * Reduce stream to a single value
     */
    reduce<R>(source: AsyncIterable<T>, reducer: (acc: R, chunk: T) => R | Promise<R>, initial: R): Promise<R>;
    /**
     * Pause stream processing
     */
    pause(): void;
    /**
     * Resume stream processing
     */
    resume(): void;
    /**
     * Abort stream processing
     */
    abort(): void;
    /**
     * Get current stream state
     */
    getState(): StreamState;
    /**
     * Get current stats
     */
    getStats(): StreamStats;
    /**
     * Get buffer size
     */
    getBufferSize(): number;
    /**
     * Check if stream is active
     */
    isActive(): boolean;
    private waitForBufferDrain;
    private calculateBackoff;
    private sleep;
    /**
     * Reset processor state
     */
    reset(): void;
}
