import type { AckRecord, MailboxMessage, MailboxMessageType } from './mailbox-types.js'; /** Normalize message types emitted by pre-union mailbox builds. */ export declare function normalizeMailboxMessageType(value: unknown): MailboxMessageType; /** * Resolve the message type for a SEND operation, applying default-type logic * and cross-field validation. * * ** Default-type rules ** (mirror the `mail_send` tool's logic): * - When `type` is explicitly provided, use it directly. * - When `type` is omitted AND the resolved `to` is `"*"` or starts with * `"@session:"`, the default is `"broadcast"`. * - Otherwise (omitted, non-broadcast target), the default is `"note"`. * * **Send-side validation** (from `validateSendType`): * - `control` is rejected — it is reserved for runtime use. * - `assign` and `steer` with `to="*"` are rejected — these types require a * specific recipient. * * @returns The resolved type (explicit or defaulted). * @throws {TypeError} When the type is reserved or the (type, to) pair is * semantically invalid. */ export declare function resolveSendType(type: MailboxMessageType | undefined, to: string): MailboxMessageType; /** * Resolve the message type for a SEND, returning a descriptive error instead * of throwing. Convenience wrapper for use in tool handlers where a thrown * TypeError would be awkward to catch. * * Returns `{ ok: true, type }` on success, or `{ ok: false, error }` when * the (type, to) pair is invalid. */ export declare function resolveSendTypeSafe(type: MailboxMessageType | undefined, to: string): { ok: true; type: MailboxMessageType; } | { ok: false; error: string; }; /** Parse, migrate, and structurally validate one persisted mailbox message. */ export declare function parseMailboxMessage(value: unknown): MailboxMessage; /** Parse one JSONL line and validate the decoded mailbox message. */ export declare function parseMailboxMessageLine(line: string): MailboxMessage; /** * Check if a parsed JSONL value is an append-only ack record (not a message). * Ack records carry a `__ack: true` discriminator. */ export declare function isAckRecord(value: unknown): value is AckRecord; /** * Parse one JSONL line, returning either a MailboxMessage or an AckRecord. * Returns null when the line is neither (corrupt/malformed). */ export declare function parseMailboxLine(line: string): MailboxMessage | AckRecord | null; /** * Apply an ack record's effects to a MailboxMessage in-place. * This mutates the message object (readBy, completed, completedBy, completedAt, * outcome, deletedAt, deletedBy). */ export declare function applyAckToMessage(msg: MailboxMessage, ack: AckRecord): void; /** * Serialize an ack record to a JSONL line. */ export declare function serializeAckRecord(ack: AckRecord): string; //# sourceMappingURL=mailbox-message-codec.d.ts.map