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:

rUv627426cffa9b
diff --git a/v3/mcp/tools/agent-tools.ts b/v3/mcp/tools/agent-tools.ts
index 1b959744b6..8f78891e58 100644
--- a/v3/mcp/tools/agent-tools.ts
+++ b/v3/mcp/tools/agent-tools.ts
@@ -152,56 +152,56 @@ async function handleListAgents(
input: z.infer<typeof listAgentsSchema>,
context?: ToolContext
): Promise<ListAgentsResult> {
- // TODO: Integrate with actual agent manager when available
- // For now, return stub response
+ // Try to use swarmCoordinator if available
+ if (context?.swarmCoordinator) {
+ try {
+ const { UnifiedSwarmCoordinator } = await import('@claude-flow/swarm');
+ const coordinator = context.swarmCoordinator as InstanceType<typeof UnifiedSwarmCoordinator>;
- // Stub implementation - will be replaced with actual agent manager integration
- const agents: AgentInfo[] = [
- {
- id: 'agent-example-1',
- agentType: 'coder',
- status: 'active',
- createdAt: new Date(Date.now() - 3600000).toISOString(),
- lastActivityAt: new Date().toISOString(),
- },
- {
- id: 'agent-example-2',
- agentType: 'reviewer',
- status: 'idle',
- createdAt: new Date(Date.now() - 7200000).toISOString(),
- lastActivityAt: new Date(Date.now() - 600000).toISOString(),
- },
- ];
+ // Get swarm status
+ const status = await coordinator.getStatus();
+
+ // Convert swarm agents to AgentInfo format
+ let agents: AgentInfo[] = status.agents.map(agent => ({
+ id: agent.id,
+ agentType: agent.type,
+ status: agent.status === 'active' ? 'active' :
+ agent.status === 'idle' ? 'idle' : 'terminated',
+ createdAt: agent.createdAt.toISOString(),
+ lastActivityAt: agent.lastActivityAt?.toISOString(),
+ config: agent.config,
+ metadata: agent.metadata,
+ }));
+
+ // Apply filters
+ if (input.status && input.status !== 'all') {
+ agents = agents.filter(a => a.status === input.status);
+ }
+ if (input.agentType) {
+ agents = agents.filter(a => a.agentType === input.agentType);
+ }
+
+ // Apply pagination
+ const offset = input.offset || 0;
+ const limit = input.limit || agents.length;
+ const paginated = agents.slice(offset, offset + limit);
- // Apply filters
- let filtered = agents;
- if (input.status && input.status !== 'all') {
- filtered = filtered.filter(a => a.status === input.status);
- }
- if (input.agentType) {
- filtered = filtered.filter(a => a.agentType === input.agentType);
+ return {
+ agents: paginated,
+ total: agents.length,
+ limit: input.limit,
+ offset: input.offset,
+ };
+ } catch (error) {
+ // Fall through to simple implementation if coordinator fails
+ console.error('Failed to list agents via coordinator:', error);
+ }
}
- // Apply pagination
- const offset = input.offset || 0;
- const limit = input.limit || filtered.length;
- const paginated = filtered.slice(offset, offset + limit);
-
- // TODO: Call actual agent manager
- // const agentManager = context?.agentManager as AgentManager;
- // if (agentManager) {
- // const agents = await agentManager.listAgents({
- // status: input.status,
- // agentType: input.agentType,
- // limit: input.limit,
- // offset: input.offset,
- // });
- // return agents;
- // }
-
+ // Simple implementation when no coordinator is available
return {
- agents: paginated,
- total: filtered.length,
+ agents: [],
+ total: 0,
limit: input.limit,
offset: input.offset,
};