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
This commit is contained in:
Apple
2025-11-27 07:00:47 -08:00
parent 3de3c8cb36
commit 6bd769ef40
258 changed files with 1747 additions and 79 deletions

View File

@@ -1,19 +1,31 @@
"""Data models for Presence Aggregator"""
from pydantic import BaseModel
from typing import List
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):
@@ -21,4 +33,6 @@ class PresenceSnapshot(BaseModel):
timestamp: datetime
city: CityPresence
rooms: List[RoomPresence]
agents: List[AgentPresence] = [] # All online agents