views

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatTaskAge added in v0.7.0

func FormatTaskAge(created time.Time) string

FormatTaskAge formats a task's age from its creation time. Returns "\u2014" (em dash) if the time is zero.

Types

type AgentsView

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

AgentsView renders the main agents table with columns.

func NewAgentsView

func NewAgentsView() *AgentsView

NewAgentsView creates a new AgentsView.

func (*AgentsView) Cursor

func (v *AgentsView) Cursor() int

Cursor returns the current cursor position.

func (*AgentsView) Selected

func (v *AgentsView) Selected() *agent.Agent

Selected returns the currently selected agent, or nil. If the cursor is on a child row, the parent session agent is returned.

func (*AgentsView) SetAgents

func (v *AgentsView) SetAgents(agents []agent.Agent)

SetAgents updates the list of agents with stable sort order. Preserves cursor position by tracking the selected PID across refreshes.

func (*AgentsView) SetFilter

func (v *AgentsView) SetFilter(f string)

SetFilter sets a filter string for agents.

func (*AgentsView) SetSize

func (v *AgentsView) SetSize(w, h int)

SetSize sets the available width and height.

func (*AgentsView) SortField

func (v *AgentsView) SortField() string

SortField returns the current sort field name.

func (*AgentsView) Update

func (v *AgentsView) Update(msg tea.Msg)

Update handles key messages for navigation.

func (*AgentsView) View

func (v *AgentsView) View() string

View renders the agents table with headers and status icons.

type AnnotationMsg

type AnnotationMsg struct {
	Turn  int
	Label string // "" means remove
	Note  string // free-text rationale (set via 'n' key)
}

AnnotationMsg is emitted when the user annotates a turn. app.go handles persistence; this view only tracks the label in memory.

type CostsView

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

CostsView renders a cost dashboard aggregated by project.

func NewCostsView

func NewCostsView() *CostsView

NewCostsView creates a new CostsView.

func (*CostsView) SetAgents

func (v *CostsView) SetAgents(agents []agent.Agent)

SetAgents updates the agents used for cost aggregation.

func (*CostsView) SetSize

func (v *CostsView) SetSize(w, h int)

SetSize sets the available width and height.

func (*CostsView) View

func (v *CostsView) View() string

View renders the costs table.

type HeaderView

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

HeaderView renders a header with info boxes and ASCII logo.

func NewHeaderView

func NewHeaderView() *HeaderView

NewHeaderView creates a new HeaderView.

func (*HeaderView) Height

func (h *HeaderView) Height() int

Height returns the rendered height of the header (for layout calculations). Must match the actual number of newlines in View() output.

func (*HeaderView) SetAgents

func (h *HeaderView) SetAgents(agents []agent.Agent)

SetAgents updates the agent list used for stats.

func (*HeaderView) SetCrumbs

func (h *HeaderView) SetCrumbs(crumbs []string)

SetCrumbs updates the breadcrumb trail.

func (*HeaderView) SetHint

func (h *HeaderView) SetHint(hint string)

SetHint sets the contextual key hint bar text.

func (*HeaderView) SetK8sStatus added in v0.7.0

func (h *HeaderView) SetK8sStatus(status string)

SetK8sStatus updates the K8s connection status displayed in the header.

func (*HeaderView) SetTaskSummary added in v0.7.0

func (h *HeaderView) SetTaskSummary(pending, active, completed, failed int)

SetTaskSummary updates the task counts displayed in the header.

func (*HeaderView) SetWidth

func (h *HeaderView) SetWidth(w int)

SetWidth sets the available width.

func (*HeaderView) View

func (h *HeaderView) View() string

View renders the header.

type HealthView added in v0.7.0

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

HealthView renders the :health system status dashboard.

func NewHealthView added in v0.7.0

func NewHealthView() *HealthView

NewHealthView creates a new health view.

func (*HealthView) SetHealth added in v0.7.0

func (v *HealthView) SetHealth(h provider.SystemHealth)

SetHealth updates the health data to display.

func (*HealthView) SetSize added in v0.7.0

func (v *HealthView) SetSize(w, h int)

SetSize sets the view dimensions.

func (*HealthView) View added in v0.7.0

func (v *HealthView) View() string

View renders the health dashboard.

type HelpView

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

HelpView renders the help overlay.

func NewHelpView

func NewHelpView() *HelpView

NewHelpView creates a new HelpView.

func (*HelpView) SetSize

func (v *HelpView) SetSize(w, h int)

SetSize sets the available width and height.

func (*HelpView) View

