Documentation
¶
Overview ¶
Package topbar is the cockpit's fixed top row: the brand mark and wordmark on the left, the session's model and context usage on the right. It is session identity - it changes at turn boundaries, never per token - so the row is drawn once per update and never reflows anything (it is a fixed reserved row, like the status row).
Index ¶
- Constants
- type Model
- func (m Model) ActivityBounds() (startCol, endCol int, ok bool)
- func (m Model) ContextPercent() (int, bool)
- func (m Model) Height() int
- func (m Model) HitsActivity(clickCol int) bool
- func (m Model) HitsModel(clickCol int) bool
- func (m Model) ModelBounds() (startCol, endCol int, ok bool)
- func (m *Model) SetActivity(filesCount, agentsCount int)
- func (m *Model) SetBreadcrumb(segments []string)
- func (m *Model) SetSession(info ports.ModelInfo, usage ports.Usage)
- func (m *Model) SetTheme(t theme.Theme, tier theme.Tier)
- func (m *Model) SetUsage(usage ports.Usage)
- func (m *Model) SetWidth(w int)
- func (m Model) Usage() ports.Usage
- func (m Model) View() string
Constants ¶
const Wordmark = "mivia"
Wordmark is the product wordmark. Lowercase: the binary is mivia and the product name in AGENTS.md is mivia; the mock's title-case "Mivia" is prose, not the wordmark.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Model ¶
Model is the top bar's state: an idle mark (the animated instance lives in the status line, which owns the turn), the session values ports.Conversation reports, and an optional breadcrumb trail.
func New ¶
New returns a top bar showing the given session values. width is the terminal width; the bar truncates to it on narrow terminals.
func (Model) ActivityBounds ¶
ActivityBounds returns the 0-indexed column range [startCol, endCol) of the activity badge (files/agents) in the top bar within the content width. Returns ok = false if no activity badge is displayed.
func (Model) ContextPercent ¶
ContextPercent is the share of the context window in use, from the cumulative in+out token counts. ok is false when the window size is unknown: dividing by an unstated window would print a made-up number. Exported so the status line (a different component) can show the same share the top bar already computes, rather than re-deriving it from a second copy of ModelInfo/Usage.
func (Model) Height ¶
Height is the row count View draws: fixed at 1 row to maximize conversation viewport.
func (Model) HitsActivity ¶
HitsActivity reports whether clickCol falls within the activity badge.
func (Model) ModelBounds ¶
ModelBounds returns the 0-indexed column range [startCol, endCol) of the model capsule in the first row of the top bar within the content width. Returns ok = false if no model info is displayed.
func (*Model) SetActivity ¶
SetActivity updates the live count of touched files and running/dispatched agents.
func (*Model) SetBreadcrumb ¶
SetBreadcrumb records the ordered breadcrumb segments (e.g. [sessionTitle] or [sessionTitle, agentName, taskDesc]).
func (*Model) SetSession ¶
SetSession updates the model and usage values, e.g. after a turn ends and the counts moved.