Add Infra Automation Pack v1: docs infrastructure, logging stack, sync scripts

This commit is contained in:
Apple
2025-11-27 09:29:42 -08:00
parent 6bd769ef40
commit 2a6112fc42
22 changed files with 595 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
# City Map Spec (2D MVP)
## Дані
- Таблиця `city_rooms`: `map_x`, `map_y`, `map_w`, `map_h`, `room_type`, `zone`, `color`, `icon`.
- API `GET /city/map``{ config, rooms[] }` з кешем (30 c).
- Presence з aggregator додає `online`, `typing`, `agents`.
## Фронтенд
- Компонент `CityMap` (Next.js) з SVG / CSS grid.
- Тайли кімнат + online indicator + typing.
- Agent badges (до 3, потім `+N`).
- Перемикач "Map / List" на `/city`.
## Подальші кроки
1. **Zone layers:** відображення районів міста.
2. **Events overlay:** показ останніх подій (NATS) на мапі.
3. **3D режим:** pivot до WebGL після стабілізації presence v2.

View File

@@ -0,0 +1,40 @@
# Matrix Presence Aggregator Spec (v2)
## Огляд
Aggregator збирає дані з Matrix Synapse + PostgreSQL (agents) і транслює їх через REST/SSE.
## Потік даних
1. `rooms_source` читає `city_rooms` (`matrix_room_id`, координати).
2. `agents_source` читає `agents` (online/busy/offline, `current_room_id`).
3. `MatrixClient` полить членів кімнат (`/_matrix/client/v3/rooms/.../members`).
4. Presence API (`/_matrix/client/v3/presence/.../status`) → з Heartbeat hook у фронті.
5. Snapshot → `GET /presence/summary`, `GET /presence/stream` (SSE).
## Формат Snapshot
```json
{
"type": "presence_update",
"timestamp": "2025-11-27T15:10:00Z",
"city": {
"online_total": 7,
"rooms_online": 4,
"agents_online": 3
},
"rooms": [
{
"room_id": "room_city_general",
"matrix_room_id": "!abc:daarion.space",
"online": 5,
"typing": 1,
"agents": [ { "agent_id": "ag_atlas", "status": "online" } ]
}
],
"agents": [ ... ]
}
```
## План розвитку
- Presence diffs (щоб зменшити трафік SSE).
- Aggregated analytics (average online per room).
- Події для Agent Presence v2 (агент перемістився).

View File

@@ -0,0 +1,24 @@
# Node Join Protocol (Draft)
## Цілі
- Дозволити новим нодам приєднуватися до мережі DAARION.
- Автоматично налаштовувати агенти, Matrix аккаунти, інфраструктуру.
## Етапи
1. **Registration:** admin додає запис у Node Registry (`pending`).
2. **Bootstrap Script:** node виконує `scripts/bootstrap-node.sh`, який:
- встановлює Docker, git, базові сервіси;
- додає SSH ключ;
- запускає docs-sync.
3. **Validation:** node-agent передає метрики через NATS.
4. **Activation:** статус `active`, нода отримує роль (prod/dev/edge).
## Безпека
- Всі запити підписані (JWT + node secret).
- Node agent працює від окремого користувача `daarion`.
## TODO
- Фіналізувати API Node Registry.
- Додати інтеграцію з DAIS (agent identity vs node identity).
- Автоматизувати видачу TLS/SSL через ACME.