/**
 * Worker thread process guard.
 *
 * Components loaded into Harper workers (Next.js, in particular) register
 * their own `unhandledRejection` handler that explicitly calls
 * `process.exit()`. That terminates the entire worker — including
 * replication and unrelated components — for what is logically an
 * application-level error.
 *
 * In worker threads, this module:
 *   - Intercepts `process.exit()` so component code cannot terminate the
 *     worker. The original exit is preserved as `process._realExit` (and
 *     as the exported `realExit()` helper) for Harper internal callers
 *     that legitimately need to terminate the worker (shutdown,
 *     FORCE_EXIT under Bun, etc.).
 *   - Registers an `unhandledRejection` listener so the default Node.js
 *     terminate-on-unhandled-rejection behavior is suppressed when no
 *     other component handler exists.
 *
 * On the main thread this module is a no-op except for exposing
 * `process._realExit` so internal callers can use the same name regardless
 * of thread.
 *
 * Harper-internal callers that intentionally want to terminate should use
 * the exported `realExit()` helper. It falls back to `process.exit` when
 * the guard has not been loaded (e.g., CLI bin scripts), so the helper is
 * always safe to call.
 */
declare global {
    namespace NodeJS {
        interface Process {
            _realExit: (code?: number) => never;
        }
    }
}
/**
 * Terminate the current process for real, bypassing the worker process
 * guard's `process.exit` override. Safe to call from any thread — falls
 * back to `process.exit` when the guard has not been loaded yet (e.g.,
 * CLI bin scripts).
 */
export declare function realExit(code?: number): never;
