ui

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2026 License: Apache-2.0 Imports: 26 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	RenderInterval                 = 100 * time.Millisecond // refresh observed elapsed time
	ChainSyncInterval              = 10 * time.Minute
	ProviderCheckInterval          = 200 * time.Millisecond
	CacheSaveInterval              = 30 * time.Second
	GovernanceSyncInterval         = 5 * time.Minute
	GovernanceProposalSyncInterval = 30 * time.Second
	OracleSyncInterval             = 30 * time.Second
	MaxConcurrentChecks            = 10
	MaxBlockHistory                = 50
)

Variables

This section is empty.

Functions

func DoubleProgressBar

func DoubleProgressBar(prevotePct, precommitPct float64, width int) string

DoubleProgressBar renders two stacked progress bars: top for prevotes (green), bottom for precommits (cyan). This replaces the previous half-block (▀) design with standard bubbles/progress components.

func FormatPercent

func FormatPercent(percent float64) string

FormatPercent formats a percentage with color based on threshold. Delegates to the shared tui/components implementation.

func FormatVoteGrid

func FormatVoteGrid(pattern string, width int) string

FormatVoteGrid formats the bit array pattern into a colored grid

func ProgressBar

func ProgressBar(percent float64, width int) string

ProgressBar renders a progress bar with the given percentage (0-1). Delegates to the shared tui/components implementation.

func ProgressBarWithLabel

func ProgressBarWithLabel(percent float64, width int, label string) string

ProgressBarWithLabel renders a progress bar with a text label centered inside it. Delegates to the shared tui/components implementation.

func RenderView

func RenderView(ctx ViewContext) string

RenderView renders the complete view

Types

type BackMsg

type BackMsg struct{}

BackMsg is sent by an embedded Model (Embedded=true in ModelConfig) when the user requests to leave the monitor view (q or Esc with nothing expanded). The parent TUI handles this by navigating back.

type BlockRecord

type BlockRecord struct {
	Height           int64
	PrevotePercent   float64
	PrecommitPercent float64
	Round            int
	Step             int
	Elapsed          time.Duration        // interval between consecutive committed headers
	Timestamp        time.Time            // committed header time, when available
	Validators       []BlockValidatorVote // vote snapshot per validator
}

BlockRecord stores the final vote state of a completed block.

type BlockValidatorVote

type BlockValidatorVote struct {
	Index       int
	Address     string
	PubKey      string // base64 consensus pubkey for moniker lookup
	VotingPower int64
	Prevoted    bool
	Precommited bool
}

BlockValidatorVote stores a single validator's vote state for a block.

type HubTab

type HubTab int

HubTab represents the active hub dashboard in akt monitor.

const (
	HubNetwork   HubTab = iota // Consensus, validators, governance
	HubProvider                // Provider fleet monitoring
	HubOracleBME               // Oracle prices + BME state
)

type Model

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

Model represents the application state

func NewModel

func NewModel(cfg ModelConfig) Model

NewModel creates a new UI model

func (Model) Init

func (m Model) Init() tea.Cmd

Init initializes the model

func (Model) StatusInfo

func (m Model) StatusInfo() StatusInfo

StatusInfo returns the current status bar information. This allows the parent TUI to render a unified status bar when the monitor model is embedded.

func (Model) Update

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

Update handles messages and updates the model

func (Model) View

func (m Model) View() tea.View

View renders the UI

type ModelConfig

type ModelConfig struct {
	Client             *rpc.Client
	RPCClient          *rpc.RPCProviderClient
	RuntimeContext     context.Context
	RuntimeTasks       *RuntimeTaskGroup
	Cache              cache.ProviderStore
	MonikerCache       *cache.MonikerCache
	InsecureSkipVerify bool
	Embedded           bool       // when true, q sends BackMsg instead of tea.Quit
	InitialDashboard   string     // "network" (default), "provider", "oracle", "bme"
	Bus                pubsub.Bus // shared event bus; may be nil
}

ModelConfig holds configuration options for creating a new Model.

type OracleEvent

type OracleEvent struct {
	Type      string // "price", "stale_warning", "staled", "recovered", "aggregated"
	Denom     string
	Detail    string
	Timestamp time.Time
}

OracleEvent is a display-friendly record for the oracle event log.

type OraclePriceEntry

type OraclePriceEntry struct {
	Denom     string
	Price     string
	Source    string // oracle provider address
	Timestamp time.Time
}

OraclePriceEntry is a single price feed event.

type OracleState

