Skip to content

armgit / ruflo

Public Imported from GitHub
0

🌊 The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated

checkpoint: File edit:

rUvd84a8cb6fbaa
diff --git a/v3/@claude-flow/swarm/src/topology-manager.ts b/v3/@claude-flow/swarm/src/topology-manager.ts
index 797a5ec327..cf17f2a080 100644
--- a/v3/@claude-flow/swarm/src/topology-manager.ts
+++ b/v3/@claude-flow/swarm/src/topology-manager.ts
@@ -196,18 +196,18 @@ export class TopologyManager extends EventEmitter implements ITopologyManager {
throw new Error('No nodes available for leader election');
}
- // For hierarchical topology, the queen is the leader
+ // For hierarchical topology, the queen is the leader (O(1) lookup)
if (this.config.type === 'hierarchical') {
- const queen = this.state.nodes.find(n => n.role === 'queen');
+ const queen = this.queenNode;
if (queen) {
this.state.leader = queen.agentId;
return queen.agentId;
}
}
- // For centralized topology, the coordinator is the leader
+ // For centralized topology, the coordinator is the leader (O(1) lookup)
if (this.config.type === 'centralized') {
- const coordinator = this.state.nodes.find(n => n.role === 'coordinator');
+ const coordinator = this.coordinatorNode;
if (coordinator) {
this.state.leader = coordinator.agentId;
return coordinator.agentId;