func (v *HelpView) View() string

View renders the help screen.

type InfraHealth added in v0.7.0

type InfraHealth struct {
	Configured bool
	CoordOK    bool // coordination layer (Redis, SQS, etc.)
	CoordErr   string
	ComputeOK  bool // compute layer (K8s API, EC2 API, etc.)
	ComputeErr string
	Workloads  []string // discovered workloads
}

InfraHealth mirrors the provider HealthStatus for display. Generic fields map to any backend (K8s, EC2, SSH, etc.).

type LaunchCancelMsg

type LaunchCancelMsg struct{}

LaunchCancelMsg is emitted when the user cancels the launcher.

type LaunchMsg

type LaunchMsg struct {
	Provider    string
	Dir         string
	Model       string
	Mode        string
	Runtime     string
	OTELEnabled bool // true if OTEL tracing should be injected
}

LaunchMsg is emitted when the user confirms the launch configuration.

type LaunchResumeMsg added in v0.5.0

type LaunchResumeMsg struct {
	SessionID string
	Dir       string
	FilePath  string
}

LaunchResumeMsg is emitted when the user picks a session to resume from the launcher.

type LauncherView

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

LauncherView renders the agent launcher overlay.

func NewLauncherView

func NewLauncherView(recentDirs []RecentDirEntry, providerOpts map[string]ProviderOptions, otelAvailable bool) *LauncherView

NewLauncherView creates a new launcher overlay. providerOpts maps provider names to their available models and modes. otelAvailable is true if the OTEL receiver is running (shows toggle in options).

func (*LauncherView) SetSize

func (l *LauncherView) SetSize(w, h int)

SetSize sets the available dimensions for the overlay.

func (*LauncherView) SkipToDirectory added in v0.7.0

func (l *LauncherView) SkipToDirectory(providerName string)

SkipToDirectory pre-selects a provider and jumps directly to the directory step, skipping the provider selection screen. Used by the :new picker flow.

func (*LauncherView) Update

func (l *LauncherView) Update(msg tea.Msg) tea.Cmd

Update handles key messages and returns a tea.Cmd if the launcher emits a LaunchMsg or LaunchCancelMsg.

func (*LauncherView) View

func (l *LauncherView) View() string

View renders the launcher overlay as a full-screen replacement.

type LogsView

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

LogsView renders a structured conversation trace grouped by turns. Each turn shows INPUT (user), ACTIONS (tools), and OUTPUT (assistant) sections inspired by MLflow/Braintrust trace UIs.

func NewLogsView

func NewLogsView(pid int, filePath string, parser TraceParser) *LogsView

NewLogsView creates a new LogsView for the given PID and log file path. The parser function is called during Reload() to parse the session file into structured trace turns. If parser is nil, Reload returns no turns.

func (*LogsView) Annotations

func (v *LogsView) Annotations() map[int]string

Annotations returns the current annotations map.

func (*LogsView) FilePath

func (v *LogsView) FilePath() string

FilePath returns the current file path for the trace data source.

func (*LogsView) HasActiveFilter

func (v *LogsView) HasActiveFilter() bool

HasActiveFilter returns true if the logs view has a filter, note input, or filter mode active.

func (*LogsView) NoteInput

func (v *LogsView) NoteInput() (string, int)

NoteInput returns the current note input text and turn number.

func (*LogsView) NoteMode

func (v *LogsView) NoteMode() bool

NoteMode returns true if the user is currently typing a note.

func (*LogsView) Notes

func (v *LogsView) Notes() map[int]string

Notes returns the current notes map for export.

func (*LogsView) Reload

func (v *LogsView) Reload()

Reload reads and parses the session file into turns using the provider's parser. Preserves the cursor position unless new turns were added while the cursor was at the bottom (auto-follow mode).

func (*LogsView) SetAnnotations

func (v *LogsView) SetAnnotations(a map[int]string)

SetAnnotations loads a set of turn annotations from external storage.

func (*LogsView) SetFilePath

func (v *LogsView) SetFilePath(path string)

SetFilePath updates the file path for the trace data source. Used when the session file isn't available at creation time but is discovered later (e.g., newly launched agents).

func (*LogsView) SetNotes

func (v *LogsView) SetNotes(n map[int]string)

SetNotes loads notes from external storage.

func (*LogsView) SetSessionCost added in v0.2.0

func (v *LogsView) SetSessionCost(cost float64)

SetSessionCost sets the session-level cost for the trace summary.

func (*LogsView) SetSize

func (v *LogsView) SetSize(w, h int)