type OracleState struct {
	// Prices stores the most recent EventPriceData per source+denom.
	Prices []OraclePriceEntry

	// Aggregated stores the most recent aggregated prices per denom.
	Aggregated map[string]*oracletypes.EventAggregatedPrice

	// Events is a capped log of recent oracle events (newest first).
	Events []OracleEvent

	ScrollPos int

	// Version is the detected oracle API version ("v1", "v2", or "none").
	// Empty string means not yet determined.
	Version string

	// BME state — populated from REST queries.
	BMEStatus *bmetypes.QueryStatusResponse
	BMELedger []bmetypes.QueryLedgerRecordEntry
}

OracleState holds live oracle and BME data for the Oracle/BME dashboard.

type ProviderDetail

type ProviderDetail struct {
	Showing  bool
	Provider *rpc.Provider
	Nodes    []rpc.ProviderNodeWithGPU
	Loading  bool
	Error    error
}

ProviderDetail holds the state for the provider detail view.

type ProviderDetailState

type ProviderDetailState struct {
	Showing  bool
	Provider *rpc.Provider
	Nodes    []rpc.ProviderNodeWithGPU
	Loading  bool
	Error    error
}

ProviderDetailState holds the state for provider detail view

type ProviderList

type ProviderList struct {
	Items      []rpc.Provider
	Versions   []string // unique versions, sorted latest first
	Version    string   // currently selected version filter
	VersionIdx int      // index in Versions
}

ProviderList holds the state for the provider list view.

type ProviderLoader

type ProviderLoader struct {
	FirstRun      bool
	Loading       bool
	Total         int
	Checked       int
	ActiveLease   map[string]bool // providers with active leases (priority)
	Queue         []string        // providers to check
	InFlight      map[string]bool // providers currently being checked
	LastSync      time.Time
	LastSave      time.Time
	LastSaveError error
}

ProviderLoader holds the state for background provider loading/checking.

type ProviderViewState

type ProviderViewState struct {
	Providers []rpc.Provider
	Versions  []string
	Selected  string
	Loading   bool
	Loaded    int
	Total     int
	Detail    ProviderDetailState
}

ProviderViewState holds the state for the providers tab

type RuntimeTaskGroup added in v0.1.0

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

RuntimeTaskGroup tracks monitor commands that may outlive Bubble Tea's program loop. StopAndWait prevents new work and waits for every command that already crossed the runtime boundary.

func NewRuntimeTaskGroup added in v0.1.0

func NewRuntimeTaskGroup() *RuntimeTaskGroup

NewRuntimeTaskGroup creates an active task group for one monitor runtime.

func (*RuntimeTaskGroup) StopAndWait added in v0.1.0

func (g *RuntimeTaskGroup) StopAndWait()

StopAndWait rejects commands that have not started and drains active ones.

type StatusInfo

type StatusInfo struct {
	Endpoint      string
	WSConnected   bool
	HubTab        HubTab
	ActiveTab     Tab
	DetailShowing bool
}

StatusInfo holds status bar information exposed by the monitor model so the parent TUI can render a unified status bar.

func (StatusInfo) TabHelpText

func (si StatusInfo) TabHelpText() string

TabHelpText returns the keybinding help text for the active hub/tab.

type Tab

type Tab int

Tab represents the active sub-tab within the Network dashboard.

const (
	TabOverview Tab = iota
	TabValidators
	TabGovernance
	TabParameters
)

type ViewContext

type ViewContext struct {
	State                  *consensus.State
	Endpoint               string
	Width                  int
	Height                 int
	HubTab                 HubTab
	ActiveTab              Tab
	Embedded               bool // when true, skip the bottom help/status lines
	Monikers               map[string]string
	Providers              ProviderViewState
	GovernanceProposals    *govv1.QueryProposalsResponse
	GovernanceProposalsErr error
	GovernanceParams       *governance.AllParams
	BlockHistory           []BlockRecord
	ExpandedBlock          int // -1=none, 0=current, 1+=history index
	ExpandedScroll         int
	ExpandedValidators     []BlockValidatorVote // frozen snapshot
	ExpandedValidator      int                  // expanded validator (-1=none)
	ValSignHistory         map[int][]bool       // per-validator signing history
	ProposerHistory        []int                // proposer index per historical block (newest first)
	CurrentProposer        int                  // current block's proposer index (-1=unknown)
	WSConnected            bool
	Oracle                 OracleState

	// Bubbles component models
	ProviderTable   table.Model
	NodeTable       table.Model
	ValidatorTable  table.Model
	BlockTable      table.Model
	GovModuleIdx    int // selected module index
	GovModuleScroll int // first visible module index
	GovModuleHeight int // visible rows for module list
	GovProposalView viewport.Model
	GovParamView    viewport.Model
}

ViewContext holds all data needed to render the view

Jump to

Keyboard shortcuts

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