docs: sync all markdown with current architecture

Remove session management concepts (no create_session/close_session/
DELETE /sessions — Master handles container lifecycle automatically).
Update PlatformClient contract, ChatContext, project structure tree,
and FSM diagrams across all docs to match the implemented core/.

- README.md: fix core/ structure tree + PlatformClient snippet
- docs/surface-protocol.md: remove session.py/_template.py, fix
  ChatContext (drop session_id), fix PlatformClient contract, fix
  "free features" list
- docs/telegram-prototype.md: remove "создаёт сессию на платформе"
- docs/matrix-prototype.md: same + remove !sessions, fix FSM
  (SessionCreated → ChatCreated), fix status block
- docs/user-flow.md: rewrite sequence diagram to POST /users/{id}/
  chats/{id}/messages; update FSM states
This commit is contained in:
Mikhail Putilovskij 2026-03-29 00:55:24 +03:00
parent 36730ae716
commit 4f5c5679d5
5 changed files with 52 additions and 53 deletions

View file

@ -29,10 +29,12 @@
surfaces-bot/
core/ — общее ядро, не зависит от транспорта
protocol.py — унифицированные структуры (IncomingMessage, OutgoingUI, ...)
handler.py — логика: IncomingEvent → OutgoingEvent
session.py — управление сессиями и чатами
auth.py — аутентификация
settings.py — коннекторы, скиллы, SOUL, безопасность
handler.py — EventDispatcher: IncomingEvent → OutgoingEvent
handlers/ — обработчики по типам событий
store.py — StateStore Protocol + InMemoryStore + SQLiteStore
chat.py — ChatManager: метаданные чатов C1/C2/C3
auth.py — AuthManager: аутентификация
settings.py — SettingsManager: коннекторы, скиллы, SOUL, безопасность
adapter/
telegram/ — aiogram 3.x адаптер
@ -75,14 +77,15 @@ surfaces-bot/
```python
class PlatformClient(Protocol):
async def get_or_create_user(...) -> User: ...
async def create_session(...) -> Session: ...
async def send_message(...) -> AgentResponse: ...
async def close_session(...) -> None: ...
async def get_settings(...) -> UserSettings: ...
async def update_settings(...) -> None: ...
async def get_or_create_user(self, external_id: str, platform: str, ...) -> User: ...
async def send_message(self, user_id: str, chat_id: str, text: str, ...) -> MessageResponse: ...
async def get_settings(self, user_id: str) -> UserSettings: ...
async def update_settings(self, user_id: str, action: Any) -> None: ...
```
Бот не управляет lifecycle контейнеров — это делает Master (платформа).
Бот передаёт `user_id` + `chat_id` + сообщение; платформа сама решает нужно ли поднять контейнер.
Сейчас: `MockPlatformClient` в `platform/mock.py`.
Когда SDK готов: добавляем `SdkPlatformClient`, меняем одну строку в DI. Адаптеры и ядро не трогаем.