SetSize sets the available width and height.

func (*LogsView) SetWarning

func (v *LogsView) SetWarning(msg string)

SetWarning sets a provider-specific warning shown above the trace turns.

func (*LogsView) Turns

func (v *LogsView) Turns() []TraceTurn

Turns returns the parsed trace turns for export.

func (*LogsView) Update

func (v *LogsView) Update(msg tea.Msg) tea.Cmd

Update handles key messages for turn navigation. Returns a tea.Cmd when an annotation change needs to propagate to app.go for persistence.

func (*LogsView) View

func (v *LogsView) View() string

View renders the trace view with structured turns.

type NewPickerCancelMsg added in v0.7.0

type NewPickerCancelMsg struct{}

NewPickerCancelMsg is emitted when the user closes the picker.

type NewPickerConfig added in v0.7.0

type NewPickerConfig struct {
	K8sEnabled bool
	Providers  []ProviderSupport
	Health     *InfraHealth     // nil when infra provider is not configured
	RecentDirs []RecentDirEntry // recent directories for session launcher
}

NewPickerConfig holds the parameters needed to create a NewPickerView.

type NewPickerView added in v0.7.0

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

NewPickerView renders the :new picker overlay.

func NewNewPickerView added in v0.7.0

func NewNewPickerView(cfg NewPickerConfig) *NewPickerView

NewNewPickerView creates a new :new picker overlay.

func (*NewPickerView) Init added in v0.7.0

func (v *NewPickerView) Init() tea.Cmd

Init satisfies the tea.Model interface (no-op).

func (*NewPickerView) Level added in v0.7.0

func (v *NewPickerView) Level() npLevel

Level returns the current picker level (for testing).

func (*NewPickerView) SetSize added in v0.7.0

func (v *NewPickerView) SetSize(w, h int)

SetSize sets the available dimensions for the overlay.

func (*NewPickerView) SetStatus added in v0.7.0

func (v *NewPickerView) SetStatus(msg string)

SetStatus sets a status/error message displayed in the picker.

func (*NewPickerView) StatusMsg added in v0.7.0

func (v *NewPickerView) StatusMsg() string

StatusMsg returns the current status message (for testing).

func (*NewPickerView) Update added in v0.7.0

func (v *NewPickerView) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update handles key messages and returns a tea.Cmd if the picker emits a result message or cancellation.

func (*NewPickerView) View added in v0.7.0

func (v *NewPickerView) View() string

View renders the picker overlay.

type NewSessionMsg added in v0.7.0

type NewSessionMsg struct {
	Where    string // "local", "hybrid", "remote"
	Provider string // "claude", "codex", "gemini"
	Dir      string
}

NewSessionMsg is emitted when the user confirms a new session launch.

type NewTaskMsg added in v0.7.0

type NewTaskMsg struct {
	Where    string // "local", "remote"
	Provider string // "claude", "gemini"
	Prompt   string
}

NewTaskMsg is emitted when the user confirms a new task launch.

type PTYExitMsg

type PTYExitMsg struct{}

PTYExitMsg signals that the PTY subprocess has exited.

type PTYOutputMsg

type PTYOutputMsg struct {
	Data []byte
}

PTYOutputMsg carries raw output data from the PTY subprocess.

type PreviewPane

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

PreviewPane renders a read-only conversation preview for the right side of a split pane layout. It shows the conversation trace of the currently selected agent, parsed from its session JSONL file.

func NewPreviewPane

func NewPreviewPane() *PreviewPane

NewPreviewPane creates a new preview pane.

func (*PreviewPane) Reload

func (p *PreviewPane) Reload()

Reload re-reads the session file and refreshes the conversation trace.

func (*PreviewPane) SetAgent

func (p *PreviewPane) SetAgent(a *agent.Agent)

SetAgent updates the agent whose conversation is displayed. It reloads the conversation from the agent's SessionFile only if the agent changed. If the agent is nil or has no SessionFile, the pane shows a placeholder.

func (*PreviewPane) SetParser

func (p *PreviewPane) SetParser(parser TraceParser)

SetParser updates the trace parser used for creating LogsViews. Called by app.go when the selected agent changes and the provider's ParseTrace method should be used.

func (*PreviewPane) SetSize

func (p *PreviewPane) SetSize(w, h int)

SetSize sets the available width and height for the preview pane.

func (*PreviewPane) View

func (p *PreviewPane) View() string

View renders the preview pane with a left border, header, and conversation.

type ProviderOptions

