Enhanced terminal presenter with statistics hooks and optional fixed header.
Purpose
-------
Subclass of :class:`RichPresenter` that adds a thread-safe
:class:`StatisticsTracker` for turn / session / context-usage counters
and (when the terminal is interactive) installs a fixed-position
ANSI-coloured header at the top of the scroll region. Selected via
``--ui enhanced``.
Responsibilities
----------------
- :class:`EnhancedPresenter` — Rich-styled presenter with stats hooks.
- ``_install_fixed_header`` / ``_redraw_fixed_header`` — manage the
fixed top region and re-render after each turn or context change.
- Pass-through hooks for agent / sub-loop tracking that delegate to
:class:`StatisticsTracker`.
Diagnostics
-----------
Domain: OC_UI.TERMINAL
Levels:
L2 — lifecycle events (init, close)
L3 — per-turn / context-usage updates
L4 — deep tracing (per-redraw decisions)
Contracts
---------
- All rendering still goes through the parent :class:`RichPresenter`;
no presenter API surface is added or removed.
- The fixed header is opt-in: skipped when ``stdout`` is not a TTY or
when ``OC_CHAT_ENHANCED_FIXED_HEADER`` is falsy.
- ``close()`` always restores the terminal's full scroll region.
Dependencies
------------
- oc_diagnostics (structured debug logging via _dbg)
- oc_ui.terminal.stats (StatisticsTracker)
- oc_ui.terminal.rich_presenter (RichPresenter base class)
- oc_chat.core.config (lazy; get_max_context_tokens for the context gauge window size)
- oc_chat.core.formatting (lazy; format_duration for the fixed header turn and session durations)
- oc_chat.core.session (lazy; ChatSession type hint for bind_session and show_welcome)