/**
 * Target enumeration + `--auto` scorer for `agents sessions migrate` (RUSH-1977).
 *
 * `sessions migrate` relocates a running session onto another machine. This
 * module is the pure decision layer: given the fleet (enrolled hosts + devices
 * from `listAllHosts()`), their live headroom ({@link Headroom} buckets derived
 * from `probeFleetStats()` / the disk stats-cache), and the reusable ephemeral
 * crabbox boxes (`reusableBoxes()`), it enumerates eligible {@link MigrateTarget}s
 * and ranks them for `--auto`.
 *
 * Kept side-effect-free (no ssh, no disk, no clock) so the ranking is a unit test
 * against synthetic Host[]/DeviceStats — the command layer does the probing and
 * hands the results in. The one genuine-bug guard the test pins: the source and
 * the interactive machine (os.hostname()) are never offered as targets.
 */
import type { Host } from '../hosts/types.js';
import type { DeviceStats, Headroom } from '../devices/health.js';
import type { CrabboxBox } from '../crabbox/cli.js';
/** A machine the current session could be relocated onto. */
export interface MigrateTarget {
    /** The `--device` value: a host/device name, or a warm box slug for ephemeral. */
    name: string;
    /** Where the target comes from — a fleet host/device, or a warm crabbox box. */
    kind: 'fleet' | 'ephemeral';
    /** Captured OS string ('darwin'/'linux'/'windows'/…) when known, for platform-match ranking. */
    os?: string;
    /** Live headroom bucket ('idle' is best); 'unknown' when no stats resolved. */
    headroom: Headroom;
    /** The underlying host (fleet targets only). */
    host?: Host;
    /** The underlying warm box (ephemeral targets only). */
    box?: CrabboxBox;
}
/** Inputs the scorer needs about the session being moved and this machine. */
export interface MigrateContext {
    /** os.hostname() of the interactive machine — never a valid target. */
    selfHostname: string;
    /** The source session's host (machine it currently runs on) — never a valid target. */
    sourceHostname?: string;
    /** The source session's OS, for the platform-match bonus. */
    sourceOs?: string;
}
/**
 * Enumerate the fleet + ephemeral targets a session could move to, excluding the
 * interactive machine and the source. A fleet host is eligible only when it is
 * dispatchable and not obviously offline; ephemeral (warm) boxes are always
 * eligible (already provisioned and reachable). `statsByName` supplies live
 * headroom — a missing entry yields 'unknown' (still eligible, just ranked lower).
 */
export declare function enumerateTargets(hosts: Host[], warmBoxes: CrabboxBox[], statsByName: Map<string, DeviceStats>, ctx: MigrateContext): MigrateTarget[];
/**
 * Rank targets for `--auto`. Order:
 *   1. Platform match with the source (a faithful --resume wants the same OS family).
 *   2. Fleet before ephemeral (prefer a warm worker over spinning a box).
 *   3. Headroom (idle > light > busy > loaded > unknown).
 *   4. Name, for a stable tie-break.
 * Returns a new sorted array; does not mutate the input.
 */
export declare function rankTargets(targets: MigrateTarget[], ctx: MigrateContext): MigrateTarget[];
/**
 * Pick the single best `--auto` target, or null when nothing is eligible. A
 * fully-loaded ('loaded') fleet is still returned (better than failing the
 * migrate); the command layer can offer `--lease` when this is null.
 */
export declare function pickBestTarget(hosts: Host[], warmBoxes: CrabboxBox[], statsByName: Map<string, DeviceStats>, ctx: MigrateContext): MigrateTarget | null;
