/** * Network Topology - Defines and manages network structure * * Provides different topology patterns for agent networks: * - Star: Central coordinator with peripheral agents * - Mesh: All agents can communicate with each other * - Hierarchical: Tree structure with supervisors and workers * - Ring: Agents form a circular communication pattern * - Custom: User-defined topology */ import type { Agent } from "../agent.js"; import type { TopologyType, TopologyNode, TopologyEdge, TopologyConfig, TopologyStats } from "../../types/index.js"; /** * Network Topology - Manages agent network structure */ export declare class NetworkTopology { private nodes; private edges; private config; private topologyId; constructor(config: TopologyConfig); /** * Build topology from agents */ buildFromAgents(agents: Agent[]): void; /** * Add a node to the topology */ addNode(agent: Agent, role?: TopologyNode["role"]): TopologyNode; /** * Remove a node from the topology */ removeNode(nodeId: string): boolean; /** * Add an edge between nodes */ addEdge(sourceId: string, targetId: string, type?: TopologyEdge["type"], weight?: number): TopologyEdge | undefined; /** * Remove an edge */ removeEdge(edgeId: string): boolean; /** * Build star topology (hub and spoke) */ private buildStarTopology; /** * Build mesh topology (fully connected) */ private buildMeshTopology; /** * Build hierarchical topology (tree) */ private buildHierarchicalTopology; /** * Build ring topology */ private buildRingTopology; /** * Build custom topology from configuration */ private buildCustomTopology; /** * Get node by ID */ getNode(nodeId: string): TopologyNode | undefined; /** * Get node by agent ID */ getNodeByAgentId(agentId: string): TopologyNode | undefined; /** * Get all nodes */ getAllNodes(): TopologyNode[]; /** * Get all edges */ getAllEdges(): TopologyEdge[]; /** * Get connected nodes */ getConnectedNodes(nodeId: string): TopologyNode[]; /** * Find shortest path between two nodes (BFS) */ findShortestPath(sourceId: string, targetId: string): string[] | undefined; /** * Check if two nodes are connected (directly or indirectly) */ areConnected(sourceId: string, targetId: string): boolean; /** * Get nodes by role */ getNodesByRole(role: TopologyNode["role"]): TopologyNode[]; /** * Get coordinator/root node */ getCoordinator(): TopologyNode | undefined; /** * Calculate topology statistics */ getStats(): TopologyStats; /** * Export topology as JSON */ toJSON(): { id: string; type: TopologyType; nodes: TopologyNode[]; edges: TopologyEdge[]; }; /** * Import topology from JSON */ fromJSON(data: { id?: string; type: TopologyType; nodes: TopologyNode[]; edges: TopologyEdge[]; }): void; /** * Get topology type */ getType(): TopologyType; /** * Get topology ID */ getId(): string; } /** * Topology builder for fluent API */ export declare class TopologyBuilder { private agents; private config; constructor(type: TopologyType); /** * Add an agent */ addAgent(agent: Agent): TopologyBuilder; /** * Add multiple agents */ addAgents(agents: Agent[]): TopologyBuilder; /** * Set coordinator (for star topology) */ setCoordinator(agentId: string): TopologyBuilder; /** * Set root (for hierarchical topology) */ setRoot(agentId: string): TopologyBuilder; /** * Set max children (for hierarchical topology) */ setMaxChildren(max: number): TopologyBuilder; /** * Add custom edge */ addCustomEdge(sourceAgentId: string, targetAgentId: string, bidirectional?: boolean): TopologyBuilder; /** * Build the topology */ build(): NetworkTopology; }