import { ClientOccupancy } from "./host-client-occupancy.ts";
import { type HostActivity, IdleExitDecider, type IdleExitDecision } from "./host-lifecycle-policy.ts";
export interface SupervisorActivityOptions {
    readonly idleExitMs: number;
    readonly internalSocket: string;
    readonly internalSecret?: Buffer;
    readonly internalKey?: Buffer;
    /** This generation: a client running in its own host is a dependent, never occupancy (#3272). */
    readonly instanceId: string;
    /** The supervisor is leaving: the observer stops reconnecting. */
    readonly settled: () => boolean;
    /** Resets owner grace even for activity that starts and ends between lifecycle ticks. */
    readonly onActivity?: () => void;
}
/**
 * The observer's internal handshake bound (senpi#3816 review), the same 5 s the raw connect had: a child that accepts
 * and never answers fails the open, and the connection is dropped.
 */
export declare const INTERNAL_OBSERVER_HANDSHAKE_MS = 5000;
export declare class SupervisorActivity {
    readonly decider: IdleExitDecider;
    readonly clients: ClientOccupancy;
    private readonly runs;
    private readonly observerLink;
    private observerSocket;
    /** The host's last `host_occupancy` on the current observer connection; undefined until it answers. */
    private sessionHolders;
    private readonly options;
    constructor(options: SupervisorActivityOptions);
    current(): HostActivity;
    refresh(): IdleExitDecision;
    /**
     * An attachment restarts the idle window even when the host has not counted the client as a holder yet: its first
     * command (an open) is still on its way there.
     */
    private attached;
    /** Owner death never turns an unknown observer snapshot into permission to stop a turn. */
    quiescent(): boolean;
    openObserver(): Promise<void>;
    stopObserver(): void;
    private connectObserver;
    private observeHostEvent;
}
/** Continuous quiet time, in addition to attach holds and confirmed owner death (#3044). */
export declare const OWNER_EXIT_GRACE_MS = 2000;
/**
 * Fresh starts inherit an event-loop pipe on POSIX and Windows. An existing supervisor cannot
 * receive a newly inherited fd, nor can a foreign handoff caller pass the original owner's fd:
 * those bindings use the OS start identity. Failed observations are never death.
 */
export declare class SupervisorOwner {
    private owner;
    private pipe;
    private watcher;
    private watchFailed;
    private nextProbeAt;
    private probeIntervalMs;
    private gone;
    private revision;
    private stopped;
    private readonly idle;
    private readonly generationDir;
    constructor(generationDir: string);
    start(fd: number | undefined): Promise<void>;
    private reload;
    activity(): void;
    shouldExit(activity: SupervisorActivity): Promise<boolean>;
    stop(): void;
}
//# sourceMappingURL=host-lifecycle-activity.d.ts.map