import { type HostAttachHold } from "./host-attach-hold.ts";
import { type HostProtocolInfo } from "./host-decision.ts";
import { requestOnSocket } from "./host-socket-request.ts";
import type { RpcKeyOptions } from "./rpc-auth-client.ts";
export { requestOnSocket };
/** Default probe budget: long enough for a host under load, short enough to keep an ensure moving. */
export declare const DEFAULT_PROBE_TIMEOUT_MS = 10000;
export interface ProbeHostOptions {
    readonly socket: string;
    readonly timeoutMs?: number;
    readonly keyRoot?: string;
}
/** The running host's identity, or `undefined` when nothing is serving the endpoint. */
export declare function probeHost(options: ProbeHostOptions): Promise<HostProtocolInfo | undefined>;
export declare function probeProtocolInfo(socketPath: string, timeoutMs: number, options?: RpcKeyOptions): Promise<HostProtocolInfo | undefined>;
/** `probeProtocolInfo` for a read that must not count as host activity, such as `host status`. */
export declare function observeProtocolInfo(socketPath: string, timeoutMs: number, options?: RpcKeyOptions): Promise<HostProtocolInfo | undefined>;
/**
 * The host's identity together with an attach hold on the connection that answered, or `undefined`
 * when nothing answers. The answer and the claim share one connection, so there is no instant
 * between "the host is ready" and "the host is held" in which an idle window could close.
 */
export declare function holdProtocolInfo(socketPath: string, timeoutMs: number, options?: RpcKeyOptions): Promise<{
    readonly info: HostProtocolInfo;
    readonly hold: HostAttachHold;
} | undefined>;
/**
 * Whether the socket ACCEPTED a connection during the last probe, regardless of whether an answer
 * arrived in time. A host under load can miss a probe budget while it is perfectly alive, and the
 * difference decides whether an ensure may end it: a silent-but-connectable socket has an owner
 * serving sessions behind it, and killing that owner destroys every one of them.
 */
export declare function probeSocketReachable(socketPath: string, timeoutMs: number, options?: RpcKeyOptions): Promise<boolean>;
/**
 * How many sessions the host holds right now, worker sessions included, or `undefined` when it
 * does not answer. A stop decision needs the number the host reports, not the one a client remembers.
 */
export declare function probeSessionCount(socketPath: string, timeoutMs: number, options?: RpcKeyOptions): Promise<number | undefined>;
/**
 * The session count together with the connection that answered it, kept open so the SAME host can be
 * asked again after its public path was handed to somebody else: the recount reaches the process that
 * was counted, never whoever serves the path by then. `undefined` when the host does not answer.
 */
export interface HeldSessionCount {
    readonly sessions: number;
    /** Asks the counted host again over the held connection; `undefined` when it no longer answers. */
    recount(timeoutMs: number): Promise<number | undefined>;
    close(): void;
}
export declare function holdSessionCount(socketPath: string, timeoutMs: number, options?: RpcKeyOptions): Promise<HeldSessionCount | undefined>;
//# sourceMappingURL=host-probe.d.ts.map