import { WebSocket } from 'ws';
import type { KnownSession } from './state-persistence.js';
export interface AgentSession {
    ws: WebSocket;
    agentId: string;
    name: string;
    hostname: string;
    workDir: string;
    version: string;
    sessionId: string;
    sessionKey: Uint8Array | null;
    connectedAt: Date;
    isAlive: boolean;
    passwordHash: string | null;
    passwordSalt: string | null;
    entra: boolean;
    entraVerified: boolean;
    msInternal: boolean;
    ownerOid?: string;
    ownerEmail?: string;
}
export interface WebClient {
    ws: WebSocket;
    clientId: string;
    sessionId: string;
    sessionKey: Uint8Array | null;
    connectedAt: Date;
    isAlive: boolean;
    entraVerified?: boolean;
}
export declare class SessionManager {
    readonly agents: Map<string, AgentSession>;
    readonly sessionToAgent: Map<string, string>;
    readonly webClients: Map<string, WebClient>;
    readonly sessionOwners: Map<string, {
        oid: string;
        email: string;
        updatedAt: number;
    }>;
    readonly knownSessions: Map<string, KnownSession>;
    /** Reverse index: sessionId → Set of clientIds for O(1) lookup */
    private readonly sessionToClients;
    private static readonly SESSION_OWNER_TTL;
    private static readonly KNOWN_SESSION_TTL;
    onMutation?: () => void;
    generateSessionId(): string;
    registerAgent(agentId: string, agent: AgentSession): void;
    removeAgent(agentId: string): void;
    getAgent(agentId: string): AgentSession | undefined;
    getAgentBySession(sessionId: string): AgentSession | undefined;
    getKnownSession(sessionId: string): KnownSession | undefined;
    setSessionOwner(sessionId: string, oid: string, email: string): void;
    removeSessionOwner(sessionId: string): void;
    registerClient(clientId: string, client: WebClient): void;
    removeClient(clientId: string): void;
    getClient(clientId: string): WebClient | undefined;
    getClientsForSession(sessionId: string): WebClient[];
    loadSessionOwners(data: Record<string, {
        oid: string;
        email: string;
        updatedAt: number;
    }>): void;
    loadKnownSessions(data: Record<string, KnownSession>): void;
    cleanupDeadConnections(notifyFn: (client: WebClient, msg: {
        type: string;
    }) => void): {
        removedAgents: string[];
        removedClients: string[];
    };
}
export declare const sessions: SessionManager;
