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:

rUv899c965f982f
diff --git a/v3/@claude-flow/swarm/src/federation-hub.ts b/v3/@claude-flow/swarm/src/federation-hub.ts
index 0d88c17c14..d20953ae5e 100644
--- a/v3/@claude-flow/swarm/src/federation-hub.ts
+++ b/v3/@claude-flow/swarm/src/federation-hub.ts
@@ -813,7 +813,19 @@ export class FederationHub extends EventEmitter {
}
private getSwarmAgentCount(swarmId: SwarmId): number {
- return this.getActiveAgents(swarmId).length;
+ // Use index for O(1) lookup instead of O(n) filter
+ const swarmAgents = this.agentsBySwarm.get(swarmId);
+ if (!swarmAgents) return 0;
+
+ // Count only active and spawning agents
+ let count = 0;
+ for (const agentId of swarmAgents) {
+ const agent = this.ephemeralAgents.get(agentId);
+ if (agent && (agent.status === 'active' || agent.status === 'spawning')) {
+ count++;
+ }
+ }
+ return count;
}
private getActiveSwarmCount(): number {