import { WorkerPool } from '../../core/types'; /** * Options for configuring the TransientWorkerPool. */ export interface TransientWorkerPoolOptions { /** * Custom worker URL to use for all workers in the pool. */ workerURL?: string | URL | undefined; } /** * A pool that creates transient workers which are automatically terminated after each job. * * This pool is designed for the default worker pool to prevent workers from staying alive * and blocking process exit. Each worker is terminated immediately after the job completes. * * @remarks * **Design Rationale:** * * Unlike {@link ReusableWorkerPool} which keeps workers alive for reuse, `TransientWorkerPool` * terminates workers after each job. This is specifically designed for the internal default pool * to avoid requiring users to call `terminateWorkers()` for process cleanup. * * **Characteristics:** * - Workers are created on-demand * - Workers are terminated immediately after job completion * - No persistent worker instances * - Prevents process from hanging due to active workers * * @internal */ export declare class TransientWorkerPool implements WorkerPool, Disposable { private requestId; private readonly customWorkerURL?; /** * Create a new TransientWorkerPool. * * @param options - Configuration options for the pool */ constructor(options?: TransientWorkerPoolOptions); /** * Get a worker instance. * Always creates a new worker for transient usage. * * @param workerURL - Optional custom worker URL (overrides pool's workerURL) * @returns A new worker instance * @internal */ getWorker(workerURL?: string | URL): Promise; /** * Get the next request ID for this pool. * * @returns The next request ID * @internal */ getNextRequestId(): number; /** * Release a worker back to the pool. * For TransientWorkerPool, this terminates the worker immediately. * * @param worker - The worker to release * @internal */ releaseWorker(worker: Worker): void; /** * Get the current number of workers in the pool. * For TransientWorkerPool, this is always 0 as workers are not kept alive. * * @returns Always 0 */ get size(): number; /** * Check if the pool has reached its maximum capacity. * For TransientWorkerPool, this is always false as workers are transient. * * @returns Always false */ isFull(): boolean; /** * Terminate all workers in the pool. * For TransientWorkerPool, this is a no-op as workers are not kept alive. */ terminate(): void; /** * Dispose of the worker pool. * For TransientWorkerPool, this is a no-op as workers are not kept alive. */ [Symbol.dispose](): void; }