import type { ActiveSession } from './active.js';
/**
 * Recursion guard, passed as an env var (not a CLI flag) so an OLDER remote
 * `agents` that predates this feature ignores it harmlessly instead of erroring
 * on an unknown option. A remote new enough to fan out reads it and stays local.
 */
export declare const NO_FANOUT_ENV = "AGENTS_SESSIONS_LOCAL";
/**
 * Parse a peer's `--active --json` stdout into active sessions, tagging each
 * with `machine`. Defensive against version skew / partial output: non-JSON or
 * a non-array yields `[]`, and non-object entries are dropped rather than
 * throwing. `viewingIn` arrives as a display string from a current peer and as
 * an `{app, tab}` object from one that predates the flattening, so it is
 * normalized here — the single boundary where a foreign row becomes internal.
 * Exported for unit testing without a live tailnet.
 */
export declare function parseRemoteActive(stdout: string, machine: string): ActiveSession[];
export interface RemoteActiveResult {
    sessions: ActiveSession[];
    /** How many peer machines we attempted to reach (drives the empty-fleet tip). */
    deviceCount: number;
    /**
     * Peer device names that were unreachable, timed out, or lacked the CLI —
     * distinct from a peer that answered with zero sessions. Named so an empty
     * fleet-wide result can say WHICH peers went unheard rather than reading
     * identical to "the fleet is genuinely idle" (RUSH-2507).
     */
    skipped: string[];
    /** True when the device list itself could not be loaded — no peer was even attempted. */
    discoveryFailed: boolean;
}
/**
 * Gather active sessions from other machines. With an explicit `hosts` list
 * (from `--device`), fan out to exactly those. Otherwise sweep the registered,
 * online devices from `ag devices`, excluding this machine and any without an
 * address. Results from all peers run in parallel and are flattened.
 * `opts.quiet` suppresses the per-device stderr line for callers that report
 * skipped peers once, compactly, themselves.
 */
export declare function gatherRemoteActive(hosts?: string[], opts?: {
    quiet?: boolean;
    /**
     * Opt-in first-hit abort. Omitted by default so `--active`, projects, and
     * `focus` with no id keep all-settle. Detach/stop pass this for a unique
     * live id so a reachable hit does not wait out sleeping peers.
     */
    earlyExit?: {
        isDefinitive: (item: ActiveSession, machine: string) => boolean;
    };
}): Promise<RemoteActiveResult>;
