/**
 * Main-thread client for the DB factor worker.
 *
 * Spawns `db-worker.js` in a Node `worker_thread`, performs the init
 * handshake (passes dbPath + storePath), and returns a `WorkerBus` the
 * caller can use to send read requests and subscribe to DB events.
 *
 * The init handshake is a single `{kind:"init"}` postMessage followed by an
 * `{kind:"init-ok"}` or `{kind:"init-error"}` reply. This is done OUTSIDE
 * the WorkerBus message protocol so a bus method can't accidentally race
 * the construction of LocalStore inside the worker.
 *
 * Failure mode: if the worker can't load (the file is missing in a packaged
 * build, the DB can't be opened, etc.), `spawnDbWorker()` rejects. The
 * caller can fall back to in-process LocalStore — same code, same answers,
 * just shares the event loop with whatever else is running on main. That's
 * the legacy path; the worker is the new default but we don't paint
 * ourselves into a corner.
 */
import { Worker } from "node:worker_threads";
import { WorkerBus } from "@bobfrankston/mailx-bus";
export interface SpawnedDbWorker {
    bus: WorkerBus;
    worker: Worker;
    /** Stop the worker. After this, requests over the bus reject. */
    close(): Promise<void>;
}
export declare function spawnDbWorker(opts: {
    dbPath: string;
    storePath: string;
}): Promise<SpawnedDbWorker>;
//# sourceMappingURL=db-worker-client.d.ts.map