feat(agents): Add Create/Delete Agent functionality

Backend:
- Added POST /city/agents endpoint for creating agents
- Added DELETE /city/agents/{id} endpoint for soft-deleting agents
- Added CreateAgentRequest, CreateAgentResponse, DeleteAgentResponse models

Frontend:
- Added '+ Новий агент' button on /agents page
- Created /agents/new page with full agent creation form
- Added 'Видалити агента' button in agent Identity tab (Danger Zone)

Features:
- Auto-generate slug from display_name
- Support for all agent fields: kind, role, model, node, district, microdao
- Color picker for agent color
- Visibility toggles (is_public, is_orchestrator)
- Soft delete with confirmation dialog
This commit is contained in:
Apple
2025-12-01 09:29:42 -08:00
parent 649d07ee29
commit 6cd8148872
5 changed files with 584 additions and 13 deletions

View File

@@ -579,6 +579,48 @@ class MicrodaoOption(BaseModel):
is_active: bool = True
# =============================================================================
# Agent Management (Create/Delete)
# =============================================================================
class CreateAgentRequest(BaseModel):
"""Request to create a new agent"""
slug: str
display_name: str
kind: str = "assistant" # assistant, orchestrator, specialist, civic
role: Optional[str] = None
model: Optional[str] = None
node_id: Optional[str] = None
home_node_id: Optional[str] = None
home_microdao_id: Optional[str] = None
district: Optional[str] = None
primary_room_slug: Optional[str] = None
avatar_url: Optional[str] = None
color_hint: Optional[str] = None
is_public: bool = False
is_orchestrator: bool = False
priority: str = "medium"
class CreateAgentResponse(BaseModel):
"""Response after creating an agent"""
id: str
slug: str
display_name: str
kind: str
node_id: Optional[str] = None
home_microdao_id: Optional[str] = None
district: Optional[str] = None
created_at: datetime
class DeleteAgentResponse(BaseModel):
"""Response after deleting an agent"""
ok: bool
message: str
agent_id: str
# =============================================================================
# Visibility Updates (Task 029)
# =============================================================================