Documentation
¶
Index ¶
- func AllPageMetas() []sidebar.MenuItem
- func SubscribeChannelEvents(bus *eventbus.Bus, sender msgSender)
- type ChannelTracker
- type ContextPanel
- func (p *ContextPanel) Init() tea.Cmd
- func (p *ContextPanel) SetChannelStatuses(statuses []channelStatus)
- func (p *ContextPanel) SetHeight(h int)
- func (p *ContextPanel) SetRuntimeStatus(status runtimeStatus)
- func (p *ContextPanel) SetVisible(v bool)
- func (p *ContextPanel) Start() tea.Cmd
- func (p *ContextPanel) Stop()
- func (p *ContextPanel) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (p *ContextPanel) View() string
- type Deps
- type Model
- func (m *Model) Init() tea.Cmd
- func (m *Model) RegisterPage(id PageID, page Page)
- func (m *Model) SetChannelTracker(tracker *ChannelTracker)
- func (m *Model) SetProgram(p *tea.Program)
- func (m *Model) SetRuntimeTracker(tracker *RuntimeTracker)
- func (m *Model) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (m *Model) View() string
- type Page
- type PageID
- type RuntimeTracker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AllPageMetas ¶
AllPageMetas returns the sidebar menu items for all known pages. The order matches the sidebar display order.
func SubscribeChannelEvents ¶
SubscribeChannelEvents subscribes to channel events on the EventBus and forwards them as tea.Msg to the TUI program.
Types ¶
type ChannelTracker ¶
type ChannelTracker struct {
// contains filtered or unexported fields
}
ChannelTracker aggregates channel status from EventBus events. It is safe for concurrent use.
func NewChannelTracker ¶
func NewChannelTracker(bus *eventbus.Bus) *ChannelTracker
NewChannelTracker creates a tracker and subscribes to channel events. If bus is nil, the tracker still works for manual seeding but receives no events.
func (*ChannelTracker) SeedChannel ¶
func (t *ChannelTracker) SeedChannel(name string, connected bool)
SeedChannel registers a channel's initial connection status. Called after channel Start() to distinguish "connected but no messages yet" from "start failed".
func (*ChannelTracker) Snapshot ¶
func (t *ChannelTracker) Snapshot() []channelStatus
Snapshot returns current channel statuses sorted by name. The returned slice matches the channelStatus type expected by ContextPanel.SetChannelStatuses.
type ContextPanel ¶
type ContextPanel struct {
// contains filtered or unexported fields
}
ContextPanel is a standalone tea.Model that displays live system metrics in a right-side panel. It is NOT a Page — it uses Start()/Stop() lifecycle managed by the cockpit toggle (Ctrl+P).
func NewContextPanel ¶
func NewContextPanel(collector *observability.MetricsCollector) *ContextPanel
NewContextPanel creates a ContextPanel backed by the given collector. If collector is nil, the panel renders placeholder text.
func (*ContextPanel) Init ¶
func (p *ContextPanel) Init() tea.Cmd
Init implements tea.Model. No initial command — ticks start on Start().
func (*ContextPanel) SetChannelStatuses ¶
func (p *ContextPanel) SetChannelStatuses(statuses []channelStatus)
SetChannelStatuses updates the channel status display data.
func (*ContextPanel) SetHeight ¶
func (p *ContextPanel) SetHeight(h int)
SetHeight updates the available render height.
func (*ContextPanel) SetRuntimeStatus ¶
func (p *ContextPanel) SetRuntimeStatus(status runtimeStatus)
SetRuntimeStatus updates the runtime status display data. Rendering is handled by Unit 3A; this setter allows the cockpit to push snapshots from RuntimeTracker.
func (*ContextPanel) SetVisible ¶
func (p *ContextPanel) SetVisible(v bool)
SetVisible controls whether the panel renders content.
func (*ContextPanel) Start ¶
func (p *ContextPanel) Start() tea.Cmd
Start begins the 5-second tick cycle for auto-refresh.
type Deps ¶
type Deps struct {
TurnRunner *turnrunner.Runner
Config *config.Config
SessionKey string
ToolCatalog *toolcatalog.Catalog
MetricsCollector *observability.MetricsCollector
FeatureStatuses *app.StatusCollector
ConfigStore *configstore.Store
ProfileName string
BackgroundManager *background.Manager // optional, nil when unavailable
EventBus *eventbus.Bus // optional, enables channel event subscription
ApprovalHistory *approval.HistoryStore // optional, approval decision history
GrantStore *approval.GrantStore // optional, persistent session grants
}
Deps holds the dependencies for the cockpit TUI. ApprovalProvider is NOT included — type assertion for SetTTYFallback is handled in cmd/lango/main.go's runCockpit().
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
Model is the root cockpit tea.Model.
func (*Model) RegisterPage ¶
RegisterPage adds a page to the cockpit.
func (*Model) SetChannelTracker ¶
func (m *Model) SetChannelTracker(tracker *ChannelTracker)
SetChannelTracker sets the channel tracker for live channel status updates. The tracker's snapshots are pushed to the context panel on each tick.
func (*Model) SetProgram ¶
SetProgram delegates to the wrapped child.
func (*Model) SetRuntimeTracker ¶
func (m *Model) SetRuntimeTracker(tracker *RuntimeTracker)
SetRuntimeTracker sets the runtime tracker for live metrics. The tracker aggregates token usage, delegation counts, and recovery events.
type Page ¶
type Page interface {
tea.Model
// Title returns the page display name for the sidebar.
Title() string
// ShortHelp returns context-sensitive keybindings for the help bar.
ShortHelp() []key.Binding
// Activate is called when the page becomes active.
// Returns a tea.Cmd to execute (e.g., start a tick timer).
Activate() tea.Cmd
// Deactivate is called when the page loses focus.
// Used to stop timers or release resources.
Deactivate()
}
Page is the interface for cockpit pages (non-chat). ChatModel uses the separate childModel interface.
type PageID ¶
type PageID int
PageID identifies a cockpit page.
func PageIDFromString ¶
PageIDFromString converts a sidebar item ID to a PageID. Returns PageChat for unknown IDs.
type RuntimeTracker ¶
type RuntimeTracker struct {
// contains filtered or unexported fields
}
RuntimeTracker aggregates runtime events from the EventBus for TUI display. It tracks per-turn token usage, delegation counts, and forwards recovery decisions as tea.Msg to the TUI program. It is safe for concurrent use.
func NewRuntimeTracker ¶
func NewRuntimeTracker(bus *eventbus.Bus, sender msgSender, localSessionKey string) *RuntimeTracker
NewRuntimeTracker creates a tracker and subscribes to runtime events. If bus is nil, the tracker still works for manual operations but receives no events.
func (*RuntimeTracker) FlushTurnTokens ¶
func (t *RuntimeTracker) FlushTurnTokens() tokenSnapshot
FlushTurnTokens returns the accumulated token snapshot and resets the counters to zero. Intended to be called once per turn completion.
func (*RuntimeTracker) RecordDelegation ¶
func (t *RuntimeTracker) RecordDelegation(to string)
RecordDelegation records an outward agent-to-agent delegation (not returns).
func (*RuntimeTracker) ResetTurn ¶
func (t *RuntimeTracker) ResetTurn()
ResetTurn clears delegation count, active agent, and turn-active flag. Token counters are NOT cleared here — use FlushTurnTokens for that.
func (*RuntimeTracker) SetActiveAgent ¶
func (t *RuntimeTracker) SetActiveAgent(name string)
SetActiveAgent updates the active agent label without incrementing the delegation counter. Used for orchestrator return hops.
func (*RuntimeTracker) Snapshot ¶
func (t *RuntimeTracker) Snapshot() runtimeStatus
Snapshot returns the current runtime status for the context panel.
func (*RuntimeTracker) StartTurn ¶
func (t *RuntimeTracker) StartTurn()
StartTurn marks the beginning of a local turn. Must be called before the turn starts so that token events are accumulated and the context panel shows the Runtime section.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package pages implements the individual pages for the Lango Cockpit TUI.
|
Package pages implements the individual pages for the Lango Cockpit TUI. |
|
Package theme provides the color palette, icons, and logo for the Lango Cockpit TUI.
|
Package theme provides the color palette, icons, and logo for the Lango Cockpit TUI. |