/**
 * Worker-thread-backed simpleParser dispatcher.
 *
 * mailparser's `simpleParser` is declared `async` but its work is CPU-bound
 * (Node Streams + libmime decoding). When it runs on the main event loop:
 *   - The first parse after a fresh process takes 14-25 seconds (cold V8
 *     JIT + libmime + iconv-lite + charset-table loading). See log
 *     2026-05-14 01:11:44 — simpleParser 14524ms for 5 KB.
 *   - Every parse, cold or warm, blocks the IPC stdin pump for its
 *     duration. A 200 ms parse delays every queued IPC message by 200 ms.
 *
 * Moving the parse to a `worker_threads` Worker fixes both problems:
 *   - The main event loop stays responsive — IPC, sync, timers all run
 *     during the parse. Click-to-render latency is bounded by post-message
 *     RTT (sub-ms) + parse time on the worker, but the rest of the app
 *     stays alive.
 *   - The worker absorbs cold-start once. Subsequent parses ride the
 *     worker's warm JIT and run in their natural 50-500 ms budget.
 *
 * Priority queue: foreground (UI clicks) jumps over background (sync /
 * prefetch) when more than one parse is pending. Each parse still runs
 * sequentially on the worker — the single-worker design intentionally
 * mirrors the prior in-process serialization to keep CPU bounded.
 *
 * Lazy spawn: the worker is created on first call. boot/setup code that
 * runs no parses pays nothing.
 *
 * Worker lifecycle: the worker is process-singleton, never explicitly
 * terminated. Node exits cleanly because the worker is `unref()`d so it
 * doesn't keep the event loop alive.
 *
 * Lives in mailx-store rather than mailx-service so both the UI-hot path
 * (mailx-service/local-store.ts) and the sync path (mailx-imap) share one
 * worker — otherwise each module would spawn its own (parallel workers
 * would defeat the bound on CPU, and each pays its own cold start).
 */
import type { ParsedMail, Source } from "mailparser";
/** Spawn the parse worker early so its cold-start (mailparser module
 *  loading, V8 JIT, libmime / iconv-lite tables — empirically 14-25 s)
 *  runs in parallel with the rest of boot. Safe to call multiple times;
 *  the worker is a process-singleton. Returns immediately; the actual
 *  cold-start completes in the worker's internal self-warm. */
export declare function prewarmParseWorker(): void;
/** Serialized wrapper around `mailparser.simpleParser` running in a worker
 *  thread. `priority` defaults to "foreground" — only sync/background
 *  callers should pass "background" so user clicks aren't stuck behind a
 *  back-fill. If the worker can't be spawned (rare), falls back to an
 *  in-main-thread serial pump so the system still functions. */
export declare function parseSerial(source: Source, priority?: "foreground" | "background"): Promise<ParsedMail>;
//# sourceMappingURL=parse-serial.d.ts.map