Documentation
¶
Index ¶
- Constants
- func MouseEventFilter(m tea.Model, msg tea.Msg) tea.Msg
- type Chat
- func (m *Chat) ActivateAskUserQuestion(req agenttools.AskUserRequest) bool
- func (m *Chat) Animate(msg anim.StepMsg) tea.Cmd
- func (m *Chat) AppendMessages(msgs ...chat.MessageItem)
- func (m *Chat) AtBottom() bool
- func (m *Chat) Blur()
- func (m *Chat) ClearMessages()
- func (m *Chat) ClearMouse()
- func (m *Chat) Draw(scr uv.Screen, area uv.Rectangle)
- func (m *Chat) Focus()
- func (m *Chat) Follow() bool
- func (m *Chat) HandleDelayedClick(msg DelayedClickMsg) bool
- func (m *Chat) HandleKeyMsg(key tea.KeyMsg) (bool, tea.Cmd)
- func (m *Chat) HandleMouseDown(x, y int) (bool, tea.Cmd)
- func (m *Chat) HandleMouseDrag(x, y int) bool
- func (m *Chat) HandleMouseUp(x, y int) bool
- func (m *Chat) HasHighlight() bool
- func (m *Chat) Height() int
- func (m *Chat) HighlightContent() string
- func (m *Chat) InsertMessagesAfter(afterID string, msgs ...chat.MessageItem)
- func (m *Chat) InsertMessagesBefore(beforeID string, msgs ...chat.MessageItem)
- func (m *Chat) InvalidateRenderCaches()
- func (m *Chat) Len() int
- func (m *Chat) MessageItem(id string) chat.MessageItem
- func (m *Chat) RemoveMessage(id string)
- func (m *Chat) RestartPausedVisibleAnimations() tea.Cmd
- func (m *Chat) ScrollBy(lines int)
- func (m *Chat) ScrollByAndAnimate(lines int) tea.Cmd
- func (m *Chat) ScrollToBottom()
- func (m *Chat) ScrollToBottomAndAnimate() tea.Cmd
- func (m *Chat) ScrollToIndex(index int)
- func (m *Chat) ScrollToSelected()
- func (m *Chat) ScrollToSelectedAndAnimate() tea.Cmd
- func (m *Chat) ScrollToTop()
- func (m *Chat) ScrollToTopAndAnimate() tea.Cmd
- func (m *Chat) SelectFirst()
- func (m *Chat) SelectFirstInView()
- func (m *Chat) SelectLast()
- func (m *Chat) SelectLastInView()
- func (m *Chat) SelectNext()
- func (m *Chat) SelectPrev()
- func (m *Chat) SelectedItemInView() bool
- func (m *Chat) SetMessages(msgs ...chat.MessageItem)
- func (m *Chat) SetSelected(index int)
- func (m *Chat) SetSize(width, height int)
- func (m *Chat) ToggleExpandedSelectedItem()
- func (m *Chat) UpdateNestedToolIDs(containerID string)
- type DelayedClickMsg
- type KeyMap
- type LSPInfo
- type SessionFile
- type Status
- type UI
Constants ¶
const DefaultStatusTTL = 5 * time.Second
DefaultStatusTTL is the default time-to-live for status messages.
const MouseScrollThreshold = 5
MouseScrollThreshold defines how many lines to scroll the chat when a mouse wheel event occurs.
const TextareaMaxHeight = 6
TextareaMaxHeight is the maximum height of the prompt textarea before scrolling.
const TextareaMinHeight = 1
TextareaMinHeight is the minimum height of the prompt textarea.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Chat ¶
type Chat struct {
// contains filtered or unexported fields
}
Chat represents the chat UI model that handles chat interactions and messages.
func (*Chat) ActivateAskUserQuestion ¶
func (m *Chat) ActivateAskUserQuestion(req agenttools.AskUserRequest) bool
ActivateAskUserQuestion finds the ask_user_question item by tool call ID, activates its interactive question UI, and selects it in the list. Returns true if the item was found and activated.
func (*Chat) Animate ¶
Animate animates items in the chat list. Only propagates animation messages to visible items to save CPU. When items are not visible, their animation ID is tracked so it can be restarted when they become visible again.
func (*Chat) AppendMessages ¶
func (m *Chat) AppendMessages(msgs ...chat.MessageItem)
AppendMessages appends a new message item to the chat list.
func (*Chat) ClearMessages ¶
func (m *Chat) ClearMessages()
ClearMessages removes all messages from the chat list.
func (*Chat) ClearMouse ¶
func (m *Chat) ClearMouse()
ClearMouse clears the current mouse interaction state.
func (*Chat) Draw ¶
Draw renders the chat UI component to the screen and the given area.
The list's rendered output is cached in decoded form (see chatDrawCache) so that frames with byte-identical content skip the ANSI reparse that uv.StyledString.Draw performs on every call. The cache is keyed by the rendered string and the screen's width method; area / scroll changes do not invalidate it.
func (*Chat) Follow ¶
Follow returns whether the chat view is in follow mode (auto-scroll to bottom on new messages).
func (*Chat) HandleDelayedClick ¶
func (m *Chat) HandleDelayedClick(msg DelayedClickMsg) bool
HandleDelayedClick handles a delayed single-click action (like expansion). It only executes if the click ID matches (i.e., no double-click occurred) and no text selection was made (drag to select).
func (*Chat) HandleKeyMsg ¶
HandleKeyMsg handles key events for the chat component.
func (*Chat) HandleMouseDown ¶
HandleMouseDown handles mouse down events for the chat component. It detects single, double, and triple clicks for text selection. Returns whether the click was handled and an optional command for delayed single-click actions.
func (*Chat) HandleMouseDrag ¶
HandleMouseDrag handles mouse drag events for the chat component.
func (*Chat) HandleMouseUp ¶
HandleMouseUp handles mouse up events for the chat component.
func (*Chat) HasHighlight ¶
HasHighlight returns whether there is currently highlighted content.
func (*Chat) HighlightContent ¶
HighlightContent returns the currently highlighted content based on the mouse selection. It returns an empty string if no content is highlighted.
func (*Chat) InsertMessagesAfter ¶
func (m *Chat) InsertMessagesAfter(afterID string, msgs ...chat.MessageItem)
InsertMessagesAfter inserts message items immediately after the item with afterID. If afterID is not found, items are appended at the end. All index map entries from the insertion point onwards are rebuilt.
func (*Chat) InsertMessagesBefore ¶
func (m *Chat) InsertMessagesBefore(beforeID string, msgs ...chat.MessageItem)
InsertMessagesBefore inserts message items immediately before the item with beforeID. If beforeID is not found, items are appended at the end. All index map entries from the insertion point onwards are rebuilt.
func (*Chat) InvalidateRenderCaches ¶
func (m *Chat) InvalidateRenderCaches()
InvalidateRenderCaches drops cached rendered output on every message item so the next draw re-renders with the current styles.
func (*Chat) MessageItem ¶
func (m *Chat) MessageItem(id string) chat.MessageItem
MessageItem returns the message item with the given ID, or nil if not found.
func (*Chat) RemoveMessage ¶
RemoveMessage removes a message from the chat list by its ID.
func (*Chat) RestartPausedVisibleAnimations ¶
RestartPausedVisibleAnimations restarts animations for items that were paused due to being scrolled out of view but are now visible again.
func (*Chat) ScrollByAndAnimate ¶
ScrollByAndAnimate scrolls the chat view by the given number of line deltas and returns a command to restart any paused animations that are now visible.
func (*Chat) ScrollToBottom ¶
func (m *Chat) ScrollToBottom()
ScrollToBottom scrolls the chat view to the bottom.
func (*Chat) ScrollToBottomAndAnimate ¶
ScrollToBottomAndAnimate scrolls the chat view to the bottom and returns a command to restart any paused animations that are now visible.
func (*Chat) ScrollToIndex ¶
ScrollToIndex scrolls the chat view to the item at the given index.
func (*Chat) ScrollToSelected ¶
func (m *Chat) ScrollToSelected()
ScrollToSelected scrolls the chat view to the selected item.
func (*Chat) ScrollToSelectedAndAnimate ¶
ScrollToSelectedAndAnimate scrolls the chat view to the selected item and returns a command to restart any paused animations that are now visible.
func (*Chat) ScrollToTop ¶
func (m *Chat) ScrollToTop()
ScrollToTop scrolls the chat view to the top.
func (*Chat) ScrollToTopAndAnimate ¶
ScrollToTopAndAnimate scrolls the chat view to the top and returns a command to restart any paused animations that are now visible.
func (*Chat) SelectFirst ¶
func (m *Chat) SelectFirst()
SelectFirst selects the first message in the chat list.
func (*Chat) SelectFirstInView ¶
func (m *Chat) SelectFirstInView()
SelectFirstInView selects the first message currently in view.
func (*Chat) SelectLast ¶
func (m *Chat) SelectLast()
SelectLast selects the last message in the chat list.
func (*Chat) SelectLastInView ¶
func (m *Chat) SelectLastInView()
SelectLastInView selects the last message currently in view.
func (*Chat) SelectNext ¶
func (m *Chat) SelectNext()
SelectNext selects the next message in the chat list.
func (*Chat) SelectPrev ¶
func (m *Chat) SelectPrev()
SelectPrev selects the previous message in the chat list.
func (*Chat) SelectedItemInView ¶
SelectedItemInView returns whether the selected item is currently in view.
func (*Chat) SetMessages ¶
func (m *Chat) SetMessages(msgs ...chat.MessageItem)
SetMessages sets the chat messages to the provided list of message items.
func (*Chat) SetSelected ¶
SetSelected sets the selected message index in the chat list.
func (*Chat) ToggleExpandedSelectedItem ¶
func (m *Chat) ToggleExpandedSelectedItem()
ToggleExpandedSelectedItem expands the selected message item if it is expandable.
func (*Chat) UpdateNestedToolIDs ¶
UpdateNestedToolIDs updates the ID map for nested tools within a container. Call this after modifying nested tools to ensure animations work correctly.
type DelayedClickMsg ¶
DelayedClickMsg is sent after the double-click threshold to trigger a single-click action (like expansion) if no double-click occurred.
type KeyMap ¶
type KeyMap struct {
Editor struct {
AddFile key.Binding
SendMessage key.Binding
OpenEditor key.Binding
Newline key.Binding
AddImage key.Binding
PasteImage key.Binding
MentionFile key.Binding
Commands key.Binding
// Attachments key maps
AttachmentDeleteMode key.Binding
Escape key.Binding
DeleteAllAttachments key.Binding
// History navigation
HistoryPrev key.Binding
HistoryNext key.Binding
}
Chat struct {
NewSession key.Binding
AddAttachment key.Binding
Cancel key.Binding
Tab key.Binding
Details key.Binding
TogglePills key.Binding
PillLeft key.Binding
PillRight key.Binding
Down key.Binding
Up key.Binding
UpDown key.Binding
DownOneItem key.Binding
UpOneItem key.Binding
UpDownOneItem key.Binding
PageDown key.Binding
PageUp key.Binding
HalfPageDown key.Binding
HalfPageUp key.Binding
Home key.Binding
End key.Binding
Copy key.Binding
ClearHighlight key.Binding
Expand key.Binding
}
Initialize struct {
Yes,
No,
Enter,
Switch key.Binding
}
// Global key maps
Quit key.Binding
Help key.Binding
Commands key.Binding
Models key.Binding
Providers key.Binding
Suspend key.Binding
Sessions key.Binding
Tab key.Binding
ToggleYolo key.Binding
CopyLastMessage key.Binding
}
func DefaultKeyMap ¶
func DefaultKeyMap() KeyMap
type LSPInfo ¶
type LSPInfo struct {
app.LSPClientInfo
Diagnostics map[protocol.DiagnosticSeverity]int
}
LSPInfo wraps LSP client information with diagnostic counts by severity.
type SessionFile ¶
type SessionFile struct {
FirstVersion history.File
LatestVersion history.File
Additions int
Deletions int
}
SessionFile tracks the first and latest versions of a file in a session, along with the total additions and deletions.
type Status ¶
type Status struct {
// contains filtered or unexported fields
}
Status is the status bar and help model.
func (*Status) ClearInfoMsg ¶
func (s *Status) ClearInfoMsg()
ClearInfoMsg clears the status info message.
func (*Status) Draw ¶
Draw draws the status bar onto the screen. The help/notification row is anchored to the bottom of area rather than the top, so any extra height in the allotted rect (from layout rounding) shows up above the row — where it's invisible against the chat content — instead of as a blank gap below it, at the very bottom of the screen.
func (*Status) SetHideHelp ¶
SetHideHelp sets whether the app is on the onboarding flow.
func (*Status) SetInfoMsg ¶
SetInfoMsg sets the status info message.
func (*Status) ShowingAll ¶
ShowingAll returns whether the full help view is shown.
type UI ¶
type UI struct {
// contains filtered or unexported fields
}
UI represents the main user interface model.
func (*UI) Draw ¶
Draw implements uv.Drawable and draws the UI model.