Major WHOOSH system refactoring and feature enhancements

- Migrated from HIVE branding to WHOOSH across all components
- Enhanced backend API with new services: AI models, BZZZ integration, templates, members
- Added comprehensive testing suite with security, performance, and integration tests
- Improved frontend with new components for project setup, AI models, and team management
- Updated MCP server implementation with WHOOSH-specific tools and resources
- Enhanced deployment configurations with production-ready Docker setups
- Added comprehensive documentation and setup guides
- Implemented age encryption service and UCXL integration

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
anthonyrawlins
2025-08-27 08:34:48 +10:00
parent 0e9844ef13
commit 268214d971
399 changed files with 57390 additions and 2045 deletions

View File

@@ -1,8 +1,8 @@
"""
Hive API - Agent Management Endpoints
WHOOSH API - Agent Management Endpoints
This module provides comprehensive API endpoints for managing Ollama-based AI agents
in the Hive distributed orchestration platform. It handles agent registration,
in the WHOOSH distributed orchestration platform. It handles agent registration,
status monitoring, and lifecycle management.
Key Features:
@@ -42,7 +42,7 @@ logger = logging.getLogger(__name__)
status_code=status.HTTP_200_OK,
summary="List all registered agents",
description="""
Retrieve a comprehensive list of all registered agents in the Hive cluster.
Retrieve a comprehensive list of all registered agents in the WHOOSH cluster.
This endpoint returns detailed information about each agent including:
- Agent identification and endpoint information
@@ -114,7 +114,7 @@ async def get_agents(
status_code=status.HTTP_201_CREATED,
summary="Register a new Ollama agent",
description="""
Register a new Ollama-based AI agent with the Hive cluster.
Register a new Ollama-based AI agent with the WHOOSH cluster.
This endpoint allows you to add new Ollama agents to the distributed AI network.
The agent will be validated for connectivity and model availability before registration.
@@ -136,7 +136,7 @@ async def get_agents(
- `reasoning`: Complex reasoning and problem-solving tasks
**Requirements:**
- Agent endpoint must be accessible from the Hive cluster
- Agent endpoint must be accessible from the WHOOSH cluster
- Specified model must be available on the target Ollama instance
- Agent ID must be unique across the cluster
""",
@@ -153,7 +153,7 @@ async def register_agent(
current_user: Dict[str, Any] = Depends(get_current_user_context)
) -> AgentRegistrationResponse:
"""
Register a new Ollama agent in the Hive cluster.
Register a new Ollama agent in the WHOOSH cluster.
Args:
agent_data: Agent configuration and registration details
@@ -167,13 +167,13 @@ async def register_agent(
HTTPException: If registration fails due to validation or connectivity issues
"""
# Access coordinator through the dependency injection
hive_coordinator = getattr(request.app.state, 'hive_coordinator', None)
if not hive_coordinator:
whoosh_coordinator = getattr(request.app.state, 'whoosh_coordinator', None)
if not whoosh_coordinator:
# Fallback to global coordinator if app state not available
from ..main import unified_coordinator
hive_coordinator = unified_coordinator
whoosh_coordinator = unified_coordinator
if not hive_coordinator:
if not whoosh_coordinator:
raise HTTPException(
status_code=status.HTTP_503_SERVICE_UNAVAILABLE,
detail="Coordinator service unavailable"
@@ -199,7 +199,7 @@ async def register_agent(
)
# Add agent to coordinator
hive_coordinator.add_agent(agent)
whoosh_coordinator.add_agent(agent)
return AgentRegistrationResponse(
agent_id=agent.id,
@@ -303,7 +303,7 @@ async def get_agent(
status_code=status.HTTP_204_NO_CONTENT,
summary="Unregister an agent",
description="""
Remove an agent from the Hive cluster.
Remove an agent from the WHOOSH cluster.
This endpoint safely removes an agent from the cluster by:
1. Checking for active tasks and optionally waiting for completion
@@ -337,7 +337,7 @@ async def unregister_agent(
current_user: Dict[str, Any] = Depends(get_current_user_context)
):
"""
Unregister an agent from the Hive cluster.
Unregister an agent from the WHOOSH cluster.
Args:
agent_id: Unique identifier of the agent to remove
@@ -349,12 +349,12 @@ async def unregister_agent(
HTTPException: If agent not found, has active tasks, or removal fails
"""
# Access coordinator
hive_coordinator = getattr(request.app.state, 'hive_coordinator', None)
if not hive_coordinator:
whoosh_coordinator = getattr(request.app.state, 'whoosh_coordinator', None)
if not whoosh_coordinator:
from ..main import unified_coordinator
hive_coordinator = unified_coordinator
whoosh_coordinator = unified_coordinator
if not hive_coordinator:
if not whoosh_coordinator:
raise HTTPException(
status_code=status.HTTP_503_SERVICE_UNAVAILABLE,
detail="Coordinator service unavailable"
@@ -377,7 +377,7 @@ async def unregister_agent(
)
# Remove from coordinator
hive_coordinator.remove_agent(agent_id)
whoosh_coordinator.remove_agent(agent_id)
# Remove from database
db.delete(db_agent)
@@ -406,7 +406,7 @@ async def unregister_agent(
- Maintain their registration in the cluster
Agents should call this endpoint every 30-60 seconds to maintain
their active status in the Hive cluster.
their active status in the WHOOSH cluster.
""",
responses={
200: {"description": "Heartbeat received successfully"},
@@ -436,12 +436,12 @@ async def agent_heartbeat(
)
# Access coordinator
hive_coordinator = getattr(request.app.state, 'hive_coordinator', None)
if not hive_coordinator:
whoosh_coordinator = getattr(request.app.state, 'whoosh_coordinator', None)
if not whoosh_coordinator:
from ..main import unified_coordinator
hive_coordinator = unified_coordinator
whoosh_coordinator = unified_coordinator
if not hive_coordinator:
if not whoosh_coordinator:
raise HTTPException(
status_code=status.HTTP_503_SERVICE_UNAVAILABLE,
detail="Coordinator service unavailable"
@@ -449,7 +449,7 @@ async def agent_heartbeat(
try:
# Update agent heartbeat timestamp
agent_service = hive_coordinator.agent_service
agent_service = whoosh_coordinator.agent_service
if agent_service:
agent_service.update_agent_heartbeat(agent_id)
@@ -491,7 +491,7 @@ async def agent_heartbeat(
Register an agent automatically with capability detection.
This endpoint is designed for Bzzz agents running as systemd services
to automatically register themselves with the Hive coordinator.
to automatically register themselves with the WHOOSH coordinator.
Features:
- Automatic capability detection based on available models
@@ -511,7 +511,7 @@ async def auto_register_agent(
request: Request
) -> AgentRegistrationResponse:
"""
Automatically register a Bzzz agent with the Hive coordinator.
Automatically register a Bzzz agent with the WHOOSH coordinator.
Args:
agent_data: Agent configuration including endpoint, models, etc.
@@ -532,12 +532,12 @@ async def auto_register_agent(
)
# Access coordinator
hive_coordinator = getattr(request.app.state, 'hive_coordinator', None)
if not hive_coordinator:
whoosh_coordinator = getattr(request.app.state, 'whoosh_coordinator', None)
if not whoosh_coordinator:
from ..main import unified_coordinator
hive_coordinator = unified_coordinator
whoosh_coordinator = unified_coordinator
if not hive_coordinator:
if not whoosh_coordinator:
raise HTTPException(
status_code=status.HTTP_503_SERVICE_UNAVAILABLE,
detail="Coordinator service unavailable"