ExAthena.Chat.Tui.View (ExAthena v0.12.0)

Copy Markdown View Source

Pure view function for ExAthena.Chat.Tui. Turns a %State{} into the list of {widget, %Rect{}} tuples the ex_ratatui runtime needs.

Layout (top-to-bottom):

  1. Header (1 row) — provider · model · mode · iter=N · in/out tok · $cost.
  2. Body (flex) — split horizontally 50/50 into:
    • Left — messages WidgetList (one {Paragraph, 1} per event row). If state.loading? == true, a Throbber is appended.
    • Right — details WidgetList: full args, full tool results, thinking, tool UI payloads, and every loop event. Wrapped in a titled Block with a left border.
  3. Input (3 rows) — Textarea bound to state.input_ref inside a titled Block.
  4. Footer (1 row) — shortcut hints (changes when a popup is open).

When state.popup != nil, a Popup widget overlays the messages rect with a centered List.

Summary

Functions

Build the per-frame widget list for the given state and frame.

Build the header status string from a session.

Functions

build_frame(state, frame)

Build the per-frame widget list for the given state and frame.

status_line(s)

@spec status_line(ExAthena.Chat.Session.t()) :: String.t()

Build the header status string from a session.