import type { RpcSessionClosedReason } from "./rpc-types.ts";
import type { RouterContext } from "./session-router-context.ts";
/**
 * Park attached and detached sessions once turns and requests settle. Durable wake sources
 * resume on reopen, unlike active work. Repeated requests (including grace expiry) rescan
 * without announcing again or aborting a turn.
 */
export declare function beginDrain(host: RouterContext): void;
/** One drain pass: park what has settled, and exit once the host holds nothing. */
export declare function sweepDrain(host: RouterContext): void;
export declare function parkForHandoff(host: RouterContext, sessionId: string, reason: "handoff_parked" | "session_dir_removed"): void;
/**
 * One occupancy sweep. Evicts what `selectSweepEvictions` decides: open sessions idle
 * longer than idleEvictionMs, and unattached sessions whose transcript directory is
 * gone. While the host reports memory pressure the window is HALVED, so an
 * idle session's memory returns to the process sooner. Fires onEmptyExit once the
 * registry has STAYED empty for emptyExitMs with the exit permitted; any live session
 * or connected client resets that window. Runs on an unref'd interval and is safe to
 * call directly.
 */
export declare function sweepIdleSessions(host: RouterContext): void;
/**
 * Idle-session eviction: the same refcounted close sequence as an explicit
 * close_session, draining every attachment because eviction ends the shared
 * session, not one client's claim. Races with concurrent lifecycle paths are
 * tolerated the same way releaseOwnedSession tolerates them.
 *
 * Evicting a RETAINED session is a PARK, not a close: that session was opened to
 * outlive its clients, so the terminal record names the file it reopens by
 * (`session_parked`) instead of reporting a close nobody requested. The teardown
 * itself is identical - retention never outlives the idle window.
 */
export declare function evictIdleSession(host: RouterContext, sessionId: string, reason?: RpcSessionClosedReason): Promise<void>;
export declare function stopSweep(host: RouterContext): void;
//# sourceMappingURL=session-router-occupancy.d.ts.map