feat(ui/core): срез 6.1 end-to-end — агент показывает смету панелью (show_estimate)

MCP-tool show_estimate пишет _estimate_panel.json → _stream_and_save эмитит событие
estimate + сохраняет role='estimate' (восстановление из истории) + удаляет файл (не в
кнопки, не повторно). Панель рендерит числа из данных (JS не считает). role='estimate'
исключён из контекста LLM (как files). allowedTools + браузер-verified (рендер + restore).
APP_VERSION 2026-07-17n.
This commit is contained in:
anor
2026-07-17 23:27:57 +10:00
parent 8f2bbc551b
commit 9e62e8422a
4 changed files with 55 additions and 1 deletions
+17 -1
View File
@@ -138,7 +138,7 @@ MAX_MESSAGE_LEN = 10_000
# ⚠️ Версия UI — единый источник. БАМПАТЬ ПРИ КАЖДОМ ДЕПЛОЕ (формат: YYYY-MM-DD + буква).
# Фронт берёт её через GET /api/version (chat.html + admin.html, элемент .app-version).
APP_VERSION = "2026-07-17m"
APP_VERSION = "2026-07-17n"
# Audit: path → action name mapping
_AUDIT_MAP = [
@@ -495,6 +495,22 @@ async def _stream_and_save(message: str, user: str, tab_id: str):
return
if full_response:
save_message(user, tab_id, "assistant", full_response)
# Структурированная смета от агента (tool show_estimate пишет _estimate_panel.json) →
# событие estimate + панель. Файл читаем, эмитим, удаляем (не в кнопки, не повторно).
est_file = work_dir / "_estimate_panel.json"
if est_file.exists():
try:
est_data = json.loads(est_file.read_text(encoding="utf-8"))
if isinstance(est_data, dict) and est_data.get("positions"):
save_message(user, tab_id, "estimate", json.dumps(est_data, ensure_ascii=False))
yield f"event: estimate\ndata: {json.dumps(est_data, ensure_ascii=False)}\n\n"
except Exception:
pass
finally:
try:
est_file.unlink()
except OSError:
pass
# Новые/изменённые файлы за время ответа → кнопки скачивания в чате.
# .md включён: агент отдаёт отчёты и в markdown. Служебные *_csv/ —
# директории, отсекаются is_file().