Files
microdao-daarion/services/matrix-presence-aggregator/app/models.py
Apple 6bd769ef40 feat(city-map): Add 2D City Map with coordinates and agent presence
- Add migration 013_city_map_coordinates.sql with map coordinates, zones, and agents table
- Add /city/map API endpoint in city-service
- Add /city/agents and /city/agents/online endpoints
- Extend presence aggregator to include agents[] in snapshot
- Add AgentsSource for fetching agent data from DB
- Create CityMap component with interactive room tiles
- Add useCityMap hook for fetching map data
- Update useGlobalPresence to include agents
- Add map/list view toggle on /city page
- Add agent badges to room cards and map tiles
2025-11-27 07:00:47 -08:00

39 lines
985 B
Python

"""Data models for Presence Aggregator"""
from pydantic import BaseModel
from typing import List, Optional
from datetime import datetime
class AgentPresence(BaseModel):
"""Agent presence in a room"""
agent_id: str
display_name: str
kind: str = "assistant" # assistant, civic, oracle, builder
status: str = "offline" # online, offline, busy
room_id: Optional[str] = None
color: Optional[str] = None
class RoomPresence(BaseModel):
room_id: str # internal room id from DB
matrix_room_id: str # Matrix room ID (!xxx:domain)
online: int
typing: int
agents: List[AgentPresence] = [] # Agents present in this room
class CityPresence(BaseModel):
online_total: int
rooms_online: int
agents_online: int = 0
class PresenceSnapshot(BaseModel):
type: str = "presence_update"
timestamp: datetime
city: CityPresence
rooms: List[RoomPresence]
agents: List[AgentPresence] = [] # All online agents