pages

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

Package pages implements the individual pages for the Lango Cockpit TUI.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApprovalsPage

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

ApprovalsPage displays approval history and active grants.

func NewApprovalsPage

func NewApprovalsPage(history *approval.HistoryStore, grants *approval.GrantStore) *ApprovalsPage

NewApprovalsPage creates a new ApprovalsPage. Both stores may be nil.

func (*ApprovalsPage) Activate

func (m *ApprovalsPage) Activate() tea.Cmd

Activate starts periodic data refresh.

func (*ApprovalsPage) Deactivate

func (m *ApprovalsPage) Deactivate()

Deactivate stops the tick loop.

func (*ApprovalsPage) Init

func (m *ApprovalsPage) Init() tea.Cmd

Init satisfies tea.Model.

func (*ApprovalsPage) ShortHelp

func (m *ApprovalsPage) ShortHelp() []key.Binding

ShortHelp returns context-sensitive key bindings for the help bar.

func (*ApprovalsPage) Title

func (m *ApprovalsPage) Title() string

Title returns the page tab label.

func (*ApprovalsPage) Update

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

Update handles messages.

func (*ApprovalsPage) View

func (m *ApprovalsPage) View() string

View renders the approvals page with history and grants sections.

type SessionsPage

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

SessionsPage displays sessions from Store.ListSessions() with cursor navigation. Each entry shows the session key and relative time since last update.

func NewSessionsPage

func NewSessionsPage(
	listFn func(ctx context.Context) ([]session.SessionSummary, error),
) *SessionsPage

NewSessionsPage creates a SessionsPage. listFn is called on Activate to populate the session list.

func (*SessionsPage) Activate

func (p *SessionsPage) Activate() tea.Cmd

Activate is called when the page becomes active. It fires an async command to load sessions.

func (*SessionsPage) Deactivate

func (p *SessionsPage) Deactivate()

Deactivate is called when the page loses focus.

func (*SessionsPage) Init

func (p *SessionsPage) Init() tea.Cmd

Init satisfies tea.Model. No initial command is needed.

func (*SessionsPage) ShortHelp

func (p *SessionsPage) ShortHelp() []key.Binding

ShortHelp returns context-sensitive keybindings for the help bar.

func (*SessionsPage) Title

func (p *SessionsPage) Title() string

Title returns the page tab label.

func (*SessionsPage) Update

func (p *SessionsPage) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update handles messages.

func (*SessionsPage) View

func (p *SessionsPage) View() string

View renders the session list.

type SettingsPage

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

SettingsPage embeds a settings.Editor in the cockpit. Save operations use the OnSave callback instead of quitting.

func NewSettingsPage

func NewSettingsPage(
	cfg *config.Config,
	store *configstore.Store,
	profileName string,
) *SettingsPage

NewSettingsPage creates a SettingsPage with an embedded Editor. The save callback persists to ConfigStore without exiting the TUI.

func (*SettingsPage) Activate

func (m *SettingsPage) Activate() tea.Cmd

Activate is a no-op — the editor is always ready.

func (*SettingsPage) Deactivate

func (m *SettingsPage) Deactivate()

Deactivate is a no-op.

func (*SettingsPage) Init

func (m *SettingsPage) Init() tea.Cmd

Init satisfies tea.Model.

func (*SettingsPage) ShortHelp

func (m *SettingsPage) ShortHelp() []key.Binding

ShortHelp returns key bindings for the help bar.

func (*SettingsPage) Title

func (m *SettingsPage) Title() string

Title returns the page tab label.

func (*SettingsPage) Update

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

Update delegates all messages to the embedded Editor.

func (*SettingsPage) View

func (m *SettingsPage) View() string

View delegates rendering to the embedded Editor.

type StatusPage

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

StatusPage displays feature status and system metrics.

func NewStatusPage

func NewStatusPage(
	statusProvider func() []types.FeatureStatus,
	collector *observability.MetricsCollector,
	cfg *config.Config,
) *StatusPage

NewStatusPage creates a new StatusPage.

statusProvider is called periodically to fetch current feature statuses, avoiding a direct import of internal/app.

func (*StatusPage) Activate

func (m *StatusPage) Activate() tea.Cmd

Activate starts periodic metric collection.

func (*StatusPage) Deactivate

func (m *StatusPage) Deactivate()

Deactivate stops the tick loop.

func (*StatusPage) Init

func (m *StatusPage) Init() tea.Cmd

Init satisfies tea.Model but does nothing; ticks start on Activate.

func (*StatusPage) ShortHelp

func (m *StatusPage) ShortHelp() []key.Binding

ShortHelp returns key bindings for the help bar (none — read-only page).

func (*StatusPage) Title

func (m *StatusPage) Title() string

Title returns the page tab label.

func (*StatusPage) Update

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

Update handles messages.

func (*StatusPage) View

func (m *StatusPage) View() string

View renders the status dashboard.

type TaskActioner

type TaskActioner interface {
	CancelTask(id string) error
	RetryTask(ctx context.Context, id string) error
}

TaskActioner provides cancel and retry operations for background tasks.

type TaskInfo

type TaskInfo struct {
	ID            string
	Prompt        string
	Status        string
	Elapsed       time.Duration
	Result        string // completion result text
	Error         string // error message if failed
	OriginChannel string // originating channel (e.g. "telegram", "slack")
	TokensUsed    int    // token count for this task
}

TaskInfo holds summary info about a background task for display.

type TaskLister

type TaskLister interface {
	ListTasks() []TaskInfo
}

TaskLister provides the list of background tasks.

type TasksPage

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

TasksPage displays background tasks in a table view.

func NewTasksPage

func NewTasksPage(lister TaskLister, actioner TaskActioner) *TasksPage

NewTasksPage creates a new TasksPage. lister and actioner may be nil.

func (*TasksPage) Activate

func (m *TasksPage) Activate() tea.Cmd

Activate starts periodic task list refresh.

func (*TasksPage) Deactivate

func (m *TasksPage) Deactivate()

Deactivate stops the tick loop.

func (*TasksPage) Init

func (m *TasksPage) Init() tea.Cmd

Init satisfies tea.Model.

func (*TasksPage) ShortHelp

func (m *TasksPage) ShortHelp() []key.Binding

ShortHelp returns key bindings for the help bar.

func (*TasksPage) Title

func (m *TasksPage) Title() string

Title returns the page tab label.

func (*TasksPage) Update

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

Update handles messages.

func (*TasksPage) View

func (m *TasksPage) View() string

View renders the tasks table.

type ToolsPage

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

ToolsPage is a read-only catalog browser that lists tool categories on the left and tool details for the selected category on the right.

func NewToolsPage

func NewToolsPage(catalog *toolcatalog.Catalog) *ToolsPage

NewToolsPage creates a ToolsPage backed by the given catalog.

func (*ToolsPage) Activate

func (p *ToolsPage) Activate() tea.Cmd

Activate implements cockpit.Page.

func (*ToolsPage) Deactivate

func (p *ToolsPage) Deactivate()

Deactivate implements cockpit.Page.

func (*ToolsPage) Init

func (p *ToolsPage) Init() tea.Cmd

Init implements tea.Model.

func (*ToolsPage) ShortHelp

func (p *ToolsPage) ShortHelp() []key.Binding

ShortHelp implements cockpit.Page.

func (*ToolsPage) Title

func (p *ToolsPage) Title() string

Title implements cockpit.Page.

func (*ToolsPage) Update

func (p *ToolsPage) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update implements tea.Model.

func (*ToolsPage) View

func (p *ToolsPage) View() string

View implements tea.Model.

Jump to

Keyboard shortcuts

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