import type { FlagView } from '@struktoai/mirage-core/commands/spec/index'; import type { ByteSource } from '@struktoai/mirage-core/io/types'; import type { FetchedMessage } from '../../../../core/email/client.ts'; type SourceMode = 'reply' | 'forward'; export type PostingStyle = 'top' | 'bottom'; /** One file attached to an outgoing message. */ export interface Attachment { filename: string; contentType: string; data: Uint8Array; } export interface Compose { sender: string; to: readonly string[]; cc: readonly string[]; bcc: readonly string[]; subject: string | null; body: string; signature: string | null; attachments?: readonly Attachment[]; } /** * A deterministic multipart boundary for the message's content. * * A random boundary would break byte-for-byte parity with the python * builder and make the no-send stdout non-reproducible. Hashing the * content gives a boundary that cannot occur inside it (the content * would have to contain its own hash) while staying stable across runs * and languages. */ export declare function mixedBoundary(body: string, attachments: readonly Attachment[]): string; export interface Source { message: FetchedMessage; mode: SourceMode; postingStyle: PostingStyle; quoteHeadline: string; } /** Flattens repeated address flags, splitting comma-separated lists. */ export declare function splitAddresses(values: readonly string[]): string[]; /** * Whether a subject already carries a Re:/Fwd: prefix. The colon is part * of the comparison: matching on the letters alone would read "Ready to * ship" as already prefixed with "Re:". */ export declare function hasPrefix(subject: string, prefix: string): boolean; /** Quotes a source body, one leading '>' per line. */ export declare function quoteText(sourceText: string, headline: string): string; /** Lays out the user's body, the quoted source and the signature. */ export declare function composeBody(userBody: string, quote: string, signature: string, style: PostingStyle): string; /** * Assembles an RFC 5322 message from flags and an optional source. * * Hand-built rather than routed through nodemailer's composer: the raw * bytes are the command's output when --send is absent, so they must * exist before any transport does. Every header and the body ride the * mime module's ports of python's serializers, so the output stays * byte-identical to EmailMessage.as_bytes(policy=SMTP) - header order, * encoded words, folding, transfer encoding and all (pinned in * integ/fixtures/himalaya/mime_parity.json). */ export declare function build(compose: Compose, source?: Source | null): Uint8Array; /** Resolves the body from --body, falling back to piped stdin. */ export declare function readBody(fl: FlagView, stdin: ByteSource | null): Promise; export {}; //# sourceMappingURL=builder.d.ts.map