/// <reference types="node" />
import { EventEmitter } from 'events';
import WebSocket from 'ws';
export interface HtkOperation {
    name: string;
    description: string;
    category: string;
    tiers: Array<'free' | 'pro'>;
    inputSchema: any;
    outputSchema: any;
    annotations?: {
        readOnlyHint?: boolean;
        destructiveHint?: boolean;
        idempotentHint?: boolean;
        openWorldHint?: boolean;
    };
}
export declare function getSocketPath(): Promise<string>;
export declare class UiOperationBridge extends EventEmitter {
    private authToken?;
    private channels;
    private pending;
    private socketServer;
    constructor(authToken?: string | undefined);
    private get primaryChannel();
    get isReady(): boolean;
    get currentOperations(): HtkOperation[];
    isPaidUser(): boolean;
    /**
     * Called when a UI client connects via WebSocket upgrade on /ui-operations.
     * Each connection becomes a channel, ordered by connection time. The first
     * channel is always primary — operations and execute requests route through
     * it. If the primary hasn't sent operations yet, the bridge is not ready
     * regardless of other channels. When a channel disconnects, the next one
     * takes over as primary.
     */
    setWebSocket(ws: WebSocket): void;
    executeOperation(operation: string, params?: Record<string, unknown>): Promise<any>;
    startApiServer(socketPath: string): Promise<void>;
    private handleApiStatus;
    private handleApiOperations;
    private handleApiExecute;
    private handleMessage;
    private applyOperations;
    private handleAuth;
    private completeInitialAuth;
    private sendAuthResult;
    private handleChannelClose;
    private handleResponse;
    private rejectAllPending;
    destroy(): void;
}
