/**
 * StreamManager u2014 orchestrates screen-streamer and input-injector Swift
 * child processes, and broadcasts H.264 frames to WebSocket clients.
 *
 * Responsibilities:
 *  - Lifecycle: start/stop child processes on demand (idle timeout).
 *  - Frame broadcasting: relay video frames and screen-info messages.
 *  - Input routing: translate client binary messages into stdin commands.
 *  - Clipboard: pbpaste / pbcopy integration.
 *  - macOS actions: mission-control, launchpad, etc. via input-injector.
 */
import type { WebSocket } from "ws";
export interface ScreenInfo {
    id: number;
    x: number;
    y: number;
    w: number;
    h: number;
    pixelW: number;
    pixelH: number;
    scale: number;
    rotation: number;
    main: boolean;
}
export declare class StreamManager {
    private streamerProc;
    private injectorProc;
    private clients;
    private screenInfo;
    private idleTimer;
    private starting;
    private framesSent;
    private adaptiveTimer;
    private currentLevel;
    private congestedTicks;
    private idleTicks;
    private lastLevelChangeAt;
    /** Idle timeout before stopping child processes (ms). */
    private readonly idleTimeoutMs;
    /** Parser for the screen-streamer binary protocol. */
    private readonly parser;
    /** State for VNC-style button mask tracking. */
    private prevMask;
    private leftHeld;
    constructor(options?: {
        idleTimeoutMs?: number;
    });
    /** Add a WebSocket client. Starts child processes if not already running. */
    addClient(ws: WebSocket): Promise<void>;
    /** Return the current screen layout (used when rendering the HTML page). */
    getScreenInfo(): ScreenInfo[];
    /** Stop all child processes immediately. */
    stop(): void;
    private ensureRunning;
    private startStreamer;
    private startInjector;
    private stopProcesses;
    private startIdleTimer;
    private clearIdleTimer;
    private broadcastVideoFrame;
    private broadcastScreenInfo;
    private sendScreenInfo;
    private broadcastClipboard;
    private handleClientMessage;
    private handlePointerEvent;
    private handleKeyEvent;
    private handleConfigMessage;
    private handleSwitchMessage;
    private handleClipboardGet;
    private handleClipboardSet;
    private static readonly VALID_ACTIONS;
    private handleAction;
    private requestKeyframe;
    /**
     * Periodically observe TCP back-pressure (ws.bufferedAmount) and adjust
     * the encoder's target bitrate/fps. AIMD-style: quick to degrade, slow
     * to recover, with a cooldown to damp oscillation.
     */
    private startAdaptiveLoop;
    private stopAdaptiveLoop;
    private adaptiveTick;
    private applyLevel;
    private injectPointer;
    private injectKey;
}
//# sourceMappingURL=stream-manager.d.ts.map