type ProviderOptions struct {
	Models []string
	Modes  []string
}

ProviderOptions holds the models and modes for a specific provider.

type ProviderSupport added in v0.7.0

type ProviderSupport struct {
	Name          string
	LocalSession  bool // always true for all providers
	LocalK8s      bool // true for claude only (needs MCP)
	RemoteSession bool // true for claude only (session pod exists)
	RemoteTask    bool // true for claude, gemini (worker images exist)
}

ProviderSupport describes which modes a provider supports.

func DefaultProviderSupport added in v0.7.0

func DefaultProviderSupport() []ProviderSupport

DefaultProviderSupport returns the default support matrix.

type RecentDirEntry

type RecentDirEntry struct {
	Path     string
	Display  string // shortened display name
	Provider string
	Age      string // "2m ago", "1h ago"
}

RecentDirEntry is a directory entry for the recent dirs list.

type SessionAnnotateMsg added in v0.5.0

type SessionAnnotateMsg struct {
	Session    history.Session
	Annotation string
}

SessionAnnotateMsg is emitted when the user changes a session annotation.

type SessionBulkDeleteMsg added in v0.6.0

type SessionBulkDeleteMsg struct {
	Sessions []history.Session
}

SessionBulkDeleteMsg is emitted when the user confirms bulk deletion.

type SessionDeleteMsg added in v0.5.0

type SessionDeleteMsg struct {
	Session history.Session
}

SessionDeleteMsg is emitted when the user confirms deleting a session.

type SessionNoteMsg added in v0.5.0

type SessionNoteMsg struct {
	Session history.Session
	Note    string
}

SessionNoteMsg is emitted when the user updates the note on a session.

type SessionResumeMsg added in v0.5.0

type SessionResumeMsg struct {
	SessionID  string
	WorkingDir string
	FilePath   string // path to the session JSONL (for trace pane)
}

SessionResumeMsg is emitted when the user wants to resume a session.

type SessionTagMsg added in v0.5.0

type SessionTagMsg struct {
	Session history.Session
	Tags    []string
}

SessionTagMsg is emitted when the user updates tags on a session.

type SessionToggleScopeMsg added in v0.5.0

type SessionToggleScopeMsg struct {
	ShowAll bool
}

SessionToggleScopeMsg is emitted when the user toggles between current directory and all projects.

type SessionView

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

SessionView provides a full-screen interactive terminal view. It wraps a session backend (direct PTY or tmux mirror) and a VT terminal emulator to render output within the Bubble Tea TUI. The user interacts with the subprocess directly; keystrokes are forwarded to the backend.

func NewSessionView

func NewSessionView() *SessionView

NewSessionView creates a new SessionView in an inactive state.

func (*SessionView) Active

func (sv *SessionView) Active() bool

Active returns true if the session view is currently running.

func (*SessionView) Agent

func (sv *SessionView) Agent() *agent.Agent

Agent returns the agent associated with this session, or nil.

func (*SessionView) Close

func (sv *SessionView) Close()

Close terminates the PTY session and marks the view as inactive.

func (*SessionView) HandleOutput

func (sv *SessionView) HandleOutput(data []byte) tea.Cmd

HandleOutput feeds raw data into the VT emulator (for direct PTY backends) and returns a tea.Cmd to continue reading. For DirectRenderer backends (tmux), the data is ignored since Render() provides the content directly.

func (*SessionView) Open

func (sv *SessionView) Open(a *agent.Agent, backend terminal.SessionBackend) (tea.Cmd, error)

Open starts an interactive session using the given backend (direct PTY or tmux mirror). It starts a background goroutine to read output and returns a tea.Cmd that delivers the first PTYOutputMsg.

func (*SessionView) SendKey

func (sv *SessionView) SendKey(key string)

SendKey forwards a keystroke to the PTY subprocess, translating Bubble Tea key names to their actual terminal byte sequences.

func (*SessionView) SetSize

func (sv *SessionView) SetSize(w, h int)

SetSize resizes the PTY and VT emulator to fit the new dimensions.

func (*SessionView) TermView added in v0.6.0

func (sv *SessionView) TermView() *terminal.TermView

TermView returns the underlying terminal view, or nil for DirectRenderer backends.

func (*SessionView) View

func (sv *SessionView) View() string

View renders the session view with a header bar, terminal content, and a status bar at the bottom.

type SessionsView added in v0.5.0

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

SessionsView renders a browsable list of past sessions with trace preview.

func NewSessionsView added in v0.5.0

func NewSessionsView() *SessionsView

