import { WebSocket } from 'ws'; import type { KnownSession } from './state-persistence.js'; export interface AgentRuntimeInfo { nodeVersion: string; nodeMajor: number; nodeAbi: string; platform: string; arch: string; versionStoreAdopted: boolean; } export interface AgentSession extends Partial { ws: WebSocket; agentId: string; name: string; hostname: string; deviceName?: string; deviceNameEditing?: boolean; workDir: string; version: string; qacRequestIds?: boolean; sessionId: string; sessionKey: Uint8Array | null; connectedAt: Date; isAlive: boolean; missedPings: number; 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; readonly sessionToAgent: Map; readonly webClients: Map; readonly sessionOwners: Map; readonly knownSessions: Map; /** 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): void; loadKnownSessions(data: Record): void; cleanupDeadConnections(notifyFn: (client: WebClient, msg: { type: string; }) => void): { removedAgents: string[]; removedClients: string[]; }; } export declare const sessions: SessionManager;