import type { CachedUsageSnapshot } from './accounting/usage.js';
export declare const FLEET_SHARED_STATE_VERSION = 1;
export declare const FLEET_SHARED_STATE_FILE = "daemon-state.json";
export type SharedAuthStatus = 'ready' | 'missing' | 'invalid';
/**
 * One session's lightweight preview/metadata, mirrored to the fleet so the
 * interactive device renders a remote-host row's topic/preview INLINE instead of
 * fetching the peer's digest live over SSH per row (PHNX-3792). Deliberately
 * NOT a full transcript: only the fields a list row and a compact preview card
 * need. `machine` is the EXECUTION host the publisher recorded (so an offloaded
 * session's mirror row matches the same `machine:id` key the live fan-out uses,
 * never double-counting), `firstUser` is a bounded first-user-message snippet,
 * and `capturedAt` stamps publish time for the staleness marker.
 */
export interface SessionMirrorRow {
    id: string;
    shortId: string;
    agent: string;
    version?: string;
    machine: string;
    cwd?: string;
    topic?: string;
    label?: string;
    firstUser?: string;
    lastActivity?: string;
    timestamp: string;
    ticketId?: string;
    prUrl?: string;
    /** Daemon-computed goal (PHNX-3939) — carried so a peer renders it with no transcript. */
    goal?: string;
    /** Daemon-computed progress checkpoints, newest last (PHNX-3939). */
    checkpoints?: import('./session/types.js').SessionCheckpoint[];
    /** Daemon-computed detailed checklist (PHNX-3939). */
    summaryChecklist?: import('./session/types.js').SessionChecklistItem[];
    /** Lifecycle of the daemon-computed summary (PHNX-3939). */
    summaryState?: import('./session/types.js').SummaryState;
    capturedAt: number;
}
export interface FleetSharedDeviceState {
    version: typeof FLEET_SHARED_STATE_VERSION;
    device: string;
    usage?: {
        rows: Record<string, CachedUsageSnapshot>;
    };
    auth?: {
        status: SharedAuthStatus;
    };
    sessions?: {
        rows: SessionMirrorRow[];
    };
}
export interface FleetSharedStatePatch {
    usage?: FleetSharedDeviceState['usage'];
    auth?: FleetSharedDeviceState['auth'];
    sessions?: FleetSharedDeviceState['sessions'];
}
export interface FleetSharedStateReadResult {
    states: FleetSharedDeviceState[];
    errors: Array<{
        device: string;
        message: string;
    }>;
}
/** Path owned by one device in the conflict-free tracked device-doc tree. */
export declare function fleetSharedStatePath(device: string, userAgentsDir?: string): string;
export declare function updateFleetSharedDeviceState(device: string, patch: FleetSharedStatePatch, userAgentsDir?: string): {
    changed: boolean;
    path: string;
};
/**
 * Async, non-blocking twin of {@link updateFleetSharedDeviceState} for the
 * daemon's usage-sync / auth-sync ticks (PHNX-3695). The sync version acquires
 * the file lock with `sleepSync` (`Atomics.wait`), freezing the shared event
 * loop for up to 30s under contention on EVERY tick; this uses
 * `withFileLockAsync`. The under-lock read is async; the atomic write is a tiny
 * bounded write held inside the lock.
 */
export declare function updateFleetSharedDeviceStateAsync(device: string, patch: FleetSharedStatePatch, userAgentsDir?: string): Promise<{
    changed: boolean;
    path: string;
}>;
/** Read every valid peer-owned state file; malformed peers fail separately. */
export declare function readFleetSharedDeviceStates(userAgentsDir?: string): FleetSharedStateReadResult;
