messages

package
v1.107.0 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2026 License: Apache-2.0 Imports: 36 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetClipboardWriterForTest added in v1.89.0

func SetClipboardWriterForTest(fn func(string) error) func()

SetClipboardWriterForTest replaces the system clipboard writer and returns a restore function. It is intended for black-box TUI tests that need to assert copy behavior without touching the developer or CI machine's real clipboard.

Types

type AutoScrollTickMsg

type AutoScrollTickMsg struct {
	Direction int // -1 for up, 1 for down
}

AutoScrollTickMsg triggers auto-scroll during selection

type DebouncedCopyMsg

type DebouncedCopyMsg struct {
	ClickID int // Unique identifier to match with current selection state
}

DebouncedCopyMsg triggers a debounced copy after multi-click selection

type InlineEditCancelledMsg

type InlineEditCancelledMsg struct {
	WasInSelectionMode bool // True if we were in keyboard selection mode before editing
}

InlineEditCancelledMsg is sent when inline editing is cancelled.

type InlineEditCommittedMsg

type InlineEditCommittedMsg struct {
	SessionPosition int
	Content         string
}

InlineEditCommittedMsg is sent when inline editing is committed.

type Model

type Model interface {
	layout.Model
	layout.Sizeable
	layout.Focusable
	layout.Help
	layout.Positionable

	AddUserMessage(content string) tea.Cmd
	AddLoadingMessage(description string) tea.Cmd
	ReplaceLoadingWithUser(content string, sessionPos int) tea.Cmd
	AddErrorMessage(content string) tea.Cmd
	AddAssistantMessage(sender, label string) tea.Cmd
	AddCancelledMessage() tea.Cmd
	AddWelcomeMessage(content string) tea.Cmd
	AddOrUpdateToolCall(agentName string, toolCall tools.ToolCall, toolDef tools.Tool, status types.ToolStatus) tea.Cmd
	AppendToolOutput(msg *runtime.ToolCallOutputEvent) tea.Cmd
	AddToolResult(msg *runtime.ToolCallResponseEvent, status types.ToolStatus) tea.Cmd
	AppendToLastMessage(agentName, content string) tea.Cmd
	AppendReasoning(agentName, content string) tea.Cmd
	AddShellOutputMessage(content string) tea.Cmd
	// AddAgentReturn appends the UI-only "child returned control to parent"
	// delegation transition. It is never persisted, so it does not reappear
	// when the session is reloaded.
	AddAgentReturn(fromAgent, toAgent string) tea.Cmd
	LoadFromSession(sess *session.Session) tea.Cmd

	// StopAnimations unregisters every view from the animation coordinator.
	// Call it when the list is discarded or its host view goes away, so
	// abandoned spinners do not keep the tick stream alive.
	StopAnimations()

	RemoveSpinner()
	ScrollToBottom() tea.Cmd
	AdjustBottomSlack(delta int)

	// IsScrollbarDragging returns true when the scrollbar thumb is being dragged.
	IsScrollbarDragging() bool

	// IsSelecting returns true while a text-selection drag is in progress.
	IsSelecting() bool

	// IsMouseOnScrollbar returns true when the given screen coordinates are on the scrollbar.
	IsMouseOnScrollbar(x, y int) bool

	// Inline editing methods
	StartInlineEdit(msgIndex, sessionPosition int, content string) tea.Cmd
	CancelInlineEdit() tea.Cmd
	IsInlineEditing() bool

	// FocusAt gives focus and selects the message at the given screen coordinates.
	// Falls back to the default Focus behavior if no message is found at that position.
	FocusAt(x, y int) tea.Cmd
}

Model represents a chat message list component

func New

func New(sessionState SessionState) Model

New creates a new message list component

func NewScrollableView

func NewScrollableView(width, height int, sessionState SessionState) Model

NewScrollableView creates a simple scrollable view for displaying messages in dialogs This is a lightweight version that doesn't require app or session state management

type SessionState added in v1.104.0

type SessionState interface {
	service.SessionStateReader
	SetPreviousMessage(msg *types.Message)
	ToggleHideToolResults()
}

SessionState is the session-state surface the message list depends on: read access for rendering, plus the two mutations the component performs. *service.SessionState satisfies it; embedders outside the full TUI can provide their own implementation.

type ToggleHideToolResultsMsg

type ToggleHideToolResultsMsg struct{}

ToggleHideToolResultsMsg triggers hiding/showing tool results

Jump to

Keyboard shortcuts

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