components

package
v0.0.0-...-aa30158 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChatModel

type ChatModel struct {
	// contains filtered or unexported fields
}

ChatModel is a reusable chat UI component.

func NewChatModel

func NewChatModel(sender MessageSender, slashHandler SlashHandler) ChatModel

NewChatModel creates a new chat component.

func (*ChatModel) AddMessage

func (m *ChatModel) AddMessage(role Role, content string)

AddMessage adds a message to the chat from outside.

func (*ChatModel) ClearMessages

func (m *ChatModel) ClearMessages()

ClearMessages removes all messages.

func (ChatModel) Init

func (m ChatModel) Init() tea.Cmd

Init returns the initial commands for the chat component.

func (ChatModel) IsWaiting

func (m ChatModel) IsWaiting() bool

IsWaiting returns true if waiting for a response.

func (ChatModel) Messages

func (m ChatModel) Messages() []Message

Messages returns a copy of all messages.

func (*ChatModel) ReceiveResponse

func (m *ChatModel) ReceiveResponse(content string) tea.Cmd

ReceiveResponse adds an assistant response to the chat and clears the waiting state. Returns nil. This is used when the parent model intercepts response messages (e.g., to check for plan tags) before forwarding the text to the chat.

func (*ChatModel) SetSize

func (m *ChatModel) SetSize(width, height int)

SetSize updates the component dimensions.

func (ChatModel) Update

func (m ChatModel) Update(msg tea.Msg) (ChatModel, tea.Cmd)

Update handles messages for the chat component.

func (ChatModel) View

func (m ChatModel) View() string

View renders the chat component.

type LogLine

type LogLine struct {
	Text string
	Type LogLineType
}

LogLine is a single line in the task's live log.

type LogLineType

type LogLineType int

LogLineType classifies log line severity/purpose.

const (
	LogInfo LogLineType = iota
	LogSuccess
	LogError
	LogWarning
	LogClaudeChunk
)

type LogStreamModel

type LogStreamModel struct {
	// contains filtered or unexported fields
}

LogStreamModel is a streaming log viewer that auto-scrolls and shows color-coded lines.

func NewLogStreamModel

func NewLogStreamModel() LogStreamModel

NewLogStreamModel creates a new log stream viewer.

func (*LogStreamModel) AppendLine

func (m *LogStreamModel) AppendLine(line LogLine)

AppendLine adds a new log line and auto-scrolls if following.

func (*LogStreamModel) Clear

func (m *LogStreamModel) Clear()

Clear removes all lines.

func (*LogStreamModel) SetLines

func (m *LogStreamModel) SetLines(lines []LogLine)

SetLines replaces all lines (e.g., when switching to a different task).

func (*LogStreamModel) SetSize

func (m *LogStreamModel) SetSize(w, h int)

SetSize updates the dimensions.

func (LogStreamModel) Update

func (m LogStreamModel) Update(msg tea.Msg) (LogStreamModel, tea.Cmd)

Update handles scroll keys.

func (LogStreamModel) View

func (m LogStreamModel) View() string

View renders the log stream.

type Message

type Message struct {
	Role    Role
	Content string
	Time    time.Time
}

Message is a single chat message.

type MessageSender

type MessageSender func(text string) tea.Cmd

MessageSender is called when the user sends a message. It receives the user's text and returns a tea.Cmd that will eventually produce a ResponseMsg.

type ProgressBarModel

type ProgressBarModel struct {
	// contains filtered or unexported fields
}

ProgressBarModel is a simple reusable progress bar.

func NewProgressBarModel

func NewProgressBarModel(total, width int) ProgressBarModel

NewProgressBarModel creates a new progress bar.

func (*ProgressBarModel) SetDone

func (m *ProgressBarModel) SetDone(done int)

SetDone updates the completed count.

func (*ProgressBarModel) SetTotal

func (m *ProgressBarModel) SetTotal(total int)

SetTotal updates the total count.

func (*ProgressBarModel) SetWidth

func (m *ProgressBarModel) SetWidth(width int)

