Documentation
¶
Overview ¶
Package bubbletea provides a BubbleTea-based TUI for Echoryn. It implements the Elm MVU architecture for terminal user interaction.
Index ¶
- func MemberRoleIcon(role TeamRole, isLeader bool) string
- func MemberStatusIcon(status MemberStatus) string
- func View(m AppModel) string
- type AppModel
- func (m *AppModel) CalculateLayout()
- func (m AppModel) CanSendInput() bool
- func (m AppModel) CursorPosition() (int, int)
- func (m AppModel) Init() tea.Cmd
- func (m AppModel) InputText() string
- func (m AppModel) IsStreaming() bool
- func (m AppModel) ShortSessionID() string
- func (m AppModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (m AppModel) View() string
- type AuthState
- type Config
- type ErrorMsg
- type FocusArea
- type HistoryItem
- func AddAssistantMessage(messages []HistoryItem, content string, streaming bool) []HistoryItem
- func AddInfoMessage(messages []HistoryItem, content string, level InfoLevel) []HistoryItem
- func AddTeamMessage(messages []HistoryItem, from, content string) []HistoryItem
- func AddToolGroup(messages []HistoryItem, calls []ToolCallInfo, status ToolGroupStatus) []HistoryItem
- func AddUserMessage(messages []HistoryItem, content string) []HistoryItem
- type HistoryItemAssistant
- type HistoryItemInfo
- type HistoryItemTeamMessage
- type HistoryItemToolGroup
- type HistoryItemUser
- type InfoLevel
- type InfoMsg
- type InputMsg
- type Layout
- type MemberState
- type MemberStatus
- type MemberStatusMsg
- type MsgListState
- type QuitMsg
- type StreamChunkMsg
- type StreamEndMsg
- type StreamErrorMsg
- type StreamStartMsg
- type StreamingState
- type TeamCreatedMsg
- type TeamDissolvedMsg
- type TeamMessage
- type TeamMessageMsg
- type TeamRole
- type TeamState
- type TickMsg
- type ToolCallInfo
- type ToolCallRequestMsg
- type ToolConfirmationMsg
- type ToolGroupStatus
- type ToolResultInfo
- type ToolResultMsg
- type VisibleMsg
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MemberRoleIcon ¶
MemberRoleIcon returns an icon for the member role.
func MemberStatusIcon ¶
func MemberStatusIcon(status MemberStatus) string
MemberStatusIcon returns an icon for the member status.
Types ¶
type AppModel ¶
type AppModel struct {
// === Session State ===
SessionID string
AgentID string
ModelName string
AuthState AuthState
// === Conversation State ===
Messages []HistoryItem
MsgList *MsgListState
Streaming StreamingState
// === Input State ===
InputBuffer *textbuffer.Buffer
InputHistory []string
HistoryIndex int
// === Completion State ===
CompletionMgr *completion.Manager
Completions []completion.Completion
CompletionIndex int
ShowCompletion bool
GhostText string
// === Team State ===
Team *TeamState
// === UI State ===
Width int
Height int
Focus FocusArea
ShowTeamPanel bool
Ready bool
Spinner spinner.SpinnerModel
// === Layout ===
Layout *Layout
// === Theme ===
Theme *theme.SemanticColors
Styles *theme.Styles
// === Error State ===
LastError string
// === Dependencies ===
Client client.StreamClient
TeamClient client.TeamClient
Config *Config
}
AppModel is the central state for the BubbleTea application. It follows the Elm architecture's single source of truth principle.
func NewAppModel ¶
func NewAppModel(streamClient client.StreamClient, teamClient client.TeamClient, cfg *Config) AppModel
NewAppModel creates a new AppModel with the given clients.
func (*AppModel) CalculateLayout ¶
func (m *AppModel) CalculateLayout()
CalculateLayout updates layout dimensions.
func (AppModel) CanSendInput ¶
CanSendInput returns true if user input can be processed.
func (AppModel) CursorPosition ¶
CursorPosition returns the current cursor position.
func (AppModel) IsStreaming ¶
IsStreaming returns true if currently receiving a stream.
func (AppModel) ShortSessionID ¶
ShortSessionID returns a truncated session ID for display.
type Config ¶
type Config struct {
Prompt string
MultilinePrompt string
RequestTimeout time.Duration
ShowLineNumbers bool
}
Config holds application configuration.
func DefaultConfig ¶
func DefaultConfig() *Config
DefaultConfig returns a Config with sensible defaults.
type HistoryItem ¶
HistoryItem represents a single entry in the conversation history.
func AddAssistantMessage ¶
func AddAssistantMessage(messages []HistoryItem, content string, streaming bool) []HistoryItem
AddAssistantMessage adds an assistant message to the history.
func AddInfoMessage ¶
func AddInfoMessage(messages []HistoryItem, content string, level InfoLevel) []HistoryItem
AddInfoMessage adds an info message to the history.
func AddTeamMessage ¶
func AddTeamMessage(messages []HistoryItem, from, content string) []HistoryItem
AddTeamMessage adds a team message to the history.
func AddToolGroup ¶
func AddToolGroup(messages []HistoryItem, calls []ToolCallInfo, status ToolGroupStatus) []HistoryItem
AddToolGroup adds a tool group to the history.
func AddUserMessage ¶
func AddUserMessage(messages []HistoryItem, content string) []HistoryItem
AddUserMessage adds a user message to the history.
type HistoryItemAssistant ¶
HistoryItemAssistant represents an assistant response.
func (*HistoryItemAssistant) Timestamp ¶
func (h *HistoryItemAssistant) Timestamp() time.Time
Timestamp returns the message timestamp.
type HistoryItemInfo ¶
HistoryItemInfo represents a system info/warning/error message.
func (*HistoryItemInfo) GetID ¶
func (h *HistoryItemInfo) GetID() string
GetID returns the message ID.
func (*HistoryItemInfo) Timestamp ¶
func (h *HistoryItemInfo) Timestamp() time.Time
Timestamp returns the message timestamp.
type HistoryItemTeamMessage ¶
HistoryItemTeamMessage represents a message from a team member.
func (*HistoryItemTeamMessage) GetID ¶
func (h *HistoryItemTeamMessage) GetID() string
GetID returns the message ID.
func (*HistoryItemTeamMessage) Timestamp ¶
func (h *HistoryItemTeamMessage) Timestamp() time.Time
Timestamp returns the message timestamp.
type HistoryItemToolGroup ¶
type HistoryItemToolGroup struct {
Calls []ToolCallInfo
Results []ToolResultInfo
Status ToolGroupStatus
Time time.Time
}
HistoryItemToolGroup represents a group of tool calls.
func (*HistoryItemToolGroup) Timestamp ¶
func (h *HistoryItemToolGroup) Timestamp() time.Time
Timestamp returns the message timestamp.
type HistoryItemUser ¶
HistoryItemUser represents a user message.
func (*HistoryItemUser) Timestamp ¶
func (h *HistoryItemUser) Timestamp() time.Time
Timestamp returns the message timestamp.
type Layout ¶
type Layout struct {
HeaderHeight int
InputHeight int
ContentHeight int
TeamPanelWidth int
MainWidth int
}
Layout holds layout calculations.
type MemberState ¶
type MemberState struct {
SessionID string
Label string
Role TeamRole
Status MemberStatus
Progress string
LastMsg string
NodeID string
}
MemberState represents a team member's current status.
type MemberStatus ¶
type MemberStatus string
MemberStatus is the current status of a team member.
const ( StatusIdle MemberStatus = "idle" StatusRunning MemberStatus = "running" StatusCompleted MemberStatus = "completed" StatusFailed MemberStatus = "failed" )
type MemberStatusMsg ¶
type MemberStatusMsg struct {
SessionID string
Status MemberStatus
Progress string
}
MemberStatusMsg indicates a member's status changed.
type MsgListState ¶
type MsgListState struct {
// contains filtered or unexported fields
}
MsgListState manages the virtual list for messages.
func NewMsgListState ¶
func NewMsgListState() *MsgListState
NewMsgListState creates a new message list state.
func (*MsgListState) ItemCount ¶
func (l *MsgListState) ItemCount() int
ItemCount returns the number of items.
func (*MsgListState) ScrollToBottom ¶
func (l *MsgListState) ScrollToBottom()
ScrollToBottom scrolls to the bottom.
func (*MsgListState) SetItemHeight ¶
func (l *MsgListState) SetItemHeight(id string, height int)
SetItemHeight sets the height for an item.
func (*MsgListState) SetViewport ¶
func (l *MsgListState) SetViewport(height, width int)
SetViewport sets the viewport dimensions.
func (*MsgListState) VisibleItems ¶
func (l *MsgListState) VisibleItems() []VisibleMsg
VisibleItems returns visible items with their positions.
type StreamChunkMsg ¶
StreamChunkMsg represents a chunk of streaming content.
type StreamEndMsg ¶
StreamEndMsg indicates the end of a streaming response.
type StreamErrorMsg ¶
type StreamErrorMsg struct {
Error error
}
StreamErrorMsg represents an error during streaming.
type StreamStartMsg ¶
type StreamStartMsg struct {
RunID string
}
StreamStartMsg indicates the start of a streaming response.
type StreamingState ¶
type StreamingState int
StreamingState represents the current streaming response status.
const ( StreamingIdle StreamingState = iota StreamingResponding StreamingWaitingConfirmation // waiting for user to confirm tool execution )
type TeamCreatedMsg ¶
type TeamCreatedMsg struct {
TeamID string
Name string
Template string
Members []MemberState
}
TeamCreatedMsg indicates a team was successfully created.
type TeamDissolvedMsg ¶
type TeamDissolvedMsg struct {
TeamID string
}
TeamDissolvedMsg indicates the current team was dissolved.
type TeamMessage ¶
TeamMessage is a message from a team member.
type TeamMessageMsg ¶
TeamMessageMsg represents a message from a team member.
type TeamState ¶
type TeamState struct {
Enabled bool
ID string
Name string
TemplateID string
Strategy string
Members []MemberState
Messages []TeamMessage
FocusIndex int
}
TeamState holds the current team collaboration state.
type ToolCallInfo ¶
ToolCallInfo represents information about a tool call.
type ToolCallRequestMsg ¶
type ToolCallRequestMsg struct {
Calls []ToolCallInfo
}
ToolCallRequestMsg indicates tool calls are pending user confirmation.
type ToolConfirmationMsg ¶
ToolConfirmationMsg represents user's tool confirmation decision.
type ToolGroupStatus ¶
type ToolGroupStatus int
ToolGroupStatus represents the status of a group of tool calls.
const ( ToolGroupPending ToolGroupStatus = iota ToolGroupConfirmed ToolGroupRunning ToolGroupCompleted ToolGroupRejected )
type ToolResultInfo ¶
ToolResultInfo represents the result of a tool execution.
type ToolResultMsg ¶
ToolResultMsg represents the result of a tool execution.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package client provides client interfaces for the BubbleTea TUI.
|
Package client provides client interfaces for the BubbleTea TUI. |
|
Package markdown provides Markdown rendering for terminal output.
|
Package markdown provides Markdown rendering for terminal output. |
|
completion
Package completion provides auto-completion for commands and suggestions.
|
Package completion provides auto-completion for commands and suggestions. |
|
list
Package list provides virtualized list rendering for large datasets.
|
Package list provides virtualized list rendering for large datasets. |
|
markdown
Package markdown provides markdown rendering for terminal output.
|
Package markdown provides markdown rendering for terminal output. |
|
spinner
Package spinner provides a loading spinner component.
|
Package spinner provides a loading spinner component. |
|
textbuffer
Package textbuffer provides a multi-line text editor with cursor movement, history navigation, and auto-completion support.
|
Package textbuffer provides a multi-line text editor with cursor movement, history navigation, and auto-completion support. |
|
Package theme provides semantic theming for the TUI.
|
Package theme provides semantic theming for the TUI. |