- Surface Protocol: unified IncomingMessage/OutgoingUI/ChatContext - Telegram: Forum Topics (group + topics per chat) - Matrix: Space + rooms per chat - MockPlatformClient with PlatformClient Protocol - docs: surface-protocol, telegram/matrix specs, api-contract, claude-code-guide - project scaffold: src/, tests/, pyproject.toml Co-Authored-By: Claude Sonnet 4-6 <noreply@anthropic.com>
68 lines
2.1 KiB
Markdown
68 lines
2.1 KiB
Markdown
# User Flow — Lambda Bot
|
||
|
||
> **Статус:** ШАБЛОН — заполняет @architect после исследований
|
||
> **Зависит от:** docs/research/telegram-flows.md, docs/research/competitor-ux.md
|
||
|
||
---
|
||
|
||
## Основной сценарий (happy path)
|
||
|
||
```mermaid
|
||
sequenceDiagram
|
||
actor User
|
||
participant Bot as Telegram/Matrix Bot
|
||
participant Platform as Lambda Platform
|
||
|
||
User->>Bot: /start
|
||
Bot->>Platform: GET /users/{tg_id}?platform=telegram
|
||
Platform-->>Bot: {user_id, is_new}
|
||
|
||
alt Новый пользователь
|
||
Bot->>User: Приветствие + инструкция
|
||
else Существующий пользователь
|
||
Bot->>User: Добро пожаловать обратно
|
||
end
|
||
|
||
User->>Bot: Любое сообщение
|
||
Bot->>Platform: POST /sessions (создаём сессию)
|
||
Platform-->>Bot: {session_id, agent_id}
|
||
|
||
loop Диалог
|
||
User->>Bot: Сообщение
|
||
Bot->>Platform: POST /sessions/{id}/messages
|
||
Platform-->>Bot: {response}
|
||
Bot->>User: Ответ агента
|
||
end
|
||
|
||
User->>Bot: /end или таймаут
|
||
Bot->>Platform: DELETE /sessions/{id}
|
||
Bot->>User: Сессия завершена
|
||
```
|
||
|
||
---
|
||
|
||
## Состояния FSM (Telegram)
|
||
|
||
```mermaid
|
||
stateDiagram-v2
|
||
[*] --> Idle: /start
|
||
|
||
Idle --> InSession: любое сообщение
|
||
InSession --> InSession: сообщение пользователя
|
||
InSession --> Idle: /end
|
||
|
||
InSession --> Error: ошибка платформы
|
||
Error --> Idle: /start
|
||
Error --> InSession: retry
|
||
```
|
||
|
||
---
|
||
|
||
## Открытые вопросы
|
||
|
||
> Заполняет @researcher и @architect после исследований
|
||
|
||
- [ ] Как выглядит онбординг новых пользователей у конкурентов?
|
||
- [ ] Нужна ли кнопка "Новая сессия" или сессия стартует автоматически?
|
||
- [ ] Что показываем пока агент думает (typing indicator)?
|
||
- [ ] Как обрабатываем timeout ответа от платформы?
|