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:

rUvc83233e74b43
diff --git a/v3/@claude-flow/cli/src/commands/agent.ts b/v3/@claude-flow/cli/src/commands/agent.ts
index 08a5b77f50..fdffdefd05 100644
--- a/v3/@claude-flow/cli/src/commands/agent.ts
+++ b/v3/@claude-flow/cli/src/commands/agent.ts
@@ -396,16 +396,39 @@ const stopCommand: Command = {
output.printInfo(`Stopping agent ${agentId}...`);
- // Simulate stop process
- if (!force) {
- output.writeln(output.dim(' Completing current task...'));
- output.writeln(output.dim(' Saving state...'));
- output.writeln(output.dim(' Releasing resources...'));
- }
+ try {
+ // Call MCP tool to terminate agent
+ const result = await callMCPTool<{
+ agentId: string;
+ terminated: boolean;
+ terminatedAt: string;
+ }>('agent/terminate', {
+ agentId,
+ graceful: !force,
+ reason: 'Stopped by user via CLI',
+ });
+
+ if (!force) {
+ output.writeln(output.dim(' Completing current task...'));
+ output.writeln(output.dim(' Saving state...'));
+ output.writeln(output.dim(' Releasing resources...'));
+ }
- output.printSuccess(`Agent ${agentId} stopped successfully`);
+ output.printSuccess(`Agent ${agentId} stopped successfully`);
+
+ if (ctx.flags.format === 'json') {
+ output.printJson(result);
+ }
- return { success: true, data: { id: agentId, stopped: true, force } };
+ return { success: true, data: result };
+ } catch (error) {
+ if (error instanceof MCPClientError) {
+ output.printError(`Failed to stop agent: ${error.message}`);
+ } else {
+ output.printError(`Unexpected error: ${String(error)}`);
+ }
+ return { success: false, exitCode: 1 };
+ }
}
};