NewSessionsView creates a new sessions browser.

func (*SessionsView) CurrentDir added in v0.5.0

func (v *SessionsView) CurrentDir() string

CurrentDir returns the scoped directory.

func (*SessionsView) HasActiveFilter added in v0.5.0

func (v *SessionsView) HasActiveFilter() bool

HasActiveFilter returns true if a search filter is currently applied.

func (*SessionsView) HasActiveInput added in v0.5.0

func (v *SessionsView) HasActiveInput() bool

HasActiveInput returns true if the view has active text input or confirmation.

func (*SessionsView) SelectedSession added in v0.5.0

func (v *SessionsView) SelectedSession() *history.Session

SelectedSession returns the currently selected session, if any. Returns a pointer into the original sessions slice so mutations persist.

func (*SessionsView) SetCurrentDir added in v0.5.0

func (v *SessionsView) SetCurrentDir(dir string)

SetCurrentDir sets the scoped directory for display.

func (*SessionsView) SetSessions added in v0.5.0

func (v *SessionsView) SetSessions(sessions []history.Session)

SetSessions updates the session list.

func (*SessionsView) SetSize added in v0.5.0

func (v *SessionsView) SetSize(w, h int)

SetSize sets the available width and height.

func (*SessionsView) SetTagVocab added in v0.5.0

func (v *SessionsView) SetTagVocab(vocab []string)

SetTagVocab sets the autocomplete vocabulary for tag input.

func (*SessionsView) SetTraceParser added in v0.5.0

func (v *SessionsView) SetTraceParser(parser TraceParser)

SetTraceParser sets the parser used for trace preview.

func (*SessionsView) ShowAll added in v0.5.0

func (v *SessionsView) ShowAll() bool

ShowAll returns whether the view is showing all projects.

func (*SessionsView) Update added in v0.5.0

func (v *SessionsView) Update(msg tea.Msg) tea.Cmd

Update handles key messages for session navigation.

func (*SessionsView) View added in v0.5.0

func (v *SessionsView) View() string

View renders the sessions browser.

type SortField added in v0.6.0

type SortField int

SortField identifies which column to sort by.

const (
	SortByAge         SortField = iota // default: most recent first
	SortByCost                         // highest cost first
	SortByTurns                        // most turns first
	SortByTitle                        // alphabetical by title/prompt
	SortByFailureMode                  // tagged sessions first
)

type TasksView added in v0.7.0

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

TasksView renders a table of tasks from both K8s and local sources.

func NewTasksView added in v0.7.0

func NewTasksView() *TasksView

NewTasksView creates a new empty TasksView.

func (*TasksView) HandleKey added in v0.7.0

func (v *TasksView) HandleKey(key string) bool

HandleKey processes navigation keys. Returns true if the key was handled.

func (*TasksView) Selected added in v0.7.0

func (v *TasksView) Selected() *task.Task

Selected returns the currently highlighted task, or nil if empty.

func (*TasksView) SetSize added in v0.7.0

func (v *TasksView) SetSize(w, h int)

SetSize sets the available width and height for rendering.

func (*TasksView) SetTasks added in v0.7.0

func (v *TasksView) SetTasks(tasks []task.Task)

SetTasks updates the task list and sorts by priority: active (in_progress, claimed) first, then pending, then completed, then failed/dead.

func (*TasksView) View added in v0.7.0

func (v *TasksView) View() string

View renders the full tasks table with summary line, header, and rows.

type TeamsView

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

TeamsView renders the teams overview.

func NewTeamsView

func NewTeamsView() *TeamsView

NewTeamsView creates a new TeamsView.

func (*TeamsView) SetSize

func (v *TeamsView) SetSize(w, h int)

SetSize sets the available width and height.

func (*TeamsView) SetTeams

func (v *TeamsView) SetTeams(teams []team.TeamConfig)

SetTeams updates the list of teams.

func (*TeamsView) View

func (v *TeamsView) View() string

View renders the teams display.

type ToolSpan

type ToolSpan = trace.ToolSpan

ToolSpan is an alias for trace.ToolSpan, kept for backward compatibility within the views package.

type TraceParser

type TraceParser func(filePath string) ([]trace.Turn, error)

TraceParser is a function that reads a file and returns parsed trace turns. Each provider supplies its own parser via Provider.ParseTrace.

type TraceTurn

type TraceTurn = trace.Turn

TraceTurn is an alias for trace.Turn, kept for backward compatibility within the views package. All parsing now happens in the provider layer.

Jump to

Keyboard shortcuts

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