import type { StreamFrame } from '../types/stream/StreamFrame.js'; import type { StreamHandle } from '../types/stream/StreamHandle.js'; /** * Result of routing a stream frame or error to a pending stream session. * * @group Event bridge */ export type PushResult = 'accepted' | 'late' | 'missing'; /** * Mutable stream session stored for one pending stream invocation. * * @group Event bridge */ export type PendingStreamSession = { /** Async-iterable handle returned to the stream caller. */ handle: StreamHandle; /** Push one correlated stream frame into the session. */ push: (frame: StreamFrame) => PushResult; /** Reject the stream handle and any waiting iterator calls. */ reject: (error: unknown) => void; /** Record the producer instance and return a queued cancel reason, if any. */ markOwner: (instanceId: string) => string | undefined; /** Request caller cancellation and report whether a cancel frame should be sent. */ requestCancel: (reason?: string) => { ownerInstanceId?: string; reason?: string; shouldSend: boolean; }; }; /** * Registry for stream invocations awaiting correlated frames. * * Streams time out when frames stop arriving. Timed-out stream ids are retained * briefly so late frames can be classified and logged without reaching a closed * async iterator. * * @group Event bridge */ export declare class PendingStreamRegistry { private readonly options; private readonly pending; private readonly timedOut; constructor(options?: { retentionMs?: number; onLateFrame?: (correlationId: string) => void; }); /** Number of streams currently awaiting frames. */ get size(): number; /** Register one stream session and create its async-iterable handle. */ register(correlationId: string, timeoutMs: number, traceId: string | undefined): PendingStreamSession; /** Return a pending stream session by correlation id. */ get(correlationId: string): PendingStreamSession | undefined; /** Reject one pending stream or classify it as late/missing. */ reject(correlationId: string, error: unknown): "rejected" | PushResult; rejectAll(error: unknown): void; clear(): void; private handleMissing; private cleanupTimedOut; } //# sourceMappingURL=PendingStreamRegistry.impl.d.ts.map