Initial commit: Complete Hive distributed AI orchestration platform

This comprehensive implementation includes:
- FastAPI backend with MCP server integration
- React/TypeScript frontend with Vite
- PostgreSQL database with Redis caching
- Grafana/Prometheus monitoring stack
- Docker Compose orchestration
- Full MCP protocol support for Claude Code integration

Features:
- Agent discovery and management across network
- Visual workflow editor and execution engine
- Real-time task coordination and monitoring
- Multi-model support with specialized agents
- Distributed development task allocation

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
anthonyrawlins
2025-07-07 21:44:31 +10:00
commit d7ad321176
2631 changed files with 870175 additions and 0 deletions

33
frontend/Dockerfile Normal file
View File

@@ -0,0 +1,33 @@
FROM node:18-alpine
WORKDIR /app
# Copy package files
COPY package*.json ./
# Install dependencies (including dev deps for build)
RUN npm install
# Copy source code
COPY . .
# Build the application
RUN npm run build
# Create non-root user
RUN addgroup -g 1001 -S nodejs
RUN adduser -S nextjs -u 1001
# Change ownership
RUN chown -R nextjs:nodejs /app
USER nextjs
# Expose port
EXPOSE 3000
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD curl -f http://localhost:3000 || exit 1
# Start the application
CMD ["npm", "run", "preview"]

13
frontend/index.html Normal file
View File

@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/hive-icon.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>🐝 Hive - Distributed AI Orchestration</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>

63
frontend/package.json Normal file
View File

@@ -0,0 +1,63 @@
{
"name": "hive-frontend",
"version": "1.0.0",
"description": "Hive Distributed AI Orchestration Platform - Frontend",
"private": true,
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"start": "vite preview --host 0.0.0.0 --port 3000",
"preview": "vite preview",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"lint:fix": "eslint . --ext ts,tsx --fix",
"type-check": "tsc --noEmit"
},
"dependencies": {
"react": "^18.2.0",
"react-dom": "^18.2.0",
"reactflow": "^11.10.1",
"zustand": "^4.4.7",
"@tanstack/react-query": "^5.17.0",
"axios": "^1.6.0",
"lucide-react": "^0.294.0",
"clsx": "^2.0.0",
"tailwind-merge": "^2.2.0",
"recharts": "^2.8.0",
"react-router-dom": "^6.20.0",
"@headlessui/react": "^1.7.17",
"@heroicons/react": "^2.0.18",
"react-hook-form": "^7.48.0",
"@hookform/resolvers": "^3.3.0",
"zod": "^3.22.0",
"react-hot-toast": "^2.4.0",
"framer-motion": "^10.16.0",
"date-fns": "^2.30.0"
},
"devDependencies": {
"@types/react": "^18.2.43",
"@types/react-dom": "^18.2.17",
"@typescript-eslint/eslint-plugin": "^6.14.0",
"@typescript-eslint/parser": "^6.14.0",
"@vitejs/plugin-react": "^4.2.1",
"autoprefixer": "^10.4.16",
"eslint": "^8.55.0",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.5",
"postcss": "^8.4.32",
"tailwindcss": "^3.3.6",
"typescript": "^5.2.2",
"vite": "^5.0.8"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}

View File

@@ -0,0 +1,6 @@
module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
}

55
frontend/src/App.tsx Normal file
View File

@@ -0,0 +1,55 @@
function App() {
return (
<div className="min-h-screen bg-gradient-to-br from-blue-50 to-purple-50">
<div className="container mx-auto px-4 py-16">
<div className="text-center">
<div className="text-8xl mb-8">🐝</div>
<h1 className="text-6xl font-bold text-gray-900 mb-4">
Welcome to Hive
</h1>
<p className="text-2xl text-gray-700 mb-8">
Unified Distributed AI Orchestration Platform
</p>
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8 mt-16">
<div className="bg-white rounded-lg shadow-lg p-6">
<div className="text-4xl mb-4">🤖</div>
<h3 className="text-xl font-semibold mb-2">Multi-Agent Coordination</h3>
<p className="text-gray-600">
Coordinate specialized AI agents across your cluster for optimal task distribution
</p>
</div>
<div className="bg-white rounded-lg shadow-lg p-6">
<div className="text-4xl mb-4">🔄</div>
<h3 className="text-xl font-semibold mb-2">Workflow Orchestration</h3>
<p className="text-gray-600">
Visual n8n-compatible workflow editor with real-time execution monitoring
</p>
</div>
<div className="bg-white rounded-lg shadow-lg p-6">
<div className="text-4xl mb-4">📊</div>
<h3 className="text-xl font-semibold mb-2">Performance Monitoring</h3>
<p className="text-gray-600">
Real-time metrics, alerts, and dashboards for comprehensive system monitoring
</p>
</div>
</div>
<div className="mt-16 text-center">
<div className="text-lg text-gray-700 mb-4">
🚀 Hive is starting up... Please wait for all services to be ready.
</div>
<div className="text-sm text-gray-500">
This unified platform consolidates McPlan, distributed-ai-dev, and cluster monitoring
</div>
</div>
</div>
</div>
</div>
)
}
export default App

