import type { ProcessContext } from "../context.js"; import type { FlagPushEvent } from "../events.js"; /** * How long a marker may sit deferred behind a move before it is dropped * outright. A move that settles takes seconds to low minutes; one stuck past * this window has almost certainly already exhausted its own retries and been * resolved as broken by its own terminal resolver, so deferring further would * cycle one SQS round trip per sync tick forever instead of surfacing the * stall. */ export declare const FLAG_PUSH_DEFER_MAX_MS: number; /** * Handle FLAG_PUSH events (issue #1273, epic #1281). Drains ONE pending * flag-push marker: resolves the message's UID and CURRENT mailbox fresh * from the Message row (never a value captured at enqueue — invariant 1), * pushes the IMAP STORE (add or remove, per the marker's `operation`), and * clears the marker ONLY on confirmed success. * * Precedence (epic invariant 2): * - While pending, resync never reverts the flag — nothing in this handler * (or anywhere else) reads flags FROM IMAP back into `MessageFlag`/ * `ThreadMessage` for an existing row; the only flag-state writes happen * here (confirmed push) or in `FlagQueueService` (the user's own local * flip, which already applied before this marker existed). * - A later flip of the SAME field already replaced this marker (`put`) by * the time this event is processed, OR advanced it past `pending` — either * way `markerService.find` returns the CURRENT marker, so this handler * always drives the freshest intent, never a stale one. * - An external delete supersedes the marker entirely — handled by * `resolveExhaustedFlagPushFailure`'s `reconciled` outcome. * * Cursor-guarded (#1272, epic #1281 invariant 5): the connection is wrapped * via `guardConnectionCursor` around the mailbox's current `openBox` choke * point, so no stored UID touches the server while the mailbox's axis is * being rebuilt. A trip pauses the push (routine, no alarm) — the marker * stays durable and pushes again on the next event or sync tick. */ export declare const handleFlagPush: (event: FlagPushEvent, ctx: ProcessContext, receiveCount: number) => Promise;