export type RestartAttempt = { ok: boolean; method: "launchctl" | "systemd" | "supervisor"; detail?: string; tried?: string[]; }; export declare function setGatewaySigusr1RestartPolicy(opts?: { allowExternal?: boolean; }): void; export declare function isGatewaySigusr1RestartExternallyAllowed(): boolean; export declare function authorizeGatewaySigusr1Restart(delayMs?: number): void; export declare function consumeGatewaySigusr1RestartAuthorization(): boolean; export declare function triggerSKYKOIRestart(): RestartAttempt; export type ScheduledRestart = { ok: boolean; pid: number; signal: "SIGUSR1"; delayMs: number; reason?: string; mode: "emit" | "signal"; }; export declare function scheduleGatewaySigusr1Restart(opts?: { delayMs?: number; reason?: string; }): ScheduledRestart; export type ScheduledGatewayRestart = { ok: boolean; pid: number; delayMs: number; reason?: string; mode: "exit" | "in-process"; /** Set in "exit" mode: the code the process will exit with for its supervisor. */ exitCode?: number; /** Set in "in-process" mode: the signal driving the run-loop restart. */ signal?: "SIGUSR1"; }; /** * Wired up by the gateway run loop so a scheduled exit-restart drains the * server gracefully before the process exits for its supervisor to relaunch. * Returns an unregister function. */ export declare function registerGatewayExitRestartHandler(handler: (reason?: string) => void): () => void; /** True when this process was launched by an installed gateway service. */ export declare function isGatewayServiceSupervised(env?: NodeJS.ProcessEnv): boolean; /** True when an exit-restart would actually be caught and relaunched. */ export declare function canScheduleGatewayExitRestart(): boolean; /** * Restart the gateway so it comes back running the code currently on disk. * * Supervised gateways restart by EXITING with GATEWAY_RESTART_EXIT_CODE and * letting the service manager relaunch the entry: a fresh process is the only * way a newly-installed build ever starts executing. The in-process SIGUSR1 * path re-enters the same module graph (ESM cache), which is how a gateway * could install an update, "restart", and still run the old build forever. * Unsupervised gateways — nothing would bring them back — keep the in-process * restart: staying alive on the old code beats exiting for good. */ export declare function scheduleGatewayRestart(opts?: { delayMs?: number; reason?: string; }): ScheduledGatewayRestart; export declare const __testing: { resetSigusr1State(): void; };