30
frontend/src/index.css Normal file
View File

@@ -0,0 +1,30 @@
@tailwind base;
@tailwind components;
@tailwind utilities;
:root {
font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
line-height: 1.5;
font-weight: 400;
color-scheme: light dark;
color: rgba(17, 24, 39, 0.87);
background-color: #ffffff;
font-synthesis: none;
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
-webkit-text-size-adjust: 100%;
}
body {
margin: 0;
min-width: 320px;
min-height: 100vh;
}
#root {
width: 100%;
min-height: 100vh;
}

10
frontend/src/main.tsx Normal file
View File

@@ -0,0 +1,10 @@
import React from 'react'
import ReactDOM from 'react-dom/client'
import App from './App.tsx'
import './index.css'
ReactDOM.createRoot(document.getElementById('root')!).render(
<React.StrictMode>
<App />
</React.StrictMode>,
)

View File

@@ -0,0 +1,120 @@
// n8n-style workflow interface
export interface N8nWorkflow {
id: string;
name: string;
description?: string;
nodes: N8nNode[];
connections: Record<string, any>;
active: boolean;
settings?: Record<string, any>;
staticData?: Record<string, any>;
createdAt: string;
updatedAt: string;
}
export interface N8nNode {
id: string;
name: string;
type: string;
position: [number, number];
parameters: Record<string, any>;
credentials?: Record<string, any>;
disabled?: boolean;
notes?: string;
retryOnFail?: boolean;
maxTries?: number;
waitBetweenTries?: number;
alwaysOutputData?: boolean;
executeOnce?: boolean;
continueOnFail?: boolean;
}
export interface ExecutionResult {
id: string;
workflowId: string;
status: 'success' | 'error' | 'waiting' | 'running' | 'stopped';
startedAt: string;
stoppedAt?: string;
data?: Record<string, any>;
error?: string;
}
export type NodeStatus = 'waiting' | 'running' | 'success' | 'error' | 'disabled';
// React Flow compatible interfaces
export interface Workflow {
id: string;
name: string;
description?: string;
nodes: WorkflowNode[];
edges: WorkflowEdge[];
status: 'draft' | 'active' | 'inactive';
created_at: string;
updated_at: string;
metadata?: Record<string, any>;
}
export interface WorkflowNode {
id: string;
type: string;
position: { x: number; y: number };
data: NodeData;
style?: Record<string, any>;
}
export interface WorkflowEdge {
id: string;
source: string;
target: string;
sourceHandle?: string;
targetHandle?: string;
type?: string;
data?: EdgeData;
}
export interface NodeData {
label: string;
nodeType: string;
parameters?: Record<string, any>;
credentials?: Record<string, any>;
outputs?: NodeOutput[];
inputs?: NodeInput[];
}
export interface EdgeData {
sourceOutput?: string;
targetInput?: string;
conditions?: Record<string, any>;
}
export interface NodeOutput {
name: string;
type: string;
required?: boolean;
}
export interface NodeInput {
name: string;
type: string;
required?: boolean;
defaultValue?: any;
}
export interface WorkflowExecution {
id: string;
workflow_id: string;
status: 'pending' | 'running' | 'completed' | 'failed' | 'cancelled';
started_at: string;
completed_at?: string;
output?: Record<string, any>;
error?: string;
metadata?: Record<string, any>;
}
export interface WorkflowMetrics {
total_executions: number;
successful_executions: number;
failed_executions: number;
average_duration: number;
last_execution?: string;
}

View File

@@ -0,0 +1,11 @@
/** @type {import('tailwindcss').Config} */
module.exports = {
content: [
"./index.html",
"./src/**/*.{js,ts,jsx,tsx}",
],
theme: {
extend: {},
},
plugins: [],
}

25
frontend/tsconfig.json Normal file
View File

@@ -0,0 +1,25 @@
{
"compilerOptions": {
"target": "ES2020",
"useDefineForClassFields": true,
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"module": "ESNext",
"skipLibCheck": true,
/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx",
/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
},
"include": ["src"],
"references": [{ "path": "./tsconfig.node.json" }]
}

View File

@@ -0,0 +1,10 @@
{
"compilerOptions": {
"composite": true,
"skipLibCheck": true,
"module": "ESNext",
"moduleResolution": "bundler",
"allowSyntheticDefaultImports": true
},
"include": ["vite.config.ts"]
}

18
frontend/vite.config.ts Normal file
View File

@@ -0,0 +1,18 @@
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
server: {
host: '0.0.0.0',
port: 3000,
},
preview: {
host: '0.0.0.0',
port: 3000,
},
build: {
outDir: 'dist',
},
})