import type { ProcessContext } from "../context.js"; import type { MessageCopyEvent } from "../events.js"; /** * Where the destination says this copy is. `unprobeable` is the row that * carries no usable Message-ID header (drafts, automated senders and bounces * do arrive without one): the server was never * asked, so its silence says nothing. */ export type CopyProbe = { kind: "confirmed"; uid: number; } | { kind: "absent"; } | { kind: "unprobeable"; }; /** * Handle MESSAGE_COPY events. * Executes IMAP COPY command and updates local state with new UID. * * IMAP COPY is not idempotent and the message queue is FIFO per account, so * this handler never manufactures a retry to resolve an ambiguous answer: a * second COPY duplicates the mail, and a record that keeps coming back blocks * every later move, copy and delete for that account (issues #287, #289, * #290). Ambiguity is resolved in place, by asking the destination. * * A fault the server threw is still retried up to * the `config.attempts.messageCopy` budget, because it may be a dropped connection. * Two guards make that safe: a redelivery asks the destination BEFORE issuing * COPY again, and the last attempt settles the row instead of dead-lettering * it. The copy row is a reconcile-model dependent (`copySettledMessage` writes * its ThreadMessage row at `uid: 0` before the server has confirmed anything, * docs/architecture/imap-mutations.md R2) and these terminal settles are its * reconciliation path: every verdict the server gives an answer for settles the * row out of `uid: 0`/`moving` (#1097). A server that cannot be reached at all * gives no verdict — the record dead-letters with the row untouched, the same * caveat `resolveExhaustedMessageMoveFailure` carries, because absence is only * ever concluded from an answer. */ export declare const handleMessageCopy: (event: MessageCopyEvent, ctx: ProcessContext, receiveCount: number) => Promise;