tui: handle terminal lifecycle events + status-bar count (Etap 4)
terminal_opened/output/closed WS events used to fall through to ChatModel's
unknown-event path (raw dict dumped into chat). Now they feed a dedicated
terminals state and a status-bar count, with no chat bubble:

- ChatModel: terminals dict (name → {description, pid, background, status,
  output_tail, closed}) updated by terminal_opened/output/closed in
  handle_ws_event (return None — no chat item). open_terminal_count property;
  seed_terminals(summaries) populates from a REST list (on attach). output_tail
  capped at 200 lines.
- tui_app.on_ws_event: a terminal-events branch forwards to the model (no _sync
  walk — background output can be frequent) and updates the StatusPanel count.
  attach_session seeds via api.list_terminals and sets the count (graceful 0 on
  failure).
- StatusPanel: the "Ctrl+P palette | /help commands" hint line is replaced with
  a live "Terminals: N" count (set_terminals_count). Key combos still live in
  the bottom StatusBar.
- Tests: mock_tui_api fixtures across 5 client test files gain an async
  fake_list_terminals so attach_session never hits a real network in tests.

Tests: ChatModel opened tracks state (no bubble) / output appends tail / unknown
ignored / closed decrements count / seed from REST; tui_app terminal events
update the status count with no chat bubble. Full suite: 988 passed, 1 skipped.

Plan: docs/terminal_tool_plan.md — Etap 4 of 5.
1 parent dc7da56 commit b8efcd4eaa7534585798c16b7410a6b2b1c3d367
@Eugene Sukhodolskiy Eugene Sukhodolskiy authored on 13 Jul
Showing 8 changed files
View
clients/terminal/tui/chat_model.py
View
clients/terminal/tui/tui_app.py
View
clients/terminal/tui/widgets/status_panel.py
View
tests/clients/test_chat_panel.py
View
tests/clients/test_input_box.py
View
tests/clients/test_sessions_picker.py
View
tests/clients/test_tui_app.py
View
tests/clients/test_tui_export.py