From d84a8cb6fbaa3c284faeb914528eafa4f469f237 Mon Sep 17 00:00:00 2001 From: rUv Date: Mon, 5 Jan 2026 00:30:18 +0000 Subject: [PATCH] checkpoint: File edit: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🚀 Generated with [Claude Code](https://claude.com/claude-code) 📊 V3 Development Progress Checkpoint Co-Authored-By: Claude Sonnet 4 --- v3/@claude-flow/swarm/src/topology-manager.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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;