/** * Attempt-fenced settlement for the application delivery outbox (WFT-85): * marking an attempt begun, heartbeat, reporting the transport outcome, * cancellation, and the cleanup-state read. * * Every function proves the caller holds the current attempt before it writes * anything, and re-reads durable state after a lost compare-and-swap rather * than retrying with stale bytes. A stale claimant therefore cannot begin, * heartbeat, settle, or cancel a newer attempt. * * Heartbeat is the one mutation that emits no fleet event: it is liveness * evidence, not a disposition. * * @module core/outbox-settlement */ import type { JSONValue } from './json.ts'; import type { ApplicationDeliveryCancellationResult, ApplicationDeliveryCleanupResult, ApplicationDeliveryHeartbeatResult, ApplicationDeliverySettleResult } from './outbox-contract.ts'; import { type OutboxRuntime } from './outbox-internals.ts'; import type { ValidatedOutcome } from './outbox-validation.ts'; /** * Durably mark that the current attempt is about to call the transport. * `settled` here means the `attempting` record committed; the receipt says so. */ export declare function beginAttempt(runtime: OutboxRuntime, options: { readonly deliveryId: string; readonly attemptToken: string; }): Promise; /** * Record liveness and extend visibility for the current attempt, clamped to * the fixed attempt deadline. The returned `cancellationRequested` flag is the * cross-process cancellation channel. */ export declare function heartbeatAttempt(runtime: OutboxRuntime, options: { readonly deliveryId: string; readonly attemptToken: string; readonly transportActivity?: JSONValue | undefined; }): Promise; /** Settle the current attempt on a validated transport outcome. */ export declare function settleAttempt(runtime: OutboxRuntime, options: { readonly deliveryId: string; readonly attemptToken: string; readonly outcome: ValidatedOutcome; }): Promise; /** * Record a durable cancellation request and, when the claimant is in this * process, abort its attempt-scoped signal after the record commits. */ export declare function requestCancellation(runtime: OutboxRuntime, options: { readonly deliveryId: string; readonly reason?: string | undefined; }): Promise; /** * Read whether a cancelled delivery's attempt has finished. `pending` means * the outbox has not seen the attempt settle, never that the transport * stopped. */ export declare function readCleanupState(runtime: OutboxRuntime, deliveryId: string): Promise;