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