Complete Hive platform functionality and expand cluster to 7 agents

Major Features Added:
- Fix Socket.IO connectivity by updating Dockerfile to use socket_app
- Resolve distributed workflows API to return arrays instead of errors
- Expand agent coverage from 3 to 7 agents (added OAK and ROSEWOOD)
- Create comprehensive systemd service for MCP server with auto-discovery
- Add daemon mode with periodic agent discovery every 5 minutes
- Implement comprehensive test suite with 100% pass rate

Infrastructure Improvements:
- Enhanced database connection handling with retry logic
- Improved agent registration with persistent storage
- Added proper error handling for distributed workflows endpoint
- Created management scripts for service lifecycle operations

Agent Cluster Expansion:
- ACACIA: deepseek-r1:7b (kernel_dev)
- WALNUT: starcoder2:15b (pytorch_dev)
- IRONWOOD: deepseek-coder-v2 (profiler)
- OAK: codellama:latest (docs_writer)
- OAK-TESTER: deepseek-r1:latest (tester)
- ROSEWOOD: deepseek-coder-v2:latest (kernel_dev)
- ROSEWOOD-VISION: llama3.2-vision:11b (tester)

System Status: All 7 agents healthy, Socket.IO operational, MCP server fully functional

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
anthonyrawlins
2025-07-10 08:41:34 +10:00
parent 8c3adf6d8f
commit fc0eec91ef
16 changed files with 1599 additions and 84 deletions

View File

@@ -24,6 +24,8 @@ class HiveMCPServer {
private hiveClient: HiveClient;
private hiveTools: HiveTools;
private hiveResources: HiveResources;
private discoveryInterval?: NodeJS.Timeout;
private isDaemonMode: boolean = false;
constructor() {
this.server = new Server(
@@ -78,14 +80,28 @@ class HiveMCPServer {
};
process.on('SIGINT', async () => {
await this.server.close();
process.exit(0);
await this.shutdown();
});
process.on('SIGTERM', async () => {
await this.shutdown();
});
process.on('SIGHUP', async () => {
console.log('🔄 Received SIGHUP, triggering agent discovery...');
await this.autoDiscoverAgents();
});
}
async start() {
console.log('🐝 Starting Hive MCP Server...');
// Check for daemon mode
this.isDaemonMode = process.argv.includes('--daemon');
if (this.isDaemonMode) {
console.log('🔧 Running in daemon mode');
}
// Test connection to Hive backend
try {
await this.hiveClient.testConnection();
@@ -104,11 +120,41 @@ class HiveMCPServer {
console.warn('⚠️ Auto-discovery failed, continuing without it:', error);
}
const transport = new StdioServerTransport();
await this.server.connect(transport);
// Set up periodic auto-discovery if enabled
if (this.isDaemonMode && process.env.AUTO_DISCOVERY !== 'false') {
this.setupPeriodicDiscovery();
}
if (this.isDaemonMode) {
console.log('🚀 Hive MCP Server running in daemon mode');
console.log('🔗 Monitoring cluster and auto-discovering agents...');
// Keep the process alive in daemon mode
setInterval(() => {
// Health check - could add cluster monitoring here
}, 30000);
} else {
const transport = new StdioServerTransport();
await this.server.connect(transport);
console.log('🚀 Hive MCP Server running on stdio');
console.log('🔗 AI assistants can now orchestrate your distributed cluster!');
}
}
private setupPeriodicDiscovery() {
const interval = parseInt(process.env.DISCOVERY_INTERVAL || '300000', 10); // Default 5 minutes
console.log(`🔄 Setting up periodic auto-discovery every ${interval / 1000} seconds`);
console.log('🚀 Hive MCP Server running on stdio');
console.log('🔗 AI assistants can now orchestrate your distributed cluster!');
this.discoveryInterval = setInterval(async () => {
console.log('🔍 Periodic agent auto-discovery...');
try {
await this.autoDiscoverAgents();
console.log('✅ Periodic auto-discovery completed');
} catch (error) {
console.warn('⚠️ Periodic auto-discovery failed:', error);
}
}, interval);
}
private async autoDiscoverAgents() {
@@ -122,6 +168,19 @@ class HiveMCPServer {
throw new Error(`Auto-discovery failed: ${result.content[0]?.text || 'Unknown error'}`);
}
}
private async shutdown() {
console.log('🛑 Shutting down Hive MCP Server...');
if (this.discoveryInterval) {
clearInterval(this.discoveryInterval);
console.log('✅ Stopped periodic auto-discovery');
}
await this.server.close();
console.log('✅ Hive MCP Server stopped');
process.exit(0);
}
}
// Start the server