feat(ui): chat-bubbles layout, fix eval bar visibility, no terminals

UI rewrite per user feedback:
- Remove agent terminal panels entirely (tmux runs headlessly).
- Left column: chat with colored bubbles per move (white→light, black→
  dark, click to jump to ply, label shows agent+side+SAN).
- Right column: SAN move history (lichess style, click to jump).
- Center: board, untouched, but now constrained so it stops overflowing.
- Eval bar between chat and board, vertical with cp/mate text; the
  earlier visual issue was pure CSS (no explicit height) — bar fills
  full column height now.
- Keyboard nav: ←/→/space.
- Bottom log strip kept (compact).

Backend: TmuxTailer no longer started in lifespan (UI doesn't need
term_chunk events). Stockfish + eval_bridge now log explicit errors
to backend.log on startup failure.
This commit is contained in:
ai-chess
2026-05-14 23:51:24 +03:00
parent 4c5b306a9a
commit 6f4525d59f
4 changed files with 299 additions and 179 deletions
+24 -15
View File
@@ -33,31 +33,40 @@ def build_app(state: state_mod.AppState) -> FastAPI:
eng = StockfishEngine()
state.runtime = {"session": session, "coord": coord, "tailer": tailer, "engine": eng} # type: ignore[attr-defined]
eng_ok = False
try:
await eng.start()
except Exception:
pass
eng_ok = True
print("[lifespan] stockfish started", flush=True)
except Exception as e:
print(f"[lifespan] stockfish.start failed: {e}", flush=True)
try:
await coord.start()
except Exception:
pass
try:
if await session.exists():
tailer.start()
except Exception:
pass
print("[lifespan] coordinator started", flush=True)
except Exception as e:
print(f"[lifespan] coordinator.start failed: {e}", flush=True)
# TmuxTailer is intentionally NOT started — the browser UI no longer
# mirrors the agent panes, so the polling would be wasted work and
# also flood every subscriber queue with large term_chunk events.
async def eval_bridge():
q = state.events.subscribe()
try:
while True:
ev = await q.get()
if ev.get("type") == "move" and ev.get("fen"):
try:
res = await eng.analyze(ev["fen"], depth=state.settings.stockfish_depth)
await state.events.publish({"type": "eval", **res, "fen": ev["fen"]})
except Exception:
pass
if ev.get("type") != "move" or not ev.get("fen"):
continue
if not eng_ok:
continue
try:
res = await eng.analyze(
ev["fen"], depth=state.settings.stockfish_depth,
)
await state.events.publish(
{"type": "eval", **res, "fen": ev["fen"]},
)
except Exception as e:
print(f"[eval_bridge] analyze failed: {e}", flush=True)
finally:
state.events.unsubscribe(q)
bridge_task = asyncio.create_task(eval_bridge())