import { EventEmitter } from 'events'; interface PluginCommand { id?: string; command: string; args?: unknown; } export interface PluginResponse { id?: string; success: boolean; data?: unknown; error?: string; windowContext?: { windowLabel: string; totalWindows: number; warning?: string; }; } /** * Client to communicate with the MCP Bridge plugin's WebSocket server */ export declare class PluginClient extends EventEmitter { private _ws; private _url; private _host; private _port; private _reconnectAttempts; private _shouldReconnect; private _reconnectDelay; private _pendingRequests; /** * Constructor for PluginClient * @param host Host address of the WebSocket server * @param port Port number of the WebSocket server */ constructor(host: string, port: number); /** * Creates a PluginClient with default configuration from environment. */ static create_default(): PluginClient; /** * Gets the host this client is configured to connect to. */ get host(): string; /** * Gets the port this client is configured to connect to. */ get port(): number; /** * Connect to the plugin's WebSocket server */ connect(): Promise; /** * Disconnect from the plugin */ disconnect(): void; /** * Send a command to the plugin and wait for response. * * Automatically retries on transient "not found" errors (e.g. window not * yet registered after WebSocket connect) with exponential backoff. */ sendCommand(command: PluginCommand, timeoutMs?: number): Promise; /** * Check if connected */ isConnected(): boolean; } /** * Gets the existing singleton PluginClient without creating or modifying it. * Use this for status checks where you don't want to affect the current connection. * * @returns The existing PluginClient or null if none exists */ export declare function getExistingPluginClient(): PluginClient | null; /** * Gets or creates a singleton PluginClient. * * If host/port are provided and differ from the existing client's configuration, * the existing client is disconnected and a new one is created. This ensures * that session start with a specific port always uses that port. * * @param host Optional host override * @param port Optional port override */ export declare function getPluginClient(host?: string, port?: number): PluginClient; /** * Resets the singleton client (useful for reconnecting with different config). */ export declare function resetPluginClient(): void; export declare function connectPlugin(host?: string, port?: number): Promise; /** * Ensures a session is active and connects to the plugin using session config. * This should be used by all tools that require a connected Tauri app. * * @param appIdentifier - Optional app identifier to target specific app * @throws Error if no session is active */ export declare function ensureSessionAndConnect(appIdentifier?: string | number): Promise; export declare function disconnectPlugin(): Promise; export {};