/**
 * gRPC Server for Clawx Agent Communication
 *
 * Replaces WebSocket server and SSE streaming with gRPC bidirectional streaming
 */
import * as grpc from '@grpc/grpc-js';
import { EventEmitter } from 'events';
import type { Persona } from '../../types/persona.js';
import type { AgentIdentity } from '../../types/agent.js';
import { GrpcAgentFrame } from './protocol.js';
export interface ConnectedAgent {
    id: string;
    name: string;
    call: grpc.ServerDuplexStream<any, any>;
    persona?: Persona;
    capabilities: string[];
    endpoint: string;
    lastSeen: number;
    subscriptions: Map<string, Set<string>>;
}
export interface GrpcServerOptions {
    port: number;
    onAgentRegistered?: (agent: AgentIdentity) => void;
    onAgentDisconnected?: (agentId: string) => void;
    onFrame?: (frame: GrpcAgentFrame) => void;
}
export declare class GrpcServer extends EventEmitter {
    private options;
    private server;
    private agents;
    private clients;
    constructor(options: GrpcServerOptions);
    private setupService;
    private handleFrame;
    private handleRegistration;
    private handleHeartbeat;
    private routeFrame;
    private sendToAgent;
    private broadcastFrame;
    private sendError;
    private handleDisconnection;
    start(): Promise<void>;
    stop(): Promise<void>;
    sendFrame(frame: GrpcAgentFrame): boolean;
    sendChat(fromAgentId: string, toAgentId: string, message: string, conversationId?: string, extraPayload?: Record<string, any>): boolean;
    sendTask(fromAgentId: string, toAgentId: string, taskId: string, tool: string, params: any, context?: any): boolean;
    cancelTask(fromAgentId: string, toAgentId: string, taskId: string, reason?: string): boolean;
    broadcast(fromAgentId: string, message: string): number;
    getConnectedAgents(): Array<{
        id: string;
        name: string;
        persona?: Persona;
        capabilities: string[];
    }>;
    getAgentCount(): number;
    isAgentConnected(agentId: string): boolean;
}
//# sourceMappingURL=grpc-server.d.ts.map