SetWidth updates the bar width.

func (ProgressBarModel) View

func (m ProgressBarModel) View() string

View renders the progress bar.

type ResponseMsg

type ResponseMsg struct {
	Content string
	Err     error
}

ResponseMsg is produced by MessageSender when a response arrives.

type Role

type Role string

Role identifies who sent a message.

const (
	RoleUser      Role = "user"
	RoleAssistant Role = "assistant"
	RoleSystem    Role = "system"
)

type SlashCommand

type SlashCommand struct {
	Name string
	Args string
}

SlashCommand represents a parsed slash command.

func ParseSlashCommand

func ParseSlashCommand(input string) (SlashCommand, bool)

ParseSlashCommand parses a slash command from input. Exported for testing.

type SlashHandler

type SlashHandler func(cmd SlashCommand) (tea.Cmd, bool)

SlashHandler is called when a slash command is detected. Returns a tea.Cmd if the command produces an async action, nil otherwise. Returns a bool indicating if the command was handled.

type StreamChunkMsg

type StreamChunkMsg struct {
	Chunk string
}

StreamChunkMsg carries a chunk of text from the streaming response.

type StreamDoneMsg

type StreamDoneMsg struct {
	FullText string
	Err      error
}

StreamDoneMsg indicates the stream is complete.

type StreamStartMsg

type StreamStartMsg struct{}

StreamStartMsg indicates a streaming response has begun.

type TaskActionMsg

type TaskActionMsg struct {
	Action string // "edit", "delete", "new", "reorder_up", "reorder_down"
	TaskID string
}

TaskActionMsg is emitted when the user triggers an action on a task.

type TaskListItem

type TaskListItem struct {
	ID         string
	Title      string
	Complexity string
	Status     TaskStatus
	Editable   bool
	Detail     string // pre-rendered detail text
}

TaskListItem represents a single item in the task list display.

type TaskListModel

type TaskListModel struct {
	// contains filtered or unexported fields
}

TaskListModel is a reusable list component for displaying tasks.

func NewTaskListModel

func NewTaskListModel(items []TaskListItem) TaskListModel

NewTaskListModel creates a new task list component.

func (TaskListModel) CursorID

func (m TaskListModel) CursorID() string

CursorID returns the ID of the currently selected task.

func (TaskListModel) Init

func (m TaskListModel) Init() tea.Cmd

Init returns the initial command.

func (TaskListModel) SelectedItem

func (m TaskListModel) SelectedItem() *TaskListItem

SelectedItem returns the currently highlighted item.

func (*TaskListModel) SetCursorByID

func (m *TaskListModel) SetCursorByID(id string)

SetCursorByID moves the cursor to the item with the given ID.

func (*TaskListModel) SetItems

func (m *TaskListModel) SetItems(items []TaskListItem)

SetItems replaces the items (e.g., after delete/reorder).

func (*TaskListModel) SetSize

func (m *TaskListModel) SetSize(w, h int)

SetSize updates the component dimensions.

func (*TaskListModel) ToggleDetail

func (m *TaskListModel) ToggleDetail()

ToggleDetail toggles the expanded detail panel.

func (TaskListModel) Update

func (m TaskListModel) Update(msg tea.Msg) (TaskListModel, tea.Cmd)

Update handles messages for the task list component.

func (TaskListModel) View

func (m TaskListModel) View() string

View renders the task list component.

type TaskSelectedMsg

type TaskSelectedMsg struct {
	Item TaskListItem
}

TaskSelectedMsg is emitted when the selected task changes.

type TaskStatus

type TaskStatus string

TaskStatus mirrors state.TaskStatus without importing state.

const (
	StatusPending    TaskStatus = "pending"
	StatusInProgress TaskStatus = "in-progress"
	StatusDone       TaskStatus = "done"
	StatusFailed     TaskStatus = "failed"
	StatusSkipped    TaskStatus = "skipped"
	StatusCancelled  TaskStatus = "cancelled"
)

Jump to

Keyboard shortcuts

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