Documentation
¶
Overview ¶
Package messages defines all TUI message types organized by domain.
Messages are grouped into domain-specific files:
- session.go: Session lifecycle (new, exit, save, load, etc.)
- theme.go: Theme selection and preview
- agent.go: Agent switching and model selection
- toggle.go: UI state toggles (YOLO, thinking, sidebar)
- input.go: Editor input, attachments, and speech
- mcp.go: MCP prompt interactions
This organization follows the Elm Architecture principle of grouping messages by the domain they affect, making it easier to understand which components handle which messages.
Package messages defines all TUI message types organized by domain.
Package messages defines all TUI message types organized by domain.
Index ¶
- type AgentCommandMsg
- type AttachFileMsg
- type Attachment
- type BellMsg
- type BranchFromEditMsg
- type ChangeModelMsg
- type ChangeThemeMsg
- type ClearQueueMsg
- type CloseTabMsg
- type CompactSessionMsg
- type CopyLastResponseToClipboardMsg
- type CopySessionToClipboardMsg
- type EditUserMessageMsg
- type ElicitationResponseMsg
- type EvalSessionMsg
- type ExitAfterFirstResponseMsg
- type ExitSessionMsg
- type ExportSessionMsg
- type FocusPanel
- type InsertFileRefMsg
- type InvalidateStatusBarMsg
- type LoadSessionMsg
- type MCPPromptMsg
- type NewSessionMsg
- type OpenModelPickerMsg
- type OpenSessionBrowserMsg
- type OpenThemePickerMsg
- type OpenURLMsg
- type RegenerateTitleMsg
- type ReorderTabMsg
- type RequestFocusMsg
- type RoutedMsg
- type SendAttachmentMsg
- type SendMsg
- type SessionToggleChangedMsg
- type SetSessionTitleMsg
- type ShowCostDialogMsg
- type ShowMCPPromptInputMsg
- type ShowPermissionsDialogMsg
- type SpawnSessionMsg
- type SpeakTranscriptMsg
- type StartShellMsg
- type StartSpeakMsg
- type StopSpeakMsg
- type StreamCancelledMsg
- type SwitchAgentMsg
- type SwitchTabMsg
- type TabInfo
- type TabsUpdatedMsg
- type ThemeCancelPreviewMsg
- type ThemeChangedMsg
- type ThemeFileChangedMsg
- type ThemePreviewMsg
- type ToggleHideToolResultsMsg
- type ToggleSessionStarMsg
- type ToggleSidebarMsg
- type ToggleSplitDiffMsg
- type ToggleThinkingMsg
- type ToggleThinkingResultMsg
- type ToggleYoloMsg
- type WheelCoalescedMsg
- type WorkingStateChangedMsg
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AgentCommandMsg ¶
type AgentCommandMsg struct{ Command string }
AgentCommandMsg sends a command to the agent.
type AttachFileMsg ¶
type AttachFileMsg struct{ FilePath string }
AttachFileMsg attaches a file directly or opens file picker if empty/directory.
type Attachment ¶
type Attachment struct {
// Name is the human-readable label (e.g. "paste-1", "main.go").
Name string
// FilePath is the resolved, absolute path to a file on disk.
// Empty when the content is supplied inline (paste attachments).
FilePath string
// Content holds the raw text content. Set for paste attachments whose
// backing temp file is cleaned up before the message reaches the app layer.
// Empty for file-reference attachments that are read from disk.
Content string
}
Attachment represents content attached to a message. It is either a reference to a file on disk (FilePath is set) or inline content already in memory (Content is set, e.g. pasted text). When FilePath is set the consumer reads and classifies the file at send time; when only Content is set the consumer uses it directly as inline text. This design lets us add binary-file support (images, PDFs, …) in the future by extending the struct with a MimeType hint.
type BellMsg ¶
type BellMsg struct{}
BellMsg is sent when the terminal bell should be rung to notify the user. This is used when an inactive tab needs attention (e.g., tool confirmation).
type BranchFromEditMsg ¶
type BranchFromEditMsg struct {
ParentSessionID string
BranchAtPosition int
Content string
Attachments []Attachment
}
BranchFromEditMsg requests branching from a session position with new content.
type ChangeModelMsg ¶
type ChangeModelMsg struct{ ModelRef string }
ChangeModelMsg changes the model for the current agent.
type ChangeThemeMsg ¶
type ChangeThemeMsg struct {
ThemeRef string // Theme reference to apply
}
ChangeThemeMsg applies the specified theme.
type CloseTabMsg ¶
type CloseTabMsg struct {
SessionID string // The session to close
}
CloseTabMsg requests closing a session tab.
type CompactSessionMsg ¶
type CompactSessionMsg struct{ AdditionalPrompt string }
CompactSessionMsg generates a summary and compacts session history.
type CopyLastResponseToClipboardMsg ¶
type CopyLastResponseToClipboardMsg struct{}
CopyLastResponseToClipboardMsg copies the last assistant response to clipboard.
type CopySessionToClipboardMsg ¶
type CopySessionToClipboardMsg struct{}
CopySessionToClipboardMsg copies the entire conversation to clipboard.
type EditUserMessageMsg ¶
type EditUserMessageMsg struct {
MsgIndex int // TUI message index (directly usable, no re-computation needed)
SessionPosition int // Session position for branching
OriginalContent string // Original message content
}
EditUserMessageMsg requests entering edit mode for a user message.
type ElicitationResponseMsg ¶
type ElicitationResponseMsg struct {
Action tools.ElicitationAction
Content map[string]any
}
ElicitationResponseMsg contains response to an elicitation request.
type EvalSessionMsg ¶
type EvalSessionMsg struct{ Filename string }
EvalSessionMsg saves evaluation data to the specified file.
type ExitAfterFirstResponseMsg ¶
type ExitAfterFirstResponseMsg struct{}
ExitAfterFirstResponseMsg exits TUI after first assistant response completes.
type ExitSessionMsg ¶
type ExitSessionMsg struct{}
ExitSessionMsg requests exiting the current session.
type ExportSessionMsg ¶
type ExportSessionMsg struct{ Filename string }
ExportSessionMsg exports the session to the specified file.
type FocusPanel ¶
type FocusPanel int
FocusPanel identifies a focusable panel in the TUI.
const ( PanelEditor FocusPanel = iota // Focus the editor/input panel PanelMessages // Focus the messages/content panel PanelSidebarTitle // Focus content panel for sidebar title editing (no message selection) )
type InsertFileRefMsg ¶
type InsertFileRefMsg struct{ FilePath string }
InsertFileRefMsg inserts @filepath reference into editor.
type InvalidateStatusBarMsg ¶
type InvalidateStatusBarMsg struct{}
InvalidateStatusBarMsg signals that the statusbar cache should be invalidated. This is emitted when bindings change (e.g., entering/exiting inline edit mode).
type LoadSessionMsg ¶
type LoadSessionMsg struct{ SessionID string }
LoadSessionMsg loads a session by ID.
type MCPPromptMsg ¶
MCPPromptMsg executes an MCP prompt with arguments.
type OpenModelPickerMsg ¶
type OpenModelPickerMsg struct{}
OpenModelPickerMsg opens the model picker dialog.
type OpenSessionBrowserMsg ¶
type OpenSessionBrowserMsg struct{}
OpenSessionBrowserMsg opens the session browser dialog.
type OpenThemePickerMsg ¶
type OpenThemePickerMsg struct{}
OpenThemePickerMsg opens the theme picker dialog.
type RegenerateTitleMsg ¶
type RegenerateTitleMsg struct{}
RegenerateTitleMsg regenerates the session title using the AI.
type ReorderTabMsg ¶
ReorderTabMsg requests moving a tab from one position to another.
type RequestFocusMsg ¶
type RequestFocusMsg struct {
Target FocusPanel
// ClickX and ClickY carry the mouse coordinates that triggered the focus
// request so the parent can focus the correct message. A zero value for
// both means "no click context" (e.g. keyboard-driven focus).
ClickX, ClickY int
}
RequestFocusMsg is emitted by the chat page to request the parent to change panel focus. The editor and focus state are managed by the parent (tui.Model), not by the chat page.
type RoutedMsg ¶
type RoutedMsg struct {
SessionID string // The session ID this message is for
Inner tea.Msg // The wrapped message
}
RoutedMsg wraps a message with a session ID for routing. Runtime events are wrapped in this type so the TUI can route them to the correct tab/session.
type SendAttachmentMsg ¶
SendAttachmentMsg is a message for the first message with an attachment.
type SendMsg ¶
type SendMsg struct {
Content string // Full content sent to the agent (with file contents expanded)
Attachments []Attachment // Attached files or inline content (e.g. pastes)
}
SendMsg contains the content sent to the agent.
type SessionToggleChangedMsg ¶
type SessionToggleChangedMsg struct{}
SessionToggleChangedMsg is sent after any session toggle (YOLO, split diff, etc.) changes so that components like the sidebar can invalidate their caches.
type SetSessionTitleMsg ¶
type SetSessionTitleMsg struct{ Title string }
SetSessionTitleMsg sets the session title to specified value.
type ShowCostDialogMsg ¶
type ShowCostDialogMsg struct{}
ShowCostDialogMsg shows the cost/usage dialog.
type ShowMCPPromptInputMsg ¶
type ShowMCPPromptInputMsg struct {
PromptName string
PromptInfo any // mcptools.PromptInfo but avoiding import cycles
}
ShowMCPPromptInputMsg shows input dialog for MCP prompt.
type ShowPermissionsDialogMsg ¶
type ShowPermissionsDialogMsg struct{}
ShowPermissionsDialogMsg shows the permissions dialog.
type SpawnSessionMsg ¶
type SpawnSessionMsg struct {
WorkingDir string // The working directory for the new session
}
SpawnSessionMsg is sent when a new session should be created.
type SpeakTranscriptMsg ¶
type SpeakTranscriptMsg struct{ Delta string }
SpeakTranscriptMsg contains transcription delta from speech-to-text.
type StreamCancelledMsg ¶
type StreamCancelledMsg struct{ ShowMessage bool }
StreamCancelledMsg notifies components that the stream has been cancelled.
type SwitchAgentMsg ¶
type SwitchAgentMsg struct{ AgentName string }
SwitchAgentMsg switches to a different agent.
type SwitchTabMsg ¶
type SwitchTabMsg struct {
SessionID string // The session to switch to
}
SwitchTabMsg requests switching to a different session tab.
type TabInfo ¶
type TabInfo struct {
SessionID string // Unique session identifier
Title string // Display title
IsActive bool // Whether this is the currently active tab
IsRunning bool // Whether the session is currently streaming
NeedsAttention bool // Whether the tab needs user attention (e.g., tool confirmation)
}
TabInfo contains display information for a session tab.
type TabsUpdatedMsg ¶
TabsUpdatedMsg is sent when the tab list has changed.
type ThemeCancelPreviewMsg ¶
type ThemeCancelPreviewMsg struct {
OriginalRef string // Theme reference to restore
}
ThemeCancelPreviewMsg cancels theme preview and restores original.
type ThemeChangedMsg ¶
type ThemeChangedMsg struct{}
ThemeChangedMsg notifies components that the theme has changed (for cache invalidation).
type ThemeFileChangedMsg ¶
type ThemeFileChangedMsg struct {
ThemeRef string // The theme ref that was modified
}
ThemeFileChangedMsg notifies TUI that the theme file was modified on disk (hot reload). The TUI should load and apply the theme on the main goroutine to avoid race conditions.
type ThemePreviewMsg ¶
type ThemePreviewMsg struct {
ThemeRef string // Theme reference to preview
OriginalRef string // Original theme to restore on cancel
}
ThemePreviewMsg previews a theme without committing.
type ToggleHideToolResultsMsg ¶
type ToggleHideToolResultsMsg struct{}
ToggleHideToolResultsMsg toggles hiding of tool results.
type ToggleSessionStarMsg ¶
type ToggleSessionStarMsg struct{ SessionID string }
ToggleSessionStarMsg toggles star on a session; empty ID means current session.
type ToggleSidebarMsg ¶
type ToggleSidebarMsg struct{}
ToggleSidebarMsg toggles sidebar visibility. The top-level model also handles this to persist the collapsed state.
type ToggleSplitDiffMsg ¶
type ToggleSplitDiffMsg struct{}
ToggleSplitDiffMsg toggles split diff view mode.
type ToggleThinkingMsg ¶
type ToggleThinkingMsg struct{}
ToggleThinkingMsg toggles extended thinking mode.
type ToggleThinkingResultMsg ¶
type ToggleThinkingResultMsg struct {
Supported bool
}
ToggleThinkingResultMsg carries the async result of reasoning support check. If Supported is true, thinking is toggled; otherwise a notification is shown.
type ToggleYoloMsg ¶
type ToggleYoloMsg struct{}
ToggleYoloMsg toggles YOLO mode (auto-approve tools).
type WheelCoalescedMsg ¶
WheelCoalescedMsg aggregates mouse wheel deltas to reduce render storms. Delta is positive for wheel down and negative for wheel up.
type WorkingStateChangedMsg ¶
WorkingStateChangedMsg is emitted by the content view when working state changes. tui.Model uses this to update the editor's working indicator and resize handle spinner.