feat: agent coordination system (workflows, locks, components, messages)
Adds /api/coord/* endpoints for real-time cross-session coordination: - coord_workflows: named units of work per project - coord_work_items: tasks within workflows with dependency chains - coord_session_locks: exclusive resource locks with auto-expiry (TTL) - coord_component_states: live component state per project (upsert) - coord_messages: cross-session messaging and broadcasts - /api/coord/status: cross-project snapshot endpoint Replaces PROJECT_STATE.md as the coordination layer for Claude sessions. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
53
api/schemas/coord_work_item.py
Normal file
53
api/schemas/coord_work_item.py
Normal file
@@ -0,0 +1,53 @@
|
||||
"""Pydantic schemas for CoordWorkItem."""
|
||||
|
||||
from datetime import datetime
|
||||
from typing import Optional
|
||||
from uuid import UUID
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
|
||||
class CoordWorkItemCreate(BaseModel):
|
||||
"""Input schema for creating a work item."""
|
||||
|
||||
workflow_id: str = Field(..., description="Parent workflow UUID", max_length=36)
|
||||
project_key: str = Field(..., description="Project namespace slug", max_length=200)
|
||||
title: str = Field(..., description="Short title", max_length=500)
|
||||
description: Optional[str] = Field(None, description="Full description, markdown ok")
|
||||
status: str = Field("pending", description="Status: pending, in_progress, blocked, completed, cancelled")
|
||||
priority: int = Field(0, description="Higher value = more urgent")
|
||||
assigned_session: Optional[str] = Field(None, max_length=200)
|
||||
depends_on_id: Optional[str] = Field(None, description="Blocking predecessor item UUID", max_length=36)
|
||||
|
||||
|
||||
class CoordWorkItemUpdate(BaseModel):
|
||||
"""Input schema for updating a work item. All fields optional."""
|
||||
|
||||
title: Optional[str] = Field(None, max_length=500)
|
||||
description: Optional[str] = None
|
||||
status: Optional[str] = Field(None, description="Status: pending, in_progress, blocked, completed, cancelled")
|
||||
priority: Optional[int] = None
|
||||
assigned_session: Optional[str] = Field(None, max_length=200)
|
||||
depends_on_id: Optional[str] = Field(None, max_length=36)
|
||||
started_at: Optional[datetime] = None
|
||||
completed_at: Optional[datetime] = None
|
||||
|
||||
|
||||
class CoordWorkItemResponse(BaseModel):
|
||||
"""Output schema for a work item."""
|
||||
|
||||
id: UUID
|
||||
workflow_id: str
|
||||
project_key: str
|
||||
title: str
|
||||
description: Optional[str]
|
||||
status: str
|
||||
priority: int
|
||||
assigned_session: Optional[str]
|
||||
depends_on_id: Optional[str]
|
||||
started_at: Optional[datetime]
|
||||
completed_at: Optional[datetime]
|
||||
created_at: datetime
|
||||
updated_at: datetime
|
||||
|
||||
model_config = {"from_attributes": True}
|
||||
Reference in New Issue
Block a user