/** * `restart --include-pm2` God retirement. * * A PID-addressed kill(2) cannot bind a signal to a PID+birth generation, so * this module never signals the God by PID. The kill is addressed to the * PM2_HOME control socket (`pm2 kill`) — i.e. to * "whichever God owns this home", which is exactly the object being retired — * and the recorded pid+birth identity is used only to VERIFY disappearance * afterwards. Callers must run this strictly AFTER the managed core fleet has * been retired and verified gone (and plugin services stopped): with an empty * fleet the God holds no session state, so retiring it cannot interrupt a * Riff prepare/persist/commit handshake. */ export interface Pm2GodRetirementRuntime { /** Scan for God processes owning this PM2_HOME (cmdline-marker based). */ listGodPids(): number[]; /** Birth identity for verification only — never signalling authority. */ readStartIdentity(pid: number): string | undefined; isAlive(pid: number): boolean; /** Bounded `pm2 kill` against this PM2_HOME's control socket. */ pm2Kill(): void; sleep(ms: number): Promise; now(): number; } export declare const PM2_GOD_RETIREMENT_VERIFY_TIMEOUT_MS = 15000; export interface RetiredPm2God { pid: number; startIdentity: string | undefined; } export interface Pm2RegistryRowLiveness { name: string; status: string | undefined; pid: number | undefined; } /** * `pm2 kill` slaughters every process the God still manages without any * graceful handshake, so the God may only be retired once the WHOLE registry * is quiescent: every row — core, plugin, or an orphaned row a plugin * uninstall left behind — must be in a terminal status with no live pid. A * plugin stop that failed (stop errors are collected into reports, not * rethrown) or a leftover running `botmux-plugin-*` row therefore blocks the * kill here, fail-closed, instead of being silently killed with the God. */ export declare function assertPm2RegistryQuiescentForGodRetirement(rows: readonly Pm2RegistryRowLiveness[]): void; /** * Between God retirement and the fresh `pm2 start`, any pm2 client invocation * (even a read-only jlist from another shell) lazily births a God from ITS * environment, not from this restart's cleaned one. Accepting it would defeat * the whole point of --include-pm2, so the start transaction refuses. */ export declare function assertNoReplacementPm2God(pids: readonly number[]): void; /** * Retire the sole live PM2 God, or return null when none is alive. Fails * closed — without mutating anything — on an invalid scan or multiple visible * Gods, and fails closed after `pm2 kill` if the God's disappearance cannot * be proven within the timeout. */ export declare function retireSoleLivePm2God(rt: Pm2GodRetirementRuntime, timeoutMs?: number): Promise; //# sourceMappingURL=pm2-god-retirement.d.ts.map