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:

rUv12fe4da63a19
diff --git a/v3/@claude-flow/swarm/src/topology-manager.ts b/v3/@claude-flow/swarm/src/topology-manager.ts
index e5b6892ce2..1e375c8691 100644
--- a/v3/@claude-flow/swarm/src/topology-manager.ts
+++ b/v3/@claude-flow/swarm/src/topology-manager.ts
@@ -463,13 +463,18 @@ export class TopologyManager extends EventEmitter implements ITopologyManager {
}
private async rebalanceHierarchical(): Promise<void> {
- const queen = this.state.nodes.find(n => n.role === 'queen');
+ // O(1) queen lookup
+ let queen = this.queenNode;
if (!queen) {
// Elect a queen if missing
if (this.state.nodes.length > 0) {
- this.state.nodes[0].role = 'queen';
+ const newQueen = this.state.nodes[0]!;
+ newQueen.role = 'queen';
+ this.addToRoleIndex(newQueen);
+ queen = newQueen;
+ } else {
+ return;
}
- return;
}
// Ensure all workers are connected to queen