crann
Version:
Effortless State Synchronization for Web Extensions
50 lines (49 loc) • 1.13 kB
TypeScript
/**
* AgentRegistry - Tracks connected agents
*
* Responsibilities:
* - Maintain registry of connected agents
* - Provide query capabilities
* - Clean up on disconnect
*/
import type { AgentInfo } from "../transport";
import { AgentConnectionInfo } from "./types";
export declare class AgentRegistry {
private readonly agents;
/**
* Register a new agent connection.
*/
add(agentInfo: AgentInfo): AgentConnectionInfo;
/**
* Unregister an agent.
*/
remove(agentId: string): boolean;
/**
* Get agent info by ID.
*/
get(agentId: string): AgentConnectionInfo | undefined;
/**
* Get all connected agents.
*/
getAll(): AgentConnectionInfo[];
/**
* Query agents by criteria.
*/
query(criteria: {
context?: string;
tabId?: number;
frameId?: number;
}): AgentConnectionInfo[];
/**
* Check if an agent is registered.
*/
has(agentId: string): boolean;
/**
* Get the number of connected agents.
*/
get size(): number;
/**
* Clear all agents.
*/
clear(): void;
}