import { Runtime } from 'webextension-polyfill';
import { Agent, AgentInfo, PorterContext, AgentId, BrowserLocation } from '../porter.model';
import { Logger } from '../porter.utils';
export interface AgentOperations {
    addAgent(port: Runtime.Port, context?: PorterContext): AgentId | undefined;
    queryAgents(location: Partial<BrowserLocation>): Agent[];
    getAgentById(id: AgentId): Agent | null;
    getAgentsByContext(context: PorterContext): Agent[];
    getAgentByLocation(location: BrowserLocation): Agent | null;
    getAllAgents(): Agent[];
    getAllAgentsInfo(): AgentInfo[];
    hasPort(port: Runtime.Port): boolean;
    removeAgent(agentId: AgentId): void;
    printAgents(): void;
}
export interface AgentEventEmitter {
    on(event: 'agentSetup', handler: (agent: Agent) => void): void;
    on(event: 'agentMessage', handler: (message: any, info: AgentInfo) => void): void;
    on(event: 'agentDisconnect', handler: (info: AgentInfo) => void): void;
}
export declare class AgentManager implements AgentOperations, AgentEventEmitter {
    private logger;
    private agents;
    private agentsInfo;
    private eventHandlers;
    constructor(logger: Logger);
    addAgent(port: Runtime.Port, context?: PorterContext): AgentId | undefined;
    getAgentByLocation(location: BrowserLocation): Agent | null;
    getAgentsByContext(context: PorterContext): Agent[];
    getAllAgents(): Agent[];
    queryAgents(location: Partial<BrowserLocation>): Agent[];
    getAgentById(id: AgentId): Agent | null;
    getAllAgentsInfo(): AgentInfo[];
    hasPort(port: Runtime.Port): boolean;
    removeAgent(agentId: AgentId): void;
    printAgents(): void;
    on(event: string, handler: Function): void;
    private emit;
    private identifyConnectionSource;
}
