tui

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package tui implements the KonaReef terminal interface.

Index

Constants

This section is empty.

Variables

View Source
var (
	ColorUltramarine = lipgloss.Color("#0A1F3D")
	ColorCerulean    = lipgloss.Color("#4EA5D9")
	ColorLobsterRed  = lipgloss.Color("#E63946")
	ColorTurquoise   = lipgloss.Color("#40E0D0")
	ColorInk         = lipgloss.Color("#E6F1FF")
	ColorMuted       = lipgloss.Color("#6B7C93")
	ColorGreen       = lipgloss.Color("#2ECC71")
	ColorRed         = lipgloss.Color("#E74C3C")
)

KonaReef dark-mode palette — matches the konareef.ai hero illustration.

View Source
var (
	TitleStyle = lipgloss.NewStyle().
				Foreground(ColorCerulean).
				Bold(true).
				MarginBottom(1)

	SubtitleStyle = lipgloss.NewStyle().
					Foreground(ColorMuted).
					Italic(true).
					MarginBottom(1)

	CursorStyle = lipgloss.NewStyle().
				Foreground(ColorLobsterRed).
				Bold(true)

	RunningNameStyle = lipgloss.NewStyle().
						Foreground(ColorInk)

	StoppedNameStyle = lipgloss.NewStyle().
						Foreground(ColorMuted).
						Faint(true)

	RunningDotStyle = lipgloss.NewStyle().
					Foreground(ColorTurquoise)

	StoppedDotStyle = lipgloss.NewStyle().
					Foreground(ColorMuted)

	HelpStyle = lipgloss.NewStyle().
				Foreground(ColorMuted).
				Italic(true).
				MarginTop(1)

	BoxStyle = lipgloss.NewStyle().
				Border(lipgloss.RoundedBorder()).
				BorderForeground(ColorCerulean).
				Background(ColorUltramarine).
				Padding(1, 3)

	// Tab bar styles.
	ActiveTabStyle = lipgloss.NewStyle().
					Foreground(ColorCerulean).
					Bold(true).
					Underline(true)

	InactiveTabStyle = lipgloss.NewStyle().
						Foreground(ColorMuted)

	// Status bar styles.
	StatusBarStyle = lipgloss.NewStyle().
					Foreground(ColorMuted).
					MarginTop(1)

	ConnectedStyle = lipgloss.NewStyle().
					Foreground(ColorGreen)

	DisconnectedStyle = lipgloss.NewStyle().
						Foreground(ColorRed)

	// Error and flash styles.
	ErrorStyle = lipgloss.NewStyle().
				Foreground(ColorRed)

	FlashStyle = lipgloss.NewStyle().
				Foreground(ColorTurquoise)
)

Functions

func RunVerify

func RunVerify(src string, strict bool, disclosurePolicy string) error

RunVerify computes the verify outcome for src and runs the standalone verify TUI. strict applies the v1 --strict attestation requirement; disclosurePolicy ("", "C", or "D") applies the --disclosure-policy assertion before rendering (fail-closed on mismatch). It is the entry point wired into `konareef verify --tui`.

RunVerify preserves the headless verify exit contract: it returns a non-nil error (so `runVerify` exits 1) when the FINAL model state — the outcome as last re-verified by the user — has a load error or any divergence. A TUI runtime error takes precedence over the verdict.

Types

type AgentsModel

type AgentsModel struct {
	// contains filtered or unexported fields
}

AgentsModel displays the agent list with navigation and spawn/kill actions.

func NewAgentsModel

func NewAgentsModel(client *api.Client) AgentsModel

NewAgentsModel creates an AgentsModel wired to the given API client.

func (AgentsModel) Init

func (m AgentsModel) Init() tea.Cmd

Init fires the first fetch.

func (AgentsModel) IsCapturingInput

func (m AgentsModel) IsCapturingInput() bool

IsCapturingInput returns true when the model is showing an inline text prompt (spawn task input, etc.) and Enter should NOT be intercepted by the parent App for tab navigation.

func (AgentsModel) KeyHints

func (m AgentsModel) KeyHints() string

KeyHints returns contextual help for the status bar.

func (AgentsModel) SelectedAgent

func (m AgentsModel) SelectedAgent() (api.Agent, bool)

SelectedAgent returns the agent under the cursor, if any.

func (*AgentsModel) SetSize

func (m *AgentsModel) SetSize(w, h int)

SetSize stores terminal dimensions for layout.

func (AgentsModel) Update

func (m AgentsModel) Update(msg tea.Msg) (AgentsModel, tea.Cmd)

Update handles messages for the agents view.

func (AgentsModel) View

func (m AgentsModel) View() string

View renders the agent list.

type App

type App struct {
	// contains filtered or unexported fields
}

App is the root Bubble Tea model that owns sub-models and tab switching.

func NewApp

func NewApp(client *api.Client, wsClient *ws.Client) App

NewApp creates the root model wired to the given reef-core client and an optional WebSocket client (may be nil if no session token is available).

func (App) Init

func (a App) Init() tea.Cmd

Init starts the default tab's polling.

func (App) Update

func (a App) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update handles global keys, then delegates to the active sub-model.

