Documentation
¶
Overview ¶
Package tui implements the BubbleTea terminal UI for Cortex.
Following BubbleTea patterns: - Screen constants as iota - Single Model struct holds ALL state - Update() with type switch - Per-screen key handlers returning (tea.Model, tea.Cmd) - Vim keys (j/k) for navigation - PrevScreen for back navigation
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyTheme ¶
func ApplyTheme(dark bool)
ApplyTheme switches between Dark and Light mode and rebuilds styles.
Types ¶
type Deps ¶
type Deps struct {
Observations *sqlitestore.Store
Sessions *session.Store
Search *search.Store
Code codeDomain.Store
Graph *graphstore.Store
Scoring *scoringstore.Store
Entities *entitystore.Store
App *app.App
Config *config.Config
Version string
}
Deps bundles all store dependencies for the TUI.
type Model ¶
type Model struct {
Version string
Screen Screen
PrevScreen Screen
PrevCursor int
Width int
Height int
Cursor int
Scroll int
// Update notification
UpdateResult *update.Result
// Error display
ErrorMsg string
// Dashboard
Stats *combinedStats
// Search
SearchInput textinput.Model
SearchQuery string
SearchResults []*domain.SearchResult
CodeSearchResults []code.Symbol
SearchMode string
SearchHistory []string
SearchHistoryIdx int
// Recent observations
RecentObservations []*domain.Observation
// Observation detail (enriched with Cortex data)
SelectedObservation *domain.Observation
DetailScore *domain.ImportanceScore
DetailEntities []*domain.EntityLink
DetailEdges []*domain.Edge
DetailViewport viewport.Model
DetailLoading bool
// Timeline
TimelineFocus *domain.Observation
TimelineBefore []*domain.Observation
TimelineAfter []*domain.Observation
// Sessions
Sessions []*session.SessionStats
SelectedSessionIdx int
SessionObservations []*domain.Observation
SessionDetailScroll int
// Graph (Cortex-exclusive)
GraphObservations []*domain.Observation
GraphEdges []*domain.Edge
GraphRootID int64
// List filtering
FilterProject string // active project filter ("" = all)
FilterActive bool // whether filter is shown
// Vim multi-key sequences
PendingKey string // for multi-key sequences like "gg"
// Archive (Cortex-exclusive)
ArchivedObservations []*domain.Observation
// Health (Cortex-exclusive)
HealthStale []*domain.Observation
HealthOrphans []*domain.Observation
HealthEdgeCount int
HealthObsCount int
HealthCandidates []healthCandidate
HealthSection int // 0=stale, 1=orphans, 2=candidates
HealthExpanded bool
// Setup
SetupAgents []setup.Agent
SetupResult *setup.Result
SetupInstalling bool
SetupInstallingName string
SetupDone bool
SetupError string
SetupAllowlistPrompt bool
SetupAllowlistApplied bool
SetupAllowlistError string
SetupSpinner spinner.Model
// Embedding config
EmbCfgDirty bool
EmbCfgProvider int // 0=none, 1=ollama, 2=openai
EmbCfgModel textinput.Model // model name input
EmbCfgVector bool // vector search toggle
EmbCfgAutoStart bool // auto-start Ollama toggle
EmbCfgFocusField int // focused field (0=provider, 1=model, 2=vector, 3=autostart, 4=save)
EmbCfgSaving bool
EmbCfgSaved bool
EmbCfgError string
EmbCfgOllamaRunning bool
EmbCfgOllamaHasModel bool
EmbCfgOllamaChecked bool // true after status check completes
EmbCfgPulling bool
EmbCfgStarting bool
EmbCfgSpinner spinner.Model
// Embedding config — provider/model change detection
EmbCfgOriginalProvider int
EmbCfgOriginalModel string
EmbCfgReindexWarning bool
EmbCfgReindexing bool
EmbCfgReindexProgress string
ReindexProgressBar progress.Model
ReindexTotal int
ReindexDone int
// Local-first configuration. Values are staged until Save is selected.
LocalCfgDatabasePath textinput.Model
LocalCfgFormat int // 0=YAML, 1=JSON, 2=TOML
LocalCfgLLMProvider int // 0=none, 1=ollama, 2=openai, 3=anthropic, 4=openrouter, 5=groq, 6=deepseek, 7=custom
LocalCfgLLMModel textinput.Model
LocalCfgLLMBaseURL textinput.Model
LocalCfgHTTPEnabled bool
LocalCfgHTTPHost textinput.Model
LocalCfgHTTPPort textinput.Model
LocalCfgMCPRemote bool
LocalCfgMCPURL textinput.Model
LocalCfgMCPTokenEnv textinput.Model
LocalCfgSyncEnabled bool
LocalCfgSyncURL textinput.Model
LocalCfgSyncTokenEnv textinput.Model
LocalCfgSyncInterval textinput.Model
LocalCfgFocusField int
LocalCfgDirty bool
LocalCfgSaving bool
LocalCfgSaved bool
LocalCfgError string
LocalCfgSpinner spinner.Model
// Activity sparkline (7-day observation counts)
ActivityData []int
// Split pane preview
PreviewVisible bool
PreviewViewport viewport.Model
FocusedPane int // 0=main, 1=preview
// Toast messages
ToastMessage string
ToastType string // "success", "warning", "error"
// Delete confirmation
ConfirmDelete bool
ConfirmDeleteID int64
DeleteTargetTitle string
// Command palette
CmdPaletteOpen bool
CmdPaletteInput textinput.Model
CmdPaletteCursor int
// Quick memory modal
NewObsModalOpen bool
NewObsTitleInput textinput.Model
NewObsContentInput textinput.Model
NewObsTypeInput textinput.Model
NewObsProjectInput textinput.Model
NewObsFocusField int
// Theme
IsDarkTheme bool
// Auth & Identity
AuthToken string
CurrentUser string
UserRole string // "admin", "owner", "member", "viewer", "local"
AuthModalOpen bool
AuthTokenInput textinput.Model
AuthServerURLInput textinput.Model
AuthFocusField int // 0 = Server URL, 1 = Bearer Token, 2 = Mode Selector
AuthModeHybrid bool // true = Hybrid (Local-First + Sync), false = Remote MCP Proxy
// Project & Upload Policy
UploadToCortex bool // whether current project uploads to Cortex server
// Stats display
StatsMode int // 0 = User personal stats, 1 = Admin global tenant stats
// List components (bubbles/list)
SearchListModel list.Model
RecentList list.Model
SessionListModel list.Model
GraphListModel list.Model
ArchiveList list.Model
// contains filtered or unexported fields
}
Model holds the TUI state.
type ThemePalette ¶
type ThemePalette struct {
BaseBg lipgloss.Color
PanelBg lipgloss.Color
Overlay lipgloss.Color
Text lipgloss.Color
Subtext lipgloss.Color
Cyan lipgloss.Color
Blue lipgloss.Color
Purple lipgloss.Color
Green lipgloss.Color
Amber lipgloss.Color
Red lipgloss.Color
Mauve lipgloss.Color
Teal lipgloss.Color
Gold lipgloss.Color
HighlightBg lipgloss.Color
HighlightTxt lipgloss.Color
}
Click to show internal directories.
Click to hide internal directories.