/** * The abortable, bounded waits the application command mailbox exposes * (WFT-84): waiting for work to become due, and waiting for a cancelled * command's claimant to settle. * * Both are polling waits. Cross-process wakeup has no push channel — another * process's admission is only visible in durable storage — so a poll is the * honest mechanism rather than a subscription that would silently miss remote * work. Every wait is bounded by a caller-supplied deadline, respects a * caller-supplied `AbortSignal`, and unwinds cleanly when the mailbox is * disposed mid-wait: the timer is cleared and both abort listeners are removed * on every settlement path, so no wait can outlive its mailbox. * * Waiting never claims, starts, or advances durable work. * * @module core/mailbox-waits */ import { delayUnlessAborted } from './application-primitive-timing.ts'; import type { ApplicationCommandCleanupResult, MailboxWaitOptions } from './mailbox-contract.ts'; import type { MailboxRuntime } from './mailbox-internals.ts'; export { DEFAULT_WAIT_POLL_INTERVAL_MS as DEFAULT_MAILBOX_POLL_INTERVAL_MS } from './mailbox-validation.ts'; export { delayUnlessAborted }; /** * Whether the FIFO head exists and is claimable right now. * * The absolute deadline counts as well as availability. A head that is due but * already expired is not deliverable — `claim()` would terminalize it and report * `empty` — so reporting it as available would advertise work that does not * exist. */ export declare function hasDueWork(runtime: MailboxRuntime): Promise; /** * Wait, bounded and abortably, until this mailbox has work due for delivery. * * Returns `true` when the FIFO head is claimable and `false` when the wait was * aborted, the mailbox was disposed, or the timeout elapsed first. */ export declare function waitForAvailableWork(runtime: MailboxRuntime, disposal: AbortSignal, options?: MailboxWaitOptions): Promise; /** * Wait, bounded, for a cancelled command's claimant to settle. * * A `pending` result means this mailbox stopped waiting — never that the * handler stopped. */ export declare function waitForCleanup(runtime: MailboxRuntime, disposal: AbortSignal, options: { readonly commandId: string; readonly timeoutMs: number; readonly signal?: AbortSignal | undefined; readonly pollIntervalMs?: number | undefined; }): Promise;