import type { ServerConfig } from './types.js';
import type { StateManager } from './state-manager.js';
import type { CommandExecutor } from './command-executor.js';
import type { CDPBridge } from './cdp-bridge.js';
import type { JsonlIndex } from './jsonl-index.js';
import type { MessageDebugStore } from './message-debug-store.js';
import type { DOMExtractor } from './dom-extractor.js';
export declare class Relay {
    private stateManager;
    private commandExecutor;
    private cdpBridge;
    private jsonlIndex;
    private messageDebugStore;
    private domExtractor;
    private lastJsonlIndex;
    private indexEmitTimer;
    private lastIndexBroadcastAt;
    private lastSidebarIndexKey;
    private lastJsonlIndexKey;
    private config;
    private app;
    private httpServer;
    private io;
    private tokens;
    private upstream;
    private agentCompletionPush;
    private readonly pendingPushPayloads;
    private readonly chatDisplay;
    /** Raw JSONL row count last sent per agent (live `append` emits). */
    private readonly lastEmittedJsonlRows;
    /** Last display tail pushed to app — re-emit when user/assistant tail changes. */
    private readonly lastEmittedLentaSig;
    /** Display bubble count last sent — block regression 214→74 style wipes on phone. */
    private readonly lastEmittedHistLen;
    /** How many user-turns (tail) to send to the phone for this agent. */
    private readonly clientHistoryTurns;
    private readonly lentaPendingSince;
    private static readonly LENTA_PENDING_FORCE_MS;
    /** Socket `agent:messages` coalesce — store ingest is immediate (see ingestDomOverlayFromState). */
    private static readonly DOM_OVERLAY_EMIT_MS;
    private domOverlayTimer;
    private cachedLentaPendingByAgent;
    /** One CDP command at a time — parallel focus/send/stop was causing 30–60s stalls. */
    private commandChain;
    /** Subscribe/focus serialized — must not block socket handlers (phone waits on connect). */
    private subscribeChain;
    /** CDP focus_agent serialized separately from subscribe (JSONL emit stays fast). */
    private focusChain;
    constructor(config: ServerConfig, stateManager: StateManager, commandExecutor: CommandExecutor, cdpBridge: CDPBridge, jsonlIndex: JsonlIndex, messageDebugStore: MessageDebugStore, domExtractor: DOMExtractor);
    private emitAgentCompletedPush;
    private flushPendingPushPayloads;
    private observeAgentCompletionForPush;
    private requestAgentCompletionContentSync;
    listen(): Promise<void>;
    private get authEnabled();
    private lentaAgentIds;
    /** Read-only view of in-memory bridge state (no writes to stores). */
    private readOnlyChatSnapshot;
    private buildLentaDebugReport;
    /** Push JSONL file updates to every subscribed route id (e.g. sidebar-0) for that composer. */
    private syncJsonlToSubscribedAgents;
    /** JSONL baseline + DOM tail (`liveMessages`); `messages` = append-only compose. */
    private lentaSnapshot;
    private getClientTurnLimit;
    private sliceLentaForClient;
    private isClientLentaPending;
    private emitLentaForAgent;
    private lentaTailSignature;
    /** Live JSONL → `agent:messages` for subscribed chats (phone lenta). */
    private emitJsonlLiveForAgent;
    /** Ingest CDP viewport into ChatDisplayStore — no debounce (debug + compose). */
    private ingestDomOverlayFromState;
    /** Push lenta with DOM live to clients while generation is in flight. */
    private emitDomLiveWhileGenerating;
    private syncGeneratingFlags;
    /** Push composed lenta to subscribed clients (debounced). */
    private emitDomOverlaySocketForSubscribers;
    /** While generating, push overlay growth without waiting for emit debounce tail. */
    private maybeEmitDomOverlayLeading;
    private applyDomOverlayFromState;
    private scheduleDomOverlayEmit;
    /**
     * Agent ids that should receive DOM ingest: active Cursor composer + synced subscriptions.
     * Store must update even without phone subscribe (debug/lenta, later subscribe).
     */
    private resolveDomOverlayAgentIds;
    private writeLentaCapture;
    private resolveHistoryOpts;
    private agentMessagesSnapshot;
    private checkMediaAuth;
    private setupHttp;
    private setupSocket;
    private broadcast;
    private historySeqByAgent;
    private nextHistorySeq;
    private emitAgentMessages;
    private prepareStateMessages;
    private withDisplayState;
    private buildLentaPendingByAgent;
    private refreshLentaPendingCache;
    private withRelayState;
    private refreshLentaPendingPatch;
    private noteLentaDelivery;
    /** Push `agent:messages` when store is ahead of last emit (subscribed + synced). */
    private flushLentaDelivery;
    private flushPendingLentaForSubscribers;
    private maybeForceStaleLentaDelivery;
    private wireEvents;
    private emitAgentsIndex;
    private refreshAgentsIndex;
    private pushFullStateToRemote;
    private enqueueCommand;
    private enqueueSubscribe;
    private enqueueFocus;
    private ensureCdpAgentsWindow;
    private trySwitchWindowForAgent;
    private handleRemoteClientEvent;
    private onConnect;
    private dispatchClientEvent;
    private runCommand;
    private runAgentsHistory;
    private runAgentsSubscribe;
    /** CDP focus + scroll — off hot path so socket.io stays responsive. */
    private inferRepoNameForAgent;
    private runSubscribeFocusWork;
    /** Push JSONL lenta to phone before CDP focus (fast chat open / switch). */
    private emitJsonlBaselineForAgent;
    /** Load JSONL into store when DOM ingest runs but baseline empty (e.g. after bridge restart). */
    private ensureJsonlBaselineForAgent;
    /** Legacy path — prefer emitJsonlBaselineForAgent + focus in runAgentsSubscribe. */
    private refreshDomChatOnSubscribe;
    private runAgentsUnsubscribe;
    private runAgentsFocus;
}
