export declare class WebSocketPoller { private readonly wsUrl; private readonly apiKey; private readonly slug; private _socket; private _connected; private _buffer; private _todoPath; private _workspaceRoot; private _presenceLockPath; private _destroyed; private _reconnectTimer; private _log; private static readonly RECONNECT_DELAY_MS; private readonly _vncManager; private readonly _rdpManager; private _gitEnabled; private _fileBrowserEnabled; private _fragOpcode; private _fragChunks; private _onConnect; private _onTaskAppend; private _onSteer; private _onCommand; private _onMcpUpdate; private _onSkillUpdate; private _onExportRequest; private _onRestoreRequest; private _onExportConfig; private _pendingFrames; private _seenTaskIds; private _seenOrder; private _seenDeliveriesFile; private static readonly MAX_SEEN_DELIVERIES; private static readonly PING_INTERVAL_MS; private static readonly PONG_GRACE_MS; private _pingTimer; private _lastPongAt; constructor(wsUrl: string, apiKey: string, slug: string); /** Called once when the WS connection is first established (and on each reconnect). */ setOnConnect(cb: () => void): void; /** Called whenever a task is successfully appended to TODO.md via a WS push. */ setOnTaskAppend(cb: () => void): void; /** Called when an instant/steer message arrives — delivered live, NOT queued to TODO. */ setOnSteer(cb: (text: string, onDelivered: () => void) => void): void; /** Called when a slash command (e.g. /restart) is received via WS push. */ setOnCommand(cb: (cmd: string) => void): void; /** Called when a mcp_update frame arrives — receives the new mcpServers map. */ setOnMcpUpdate(cb: (entries: Record) => void): void; /** Called when a skill_update frame arrives — receives the agent's full effective skill set. */ setOnSkillUpdate(cb: (skills: unknown[]) => void): void; /** Called when an export_request frame arrives — agent should create + upload a backup. */ setOnExportRequest(cb: (agentId: string) => void): void; /** Called when a restore_request frame arrives — agent should download + restore a backup. */ setOnRestoreRequest(cb: (agentId: string, downloadUrl: string) => void): void; /** Called when an export_config frame arrives — sync exportEnabled/exportDailyBackup settings. */ setOnExportConfig(cb: (exportEnabled: boolean, exportDailyBackup: boolean, agentId: string) => void): void; /** Start the WebSocket connection (call once). */ start(todoPath: string, log?: (msg: string) => void, workspaceRoot?: string): void; /** * The `autodev start` loop owns this slug's live presence connection. Drop a * lock the co-located `autodev mcp-operate` bridge can see, so it auto-skips * its OWN presence socket even if launched without --no-socket — a second * socket would (last-wins) steal the slug and silently swallow instant * messages the loop is meant to deliver. pid+ts so a crashed loop's stale lock * is ignored. */ private _writePresenceLock; private _clearPresenceLock; /** Reload persisted delivery IDs so a restart doesn't re-ingest replayed tasks. */ private _loadSeenDeliveries; /** Record a delivery id as processed (in-memory + persisted, bounded FIFO). */ private _markSeenDelivery; /** Tear down the connection permanently. */ destroy(): void; /** * Called by the poller loop — always returns false because the WebSocket * connection is event-driven; tasks are appended directly in _onFrame(). */ pollAndAppend(_todoPath: string, _workspaceRoot?: string): Promise; private _connect; private _closeSocket; private _scheduleReconnect; /** Parse and consume complete WebSocket frames from _buffer. */ private _processBuffer; private _parseFrame; private _onFrame; /** Handle a file-browser request from the server (originated by the browser UI). */ private _handleFbRequest; /** Handle a git-panel request from the server (originated by the browser UI). */ private _handleGitRequest; /** Update the VNC password used for incoming vnc_session requests. */ setVncPassword(password?: string): void; setGitEnabled(enabled: boolean): void; setFileBrowserEnabled(enabled: boolean): void; setVncEnabled(enabled: boolean): void; setRdpEnabled(enabled: boolean): void; setRdpSettings(s: { host?: string; port?: number; username?: string; password?: string; domain?: string; guacWsUrl?: string; }): void; /** * Send a JSON payload to the server over the WebSocket connection. * Queues the frame if not yet connected — always returns true (accepted). */ private static readonly MAX_PENDING_FRAMES; sendFrame(payload: unknown): boolean; /** * Confirm to the office that a pushed task ARRIVED in this agent's TODO queue. * Sent as an A2A statusUpdate (event=task_ack) so the server stamps delivered_at, * stops the redelivery sweep, and un-fades the task. Best-effort/idempotent. */ private _sendTaskAck; /** Send a masked WebSocket text frame. */ private _sendTextFrame; private _sendPong; /** Send a zero-payload Ping frame. Server's WS server replies with Pong. */ private _sendPing; /** Start the heartbeat. Cleared automatically on close/destroy/reconnect. */ private _startHeartbeat; private _stopHeartbeat; }