/**
 * Worker-thread health endpoint.
 *
 * Runs an HTTP server (`/health`, returns 200 OK with uptime+timestamp JSON)
 * on a *separate* Node worker_thread so probe responses don't depend on the
 * main event loop. The main thread can be deep in a long-running synchronous
 * task (Chrome teardown, large file I/O, GC pause, the post-Miguel guard
 * "impossible duration" math, etc.) and this endpoint still answers within
 * milliseconds because it lives in a different V8 isolate with its own
 * event loop.
 *
 * Why this matters
 * ----------------
 *
 * The producer sidecar's k8s `livenessProbe` / `readinessProbe` hit `/health`
 * on the Hono server in the main thread. Any synchronous stall longer than
 * the probe `timeoutSeconds` (5s in prod prior to the companion change)
 * triggers a SIGKILL even when the process is still alive — just busy.
 *
 * Today's incident (2026-06-26): an infinite GSAP timeline caused the
 * distributed planner to try to enumerate ~300_000_000_000 frames, and
 * the sidecar got killed mid-arithmetic. Miguel's upstream `plan()`
 * duration guard kills that input class at the source. This module is
 * defense-in-depth: future wedge classes (sync I/O on video-heavy comps,
 * runaway loops, GC pauses) shouldn't kill an otherwise-alive pod either.
 *
 * Contract
 * --------
 *
 * - The worker thread binds an HTTP listener on
 *   `PRODUCER_HEALTH_PORT` (default 9848) for `/health` only.
 * - Liveness in the worker thread = "the worker_thread itself is responsive",
 *   which is a strict subset of process liveness. If the entire Node process
 *   is dead the OS tears down both threads' sockets simultaneously, so the
 *   worker_thread's listener stops answering and k8s correctly kills the pod.
 * - Listening on `0.0.0.0` is intentional: this is the probe entry point and
 *   the sidecar already exposes other ports for in-pod traffic only. The
 *   endpoint returns the same shape the main-thread `/health` always returned
 *   so existing observability keeps working.
 *
 * The main thread still serves `/health` on the main port (9847) for
 * backwards compatibility; k8s probe config in `heygen-com/app` can migrate
 * to the worker port at its own pace.
 */
export interface HealthWorkerOptions {
    /** Port the worker_thread health endpoint listens on. Default 9848 / env. */
    port?: number;
    /**
     * Optional logger; falls back to console. Note: the worker thread itself
     * cannot use the parent's logger directly (separate isolate), so it logs
     * via `console`. The handle returned here uses the provided logger for
     * lifecycle events on the *main* thread.
     */
    logger?: {
        info?: (msg: string, meta?: Record<string, unknown>) => void;
        warn?: (msg: string, meta?: Record<string, unknown>) => void;
        error?: (msg: string, meta?: Record<string, unknown>) => void;
    };
    /**
     * Override worker entry module. Falls back to a co-located
     * `healthWorkerThread.js` (post-build) or `.ts` (dev/test).
     */
    workerEntry?: string;
}
export interface HealthWorkerHandle {
    /** Port the listener is bound to (resolved). */
    port: number;
    /** Stop the listener + terminate the worker thread. Idempotent. */
    shutdown: () => Promise<void>;
}
/**
 * Spawn the health worker_thread. Returns once the worker reports its
 * listener is up (or rejects if the worker fails to start).
 */
export declare function startHealthWorker(options?: HealthWorkerOptions): Promise<HealthWorkerHandle>;
//# sourceMappingURL=healthWorker.d.ts.map