func (App) View

func (a App) View() string

View renders the tab bar, active view, and status bar inside the styled box.

type BudgetModel

type BudgetModel struct {
	// contains filtered or unexported fields
}

BudgetModel displays the pod-wide budget summary.

func NewBudgetModel

func NewBudgetModel(client *api.Client) BudgetModel

NewBudgetModel creates a BudgetModel wired to the given API client.

func (*BudgetModel) ApplyCost

func (m *BudgetModel) ApplyCost(agentID string, sats int64)

ApplyCost applies a pod-wide cost delta from the PodEventsChannel agent_cost event. It mutates the currently-cached budget optimistically so the Budget tab updates between REST polls; the next budgetFetchedMsg reconciles any drift with the server snapshot.

If no budget has been fetched yet (m.budget == nil) the delta is dropped — the subsequent fetch will include the already-recorded spend.

func (BudgetModel) Init

func (m BudgetModel) Init() tea.Cmd

Init fires the first budget fetch.

func (BudgetModel) KeyHints

func (m BudgetModel) KeyHints() string

KeyHints returns contextual help for the status bar.

func (*BudgetModel) SetSize

func (m *BudgetModel) SetSize(w, h int)

SetSize stores terminal dimensions for layout.

func (BudgetModel) Update

func (m BudgetModel) Update(msg tea.Msg) (BudgetModel, tea.Cmd)

Update handles budget messages.

func (BudgetModel) View

func (m BudgetModel) View() string

View renders the budget summary.

type InspectorModel

type InspectorModel struct {
	// contains filtered or unexported fields
}

InspectorModel shows detail for a single agent with live output + actions.

func NewInspectorModel

func NewInspectorModel(client *api.Client) InspectorModel

NewInspectorModel creates an empty inspector. Call SetAgent to load one.

func (*InspectorModel) AppendComplete

func (m *InspectorModel) AppendComplete(result string)

AppendComplete adds a completion event to the live log.

func (*InspectorModel) AppendCost

func (m *InspectorModel) AppendCost(sats int64)

AppendCost adds a cost event to the live log.

func (*InspectorModel) AppendError

func (m *InspectorModel) AppendError(message string)

AppendError adds an error event to the live log.

func (*InspectorModel) AppendStream

func (m *InspectorModel) AppendStream(data string)

AppendStream adds streaming text to the live log. Streaming chunks are appended to the last line (no newline per chunk).

func (*InspectorModel) AppendToolCall

func (m *InspectorModel) AppendToolCall(tool string)

AppendToolCall adds a tool call event to the live log.

func (InspectorModel) HasAgent

func (m InspectorModel) HasAgent() bool

HasAgent returns true if an agent is loaded.

func (InspectorModel) Init

func (m InspectorModel) Init() tea.Cmd

Init returns nil — SetAgent triggers the initial fetch.

func (InspectorModel) KeyHints

func (m InspectorModel) KeyHints() string

KeyHints returns contextual help for the status bar.

func (*InspectorModel) SetAgent

func (m *InspectorModel) SetAgent(id string) tea.Cmd

SetAgent switches the inspector to a new agent and triggers a fetch.

func (*InspectorModel) SetSize

func (m *InspectorModel) SetSize(w, h int)

SetSize stores terminal dimensions.

func (InspectorModel) Update

func (m InspectorModel) Update(msg tea.Msg) (InspectorModel, tea.Cmd)

Update handles inspector messages.

func (InspectorModel) View

func (m InspectorModel) View() string

View renders the agent detail + output log.

type StatusBar

type StatusBar struct {
	// contains filtered or unexported fields
}

StatusBar renders connection state, active tab, and contextual key hints.

func NewStatusBar

func NewStatusBar() StatusBar

NewStatusBar creates a StatusBar with default state.

func (*StatusBar) ClearFlash

func (s *StatusBar) ClearFlash()

ClearFlash removes the flash message.

func (*StatusBar) SetConnected

func (s *StatusBar) SetConnected(ok bool)

SetConnected updates the REST connection indicator.

func (*StatusBar) SetFlash

func (s *StatusBar) SetFlash(text string) tea.Cmd

SetFlash sets a temporary message and returns a command to clear it.

func (*StatusBar) SetSize

func (s *StatusBar) SetSize(width int)

SetSize stores the terminal width for layout.

func (*StatusBar) SetWsConnected

func (s *StatusBar) SetWsConnected(ok bool)

SetWsConnected updates the WebSocket connection indicator.

func (StatusBar) View

func (s StatusBar) View(tabLabel string, hints string) string

View renders the status bar as a single line.

type VerifyModel

type VerifyModel struct {
	// contains filtered or unexported fields
}

VerifyModel is the standalone verify screen.

func (VerifyModel) Init

func (m VerifyModel) Init() tea.Cmd

Init implements tea.Model. No async work on start — the outcome is computed before the program runs.

func (VerifyModel) Update

func (m VerifyModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update handles window sizing, quit, scroll, and re-verify.

func (VerifyModel) View

func (m VerifyModel) View() string

View renders the verify screen with a scroll window and a key-hint footer.

Jump to

Keyboard shortcuts

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