topbar

package
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 30, 2026 License: AGPL-3.0 Imports: 7 Imported by: 0

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

View Source
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

type Model struct {
	Theme theme.Theme
	Tier  theme.Tier
	// contains filtered or unexported fields
}

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

func New(t theme.Theme, tier theme.Tier, info ports.ModelInfo, usage ports.Usage, width int) Model

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

func (m Model) ActivityBounds() (startCol, endCol int, ok bool)

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

func (m Model) ContextPercent() (int, bool)

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

func (m Model) Height() int

Height is the row count View draws: fixed at 1 row to maximize conversation viewport.

func (Model) HitsActivity

func (m Model) HitsActivity(clickCol int) bool

HitsActivity reports whether clickCol falls within the activity badge.

func (Model) HitsModel

func (m Model) HitsModel(clickCol int) bool

HitsModel reports whether clickCol falls within the model capsule.

func (Model) ModelBounds

func (m Model) ModelBounds() (startCol, endCol int, ok bool)

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

func (m *Model) SetActivity(filesCount, agentsCount int)

SetActivity updates the live count of touched files and running/dispatched agents.

func (*Model) SetBreadcrumb

func (m *Model) SetBreadcrumb(segments []string)

SetBreadcrumb records the ordered breadcrumb segments (e.g. [sessionTitle] or [sessionTitle, agentName, taskDesc]).

func (*Model) SetSession

func (m *Model) SetSession(info ports.ModelInfo, usage ports.Usage)

SetSession updates the model and usage values, e.g. after a turn ends and the counts moved.

func (*Model) SetTheme

func (m *Model) SetTheme(t theme.Theme, tier theme.Tier)

SetTheme records a theme change, re-resolving the mark's colours.

func (*Model) SetUsage

func (m *Model) SetUsage(usage ports.Usage)

SetUsage updates the token and cost accounting values incrementally.

func (*Model) SetWidth

func (m *Model) SetWidth(w int)

SetWidth records a resize.

func (Model) Usage

func (m Model) Usage() ports.Usage

Usage returns the current token and cost accounting values.

func (Model) View

func (m Model) View() string

View renders the top bar. The first row states the mark/wordmark on the left, and model/provider/context share on the right. When breadcrumbs are present, a second row renders the trail.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL