/** * @license * Copyright 2026 Steven Roussey * SPDX-License-Identifier: Apache-2.0 */ /** * Bridge between a synchronous `push(event)` producer and a `for await ... of` * consumer. Used by {@link StreamingAiTask.executeStream} to forward events * from a Promise+emit run-fn to its `AsyncIterable` consumer * (StreamProcessor / task-graph runner). * * Holds at most the events buffered between an `emit()` and the next iteration * step — naturally bounded by consumer pacing. The queue does **not** * accumulate beyond that; if the consumer keeps up, the queue is essentially * empty at every step. This is not a buffer for materializing `O` — that lives * at terminal-consumer sites. * * Termination: `close()` ends the stream cleanly; `fail(err)` makes the next * iteration step `throw`. Both are idempotent — later pushes / closes / fails * after the first terminal signal are ignored. * * **Single-consumer.** The waker pattern stores at most one pending resolver, * so the `iterable` must be consumed by exactly one `for await` loop. Multiple * concurrent iterators are not supported and will hang. This matches the * intended use site ({@link StreamingAiTask.executeStream}, which iterates * once). */ export interface EmitQueue { push(event: E): void; close(): void; fail(err: unknown): void; readonly iterable: AsyncIterable; } export declare function createEmitQueue(): EmitQueue; //# sourceMappingURL=emitQueue.d.ts.map