import type { TaskResultMessage } from './protocol.ts'; /** * Hard ceiling on unsent `taskResult` frames buffered for resend across a * reconnect. Reaching it triggers intake backpressure on the worker so the * buffer cannot grow without bound; completed results are never dropped. */ export declare const MAX_BUFFERED_TASK_RESULTS = 1000; /** * Whether the outbox is at or above its ceiling. Extracted as a pure helper so * the backpressure threshold is unit-testable without fabricating a full buffer. */ export declare function isOutboxFull(size: number, max: number): boolean; /** * Buffers terminal task results that could not be sent immediately so the * worker can re-send them after a reconnect rather than silently dropping them * (a dropped result would be redelivered by the server and re-execute the * activity). Keyed by `operationId`: a `Map` gives dedup-by-operation and * deterministic insertion-order flush in one structure. */ export declare class TaskResultOutbox { #private; constructor(max?: number); /** Current number of buffered results. */ get size(): number; /** Whether the buffer is at or above its ceiling. */ get full(): boolean; /** * Warn at most once that the buffer is full. Returns `true` the first time it * is called after the cap is reached, so the caller can emit a single log. */ shouldWarnFull(): boolean; /** Buffer (or replace by `operationId`) a result for later resend. */ buffer(message: TaskResultMessage): void; /** Drop a buffered result once it has been confirmed sent. */ delete(operationId: string): void; /** Snapshot of buffered results in insertion (flush) order. */ drainOrder(): TaskResultMessage[]; /** Discard all buffered results (terminal disposal). */ clear(): void; }