/**
 * gRPC Streaming Client for Master
 *
 * Subscribes to worker event streams via gRPC and forwards events to TUI.
 * Replaces SSE-based StreamingClient.
 */
import { EventEmitter } from 'events';
import type { StreamEvent } from './grpc-stream-events.js';
import type { GrpcAgentFrame } from '../core/grpc/protocol.js';
export interface GrpcStreamClientOptions {
    agentId: string;
    agentName: string;
    onEvent?: (event: StreamEvent) => void;
}
export declare class GrpcStreamClient extends EventEmitter {
    private agentId;
    private agentName;
    private isConnected;
    private eventHandlers;
    private unsubscribeCallback;
    constructor(options: GrpcStreamClientOptions);
    /**
     * Add an event handler
     */
    addEventHandler(handler: (event: StreamEvent) => void): void;
    /**
     * Remove an event handler
     */
    removeEventHandler(handler: (event: StreamEvent) => void): void;
    /**
     * Connect to gRPC stream for this agent
     * This should be called by GrpcStreamingManager when subscribing
     */
    connect(unsubscribeCallback: () => void): void;
    /**
     * Disconnect from gRPC stream
     */
    disconnect(): void;
    /**
     * Handle incoming gRPC frame and convert to StreamEvent
     */
    handleGrpcFrame(frame: GrpcAgentFrame): void;
    /**
     * Convert gRPC frame to StreamEvent
     */
    private convertGrpcFrameToEvent;
    /**
     * Get connection status
     */
    get connected(): boolean;
}
/**
 * gRPC Streaming Manager
 *
 * Manages multiple gRPC stream clients and routes frames from GrpcServer
 */
export declare class GrpcStreamingManager extends EventEmitter {
    private clients;
    private frameHandler;
    constructor();
    /**
     * Subscribe to agent events via gRPC
     */
    subscribeToAgent(agentId: string, agentName: string, onEvent: (event: StreamEvent) => void): GrpcStreamClient;
    /**
     * Unsubscribe from agent events
     */
    unsubscribeFromAgent(agentId: string, handler?: (event: StreamEvent) => void): void;
    /**
     * Handle incoming gRPC frame from GrpcServer
     * This should be called by the master's GrpcServer onFrame callback
     */
    handleGrpcFrame(frame: GrpcAgentFrame): void;
    /**
     * Get all connected clients
     */
    getClients(): Map<string, GrpcStreamClient>;
    /**
     * Clean up all clients
     */
    cleanup(): void;
}
//# sourceMappingURL=grpc-streaming-client.d.ts.map