import type { ClientToServerEvents, ServerToClientEvents } from '../protocol/socket-events.js'; import type { Socket } from 'socket.io'; export type SessionEndReason = 'socket-disconnect' | 'pty-exit' | 'login-rejected' | 'command-failure' | 'spawn-failure' | 'disposed'; type Cleanup = () => void; export interface ServerSession { readonly active: boolean; readonly completion: Promise; readonly reason: SessionEndReason | undefined; readonly signal: AbortSignal; end(reason: SessionEndReason): void; own(cleanup: Cleanup): Cleanup; reportCleanupError(error: unknown): void; } export declare class SessionEndError extends Error { readonly reason: SessionEndReason; constructor(reason: SessionEndReason, message: string); } export declare function createServerSession(socket: Socket, onCleanupError?: (error: unknown) => void): ServerSession; interface ConnectionGauge { inc(): void; dec(): void; } export interface ServerSessionRunnerDependencies { connections: ConnectionGauge; getCommand(session: ServerSession): Promise; spawn(args: string[], session: ServerSession): Promise; onCommand?(args: string[]): void; onError?(error: unknown): void; onCleanupError?(error: unknown): void; } export declare function runServerSession(socket: Socket, dependencies: ServerSessionRunnerDependencies): Promise; export {};