import { type RotateCandidate } from '../accounting/rotate.js';
import type { AgentId } from '../types.js';
import type { SessionAgentId, SessionMeta } from './types.js';
/** One capability boundary for every surface that advertises faithful Resume. */
export declare function sessionAgentSupportsResume(agent: SessionAgentId): boolean;
/**
 * The account a recovery should authenticate as. Present when resume rotates
 * AWAY from the session's original login (an account limit) to a healthy
 * sibling of the SAME harness. A `providerAccount` is a durable setup-token /
 * API-key account (RUSH-3182) injected via the `--account` spawn path
 * (`resolveSpawnAccount` → `accountEnv`); it is the only kind that can
 * authenticate a NATIVE resume in the origin version home, because a native
 * login lives in its own isolated home and cannot be forwarded. It is also
 * required on `/continue` when the balanced pick is a provider: exec only
 * injects from this field, so omitting it would launch the version home's
 * native login — the exhausted origin in the PHNX-3674 fixture. Absent means
 * "use the launched version home's own native login" (the healthy-origin happy
 * path, or `/continue` on a healthy native sibling).
 */
export interface RecoveryAccount {
    providerAccount: string;
    label: string;
    email: string | null;
}
export type SessionRecoveryTarget = {
    mode: 'native';
    agent: AgentId;
    version: string;
    cwd?: string;
    account?: RecoveryAccount;
    reason: string;
} | {
    mode: 'continue';
    agent: AgentId;
    version: string;
    account?: RecoveryAccount;
    reason: string;
};
export type NativeResumeInspection = {
    available: true;
    cwd?: string;
} | {
    available: false;
    reason: string;
};
export declare class SessionRecoveryError extends Error {
    constructor(message: string);
}
/** Canonical origin-device label for every recovery consumer. */
export declare function sessionOriginDevice(session: Pick<SessionMeta, 'machine'>, self?: string): string;
/** The peer that must execute recovery, or undefined when this is the origin. */
export declare function sessionRecoveryPeer(session: Pick<SessionMeta, 'machine'>, selfCheck?: (host: string) => boolean): string | undefined;
/** Whether an explicit placement names the session's origin device. */
export declare function sessionRecoveryDestinationMatches(session: Pick<SessionMeta, 'machine'>, requestedHost: string, self?: string): boolean;
/**
 * Prove that the indexed transcript is reachable from the exact active version
 * home that would receive native resume. Retained trash/backup transcripts are
 * intentionally rejected here: they remain readable by `/continue`, but a new
 * installation with the same version number must not native-resume an empty
 * isolated home.
 */
export declare function inspectNativeResumeSession(session: SessionMeta, versionHome: string): NativeResumeInspection;
/**
 * Decide how a durable session resumes on the device that owns it.
 *
 * Native resume is legal only in the exact origin version's isolated home,
 * and only while that home owns the indexed transcript AND some injectable
 * credential for this harness is healthy: the origin login itself, or a
 * provider account rotated in when the origin is usage-limited (PHNX-3626).
 * Every other successful path stays on the same harness and uses `/continue`,
 * whose indexed transcript reader can reach retained version trash. A
 * `/continue` pick of a provider account carries RecoveryAccount so exec
 * injects it instead of launching the version home's native login
 * (PHNX-3674). No healthy same-harness account is a loud failure.
 */
export declare function resolveSessionRecoveryFromCandidates(session: SessionMeta, candidates: RotateCandidate[], supportsNative?: (agent: AgentId, version?: string) => boolean, nativeInspection?: NativeResumeInspection): SessionRecoveryTarget;
/**
 * Resolve recovery for a durable session, reading the live account pool.
 *
 * Uses {@link collectRunCandidatesForRun} (native version-home logins PLUS
 * durable provider accounts, RUSH-3182) rather than the native-only
 * {@link collectRunCandidates}, so an origin-account limit can rotate to a
 * healthy provider account and stay NATIVE (PHNX-3626). `collect` is injectable
 * for tests and for callers that must stay native-only.
 */
export declare function resolveSessionRecovery(session: SessionMeta, collect?: (agent: AgentId) => Promise<RotateCandidate[]>): Promise<SessionRecoveryTarget>;
/** Stable self-command used by focus, resume, and attach. The owning device runs
 * the recovery resolver above; callers must not native-resume another version's
 * isolated home themselves. */
export declare function sessionRecoveryRunArgs(session: Pick<SessionMeta, 'id'>): string[];
