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>
40 lines
1.1 KiB
Python
40 lines
1.1 KiB
Python
"""Pydantic schemas for CoordMessage."""
|
|
|
|
from datetime import datetime
|
|
from typing import Optional
|
|
from uuid import UUID
|
|
|
|
from pydantic import BaseModel, Field
|
|
|
|
|
|
class CoordMessageCreate(BaseModel):
|
|
"""Input schema for sending a message."""
|
|
|
|
from_session: str = Field(..., description="Sending session identifier", max_length=200)
|
|
to_session: Optional[str] = Field(None, description="Recipient session; NULL = broadcast", max_length=200)
|
|
project_key: Optional[str] = Field(None, description="Optional project context", max_length=200)
|
|
subject: str = Field(..., description="Message subject", max_length=500)
|
|
body: str = Field(..., description="Message body, markdown ok")
|
|
|
|
|
|
class CoordMessageUpdate(BaseModel):
|
|
"""Input schema for updating a message (mark read, etc.)."""
|
|
|
|
read_at: Optional[datetime] = None
|
|
|
|
|
|
class CoordMessageResponse(BaseModel):
|
|
"""Output schema for a message."""
|
|
|
|
id: UUID
|
|
from_session: str
|
|
to_session: Optional[str]
|
|
project_key: Optional[str]
|
|
subject: str
|
|
body: str
|
|
read_at: Optional[datetime]
|
|
created_at: datetime
|
|
updated_at: datetime
|
|
|
|
model_config = {"from_attributes": True}
|