// Package tui is a full-screen terminal front end built on Bubble Tea.
//
// It observes the same agent.Event stream the plain renderer does and answers
// the same approval.Prompt signature, so the dependency direction is unchanged:
// tui imports agent, never the reverse, and the eval runner still drives the
// loop with no terminal attached.
package tui
import "github.com/charmbracelet/lipgloss"
// The palette is a role, not a colour. Every value below is assigned by
// applyTheme in theme.go from the palette in force, so a style here can be
// read anywhere in the package without knowing which theme is on.
//
// The roles stay what they always were: one accent carries the identity and
// everything else is a grey at some distance from the text colour. Every
// colour is adaptive, because a palette tuned only for a dark terminal is the
// usual way a hand-rolled TUI becomes unreadable on a light one.
var (
colCoral lipgloss.AdaptiveColor // the accent, whatever hue the theme gives it
colText lipgloss.AdaptiveColor
colUser lipgloss.AdaptiveColor
colDim lipgloss.AdaptiveColor
colFaint lipgloss.AdaptiveColor
colOK lipgloss.AdaptiveColor
colErr lipgloss.AdaptiveColor
colWarn lipgloss.AdaptiveColor
colBlue lipgloss.AdaptiveColor
colPillBg lipgloss.AdaptiveColor
)
var (
styText lipgloss.Style
styDim lipgloss.Style
styFaint lipgloss.Style
styCoral lipgloss.Style
styBold lipgloss.Style
styErr lipgloss.Style
styWarn lipgloss.Style
styOK lipgloss.Style
// The transcript's grammar: every turn of events opens with a dot, and
// anything hanging off it is indented under that dot.
styUserMark lipgloss.Style
styUserText lipgloss.Style
styToolDot lipgloss.Style
styTextDot lipgloss.Style
styErrDot lipgloss.Style
styToolName lipgloss.Style
styToolArgs lipgloss.Style
styResult lipgloss.Style
// The local-command modes: one colour each, carried by both the prompt
// marker and the transcript entry so a run is recognisably the same thing
// in both places.
styLocalShell lipgloss.Style
styLocalPython lipgloss.Style
styDiffAdd lipgloss.Style
styDiffDel lipgloss.Style
styDiffHunk lipgloss.Style
styDiffHead lipgloss.Style
styName lipgloss.Style
styPill lipgloss.Style
styKey lipgloss.Style
styHeading lipgloss.Style
// The input frame is the only always-present chrome, so it carries the
// mode: the accent when it is yours to type into, faint while the agent
// has it.
styBoxFocus lipgloss.Style
styBoxBlur lipgloss.Style
// The agents pane hangs off the right-hand edge, divided from the
// transcript by a rule rather than boxed in: a full border beside a
// transcript reads as a second window.
styBar lipgloss.Style
// The approval box is the one place the UI is allowed to shout: it is the
// only moment a human has to decide something.
styModal lipgloss.Style
)