/** * Startup orphan sweep — Option C long-running mode. * * Every child spawned by LongRunningSupervisor carries a marker env var: * SENPI_SUPERVISED= * * When the runtime is killed hard (SIGKILL, OOM, power-cycle) the graceful * shutdown code never runs and supervised children become orphans. The sweep * scans `ps` for processes carrying the marker and kills them (group kill + * descendant reap). It must be called by the host BEFORE any new spawning. * * This is a static, standalone utility — no class, no instance state. */ import type { Logger } from "../../utils/logger.js"; /** The env-var name stamped on every supervised child. */ export declare const SENPI_SUPERVISED_ENV = "SENPI_SUPERVISED"; /** Result of a single orphan-sweep run. */ export interface SweepResult { /** Number of orphaned root processes found (carrying the marker). */ found: number; /** PIDs that were signalled (best-effort; some may have already been gone). */ killed: number[]; } /** * Scan `ps` for processes carrying `SENPI_SUPERVISED[=]` in * their environment, kill them (SIGKILL to process group + descendant reap), * and return a summary. * * @param supervisorId If provided, only sweep orphans for this specific * supervisor; otherwise sweep ALL `SENPI_SUPERVISED` orphans (full reset). * @param logger Structured logger. * * POSIX-only. On Windows returns { found: 0, killed: [] } immediately. */ export declare function sweepOrphans(supervisorId: string | undefined, logger: Logger): SweepResult; //# sourceMappingURL=orphan-sweep.d.ts.map