# API Contracts ## POST /chat Вход: ```json { "project_id": "default", "conversation_id": "optional", "message": "Найди файл и исправь запрос", "attachments": [], "mode": "auto", "preferences": { "local_only": true, "show_plan": true } } ``` Выход: ```json { "conversation_id": "conv_1", "task_id": "task_1", "response_type": "answer | task_started | confirmation_required | error", "message": "string", "cards": [] } ``` ## POST /tasks Создать задачу без chat-интерфейса. ```json { "project_id": "default", "goal": "Исправить модуль", "inputs": {}, "execution_mode": "agent_graph" } ``` ## GET /tasks/{task_id} ```json { "task_id": "task_1", "status": "running", "current_node": "node_3", "progress": { "completed": 2, "total": 5 } } ``` ## GET /tasks/{task_id}/events SSE/WebSocket stream событий: ```json { "event": "node_started", "task_id": "task_1", "node_id": "node_3", "timestamp": "..." } ``` ## POST /confirmations/{id}/approve ```json { "scope": "once | task | project", "comment": "approved" } ``` ## POST /confirmations/{id}/reject ```json { "reason": "not now" } ``` ## POST /workers/register Local worker регистрируется на сервере. ```json { "worker_id": "worker_home_pc", "name": "Home PC", "capabilities": [ "file.read", "file.write", "file.search", "command.run" ], "version": "0.1.0" } ```