From 7dbfcd43bf5d07a0b4d636bfa3a2d10b8a031b6c Mon Sep 17 00:00:00 2001 From: rUv Date: Sun, 4 Jan 2026 21:00: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/mcp/tools/agent-tools.ts | 41 ++++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/v3/mcp/tools/agent-tools.ts b/v3/mcp/tools/agent-tools.ts index 8f78891e58..875c111316 100644 --- a/v3/mcp/tools/agent-tools.ts +++ b/v3/mcp/tools/agent-tools.ts @@ -214,29 +214,36 @@ async function handleTerminateAgent( input: z.infer, context?: ToolContext ): Promise { - // TODO: Integrate with actual agent manager when available - // For now, return stub response - const terminatedAt = new Date().toISOString(); - // Stub implementation - will be replaced with actual agent manager integration - const result: TerminateAgentResult = { + // Try to use swarmCoordinator if available + if (context?.swarmCoordinator) { + try { + const { UnifiedSwarmCoordinator } = await import('@claude-flow/swarm'); + const coordinator = context.swarmCoordinator as InstanceType; + + // Terminate agent + await coordinator.terminateAgent(input.agentId); + + return { + agentId: input.agentId, + terminated: true, + terminatedAt, + reason: input.reason, + }; + } catch (error) { + // Fall through to simple implementation if coordinator fails + console.error('Failed to terminate agent via coordinator:', error); + } + } + + // Simple implementation when no coordinator is available + return { agentId: input.agentId, - terminated: true, + terminated: false, terminatedAt, reason: input.reason, }; - - // TODO: Call actual agent manager - // const agentManager = context?.agentManager as AgentManager; - // if (agentManager) { - // await agentManager.terminateAgent(input.agentId, { - // graceful: input.graceful, - // reason: input.reason, - // }); - // } - - return result; } /**