components

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TabDashboard = 0
	TabChat      = 1
	TabMessaging = 2
	TabLogs      = 3
	TabTools     = 4
)

TabIndex constants for easy reference.

Variables

This section is empty.

Functions

This section is empty.

Types

type AgentInfo

type AgentInfo struct {
	Name       string
	Model      string
	Server     string // Athyr server address
	Subscribe  []string
	Publish    []string
	Routes     []RouteInfo
	MCPServers []string
	Memory     MemoryInfo
}

AgentInfo holds configuration details about the agent.

type AvailableTool

type AvailableTool struct {
	Name        string
	Description string
	Server      string
}

AvailableTool represents an available MCP tool.

type Chat

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

Chat provides an interactive chat interface.

func NewChat

func NewChat() Chat

NewChat creates a new Chat component.

func (*Chat) AddAssistantMessage

func (c *Chat) AddAssistantMessage(content string)

AddAssistantMessage adds an assistant message to the history.

func (*Chat) AddErrorMessage

func (c *Chat) AddErrorMessage(content string)

AddErrorMessage adds an error message to the history.

func (*Chat) AddUserMessage

func (c *Chat) AddUserMessage(content string)

AddUserMessage adds a user message to the history.

func (*Chat) Blur

func (c *Chat) Blur()

Blur unfocuses the input.

func (*Chat) ClearInput

func (c *Chat) ClearInput()

ClearInput clears the input textarea.

func (*Chat) Focus

func (c *Chat) Focus()

Focus focuses the input.

func (Chat) Focused

func (c Chat) Focused() bool

Focused returns whether the input is focused.

func (Chat) Init

func (c Chat) Init() tea.Cmd

Init initializes the chat component.

func (*Chat) SetSending

func (c *Chat) SetSending(sending bool)

SetSending sets the sending state (shows spinner).

func (*Chat) SetSize

func (c *Chat) SetSize(w, h int)

SetSize updates the component size. w and h are the panel content dimensions (excluding panel borders/padding).

func (Chat) Update

func (c Chat) Update(msg tea.Msg) (Chat, tea.Cmd)

Update handles input.

func (Chat) Value

func (c Chat) Value() string

Value returns the current input value.

func (Chat) View

func (c Chat) View() string

View renders the chat interface.

type ChatMessage

type ChatMessage struct {
	Time    time.Time
	Role    string // "user", "assistant", "error"
	Content string
}

ChatMessage represents a message in the chat history.

type Dashboard

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

Dashboard displays the agent status and message flow side by side.

func NewDashboard

func NewDashboard(info AgentInfo) Dashboard

NewDashboard creates a new Dashboard component.

func (*Dashboard) AddMessage

func (d *Dashboard) AddMessage(msg Message)

AddMessage adds a new message to the log.

func (*Dashboard) AddTokens

func (d *Dashboard) AddTokens(count int)

AddTokens adds tokens to the total count.

func (Dashboard) AgentID

func (d Dashboard) AgentID() string

AgentID returns the current agent ID.

func (Dashboard) Connected

func (d Dashboard) Connected() bool

Connected returns the current connection status.

func (*Dashboard) SetAgentID

func (d *Dashboard) SetAgentID(id string)

SetAgentID updates the agent ID.

func (*Dashboard) SetConnected

func (d *Dashboard) SetConnected(connected bool)

SetConnected updates the connection status.

func (*Dashboard) SetError

func (d *Dashboard) SetError(msg string)

SetError sets an error message.

func (*Dashboard) SetSize

func (d *Dashboard) SetSize(w, h int)

SetSize updates the component size.

func (Dashboard) TotalTokens

func (d Dashboard) TotalTokens() int

TotalTokens returns the total token count.

func (Dashboard) Update

func (d Dashboard) Update(msg tea.Msg) (Dashboard, tea.Cmd)

Update handles messages for the dashboard.

func (Dashboard) View

func (d Dashboard) View() string

View renders the dashboard filling exactly width × height.

type Help

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

Help displays a keyboard shortcuts overlay.

func NewHelp

func NewHelp() Help

NewHelp creates a new Help component.

func (*Help) SetSize

func (h *Help) SetSize(w, ht int)

SetSize updates the component size.

func (Help) View

func (h Help) View() string

View renders the help overlay.

type LogEntry

type LogEntry struct {
	Time    time.Time
	Level   LogLevel
	Message string
	Attrs   map[string]any
}

LogEntry represents a single log entry.

type LogLevel

type LogLevel int

LogLevel represents log severity.

const (
	LogLevelDebug LogLevel = iota
	LogLevelInfo
	LogLevelWarn
	LogLevelError
)

type Logs

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

Logs displays a scrollable list of log entries.

func NewLogs

func NewLogs() Logs

NewLogs creates a new Logs component.

func (*Logs) AddLog

func (l *Logs) AddLog(entry LogEntry)

AddLog adds a new log entry.

func (Logs) Content

func (l Logs) Content() string

Content returns the inner content without panel wrapper.

func (*Logs) SetSize

func (l *Logs) SetSize(w, h int)

SetSize updates the component size. w and h are the total panel dimensions.

func (Logs) Update

func (l Logs) Update(msg tea.Msg) (Logs, tea.Cmd)

Update handles key messages for scrolling.

func (Logs) View

func (l Logs) View() string

View renders the logs panel filling exactly width × height.

type MemoryInfo

type MemoryInfo struct {
	Enabled       bool
	SessionPrefix string
	TTL           string
	ProfileType   string
	MaxTokens     int
}

MemoryInfo holds memory/session configuration.

type Message

type Message struct {
	Time      time.Time
	Direction MessageDirection
	Topic     string
	Content   string
	Model     string
	Tokens    int
}

Message represents a single message in the log.

type MessageDirection

type MessageDirection int

MessageDirection indicates whether a message is incoming or outgoing.

const (
	MessageIncoming MessageDirection = iota
	MessageOutgoing
)

type Messages

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

Messages displays a scrollable list of messages.

func NewMessages

func NewMessages() Messages

NewMessages creates a new Messages component.

func (*Messages) AddMessage

func (m *Messages) AddMessage(msg Message)

AddMessage adds a new message to the log.

func (Messages) Content

func (m Messages) Content() string

Content returns the inner content without panel wrapper.

func (*Messages) SetSize

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

SetSize updates the component size. w and h are the total panel dimensions.

func (Messages) Update

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

Update handles key messages for scrolling.

func (Messages) View

func (m Messages) View() string

View renders the messages panel filling exactly width × height.

type Messaging

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

Messaging provides an interface to send messages to topics.

func NewMessaging

func NewMessaging(topics []string) Messaging

NewMessaging creates a new Messaging component.

func (*Messaging) AddWatchMessage

func (m *Messaging) AddWatchMessage(msg WatchMessage)

AddWatchMessage adds a message to the watch buffer.

func (*Messaging) Blur

func (m *Messaging) Blur()

Blur blurs all inputs.

func (*Messaging) ClearInputs

func (m *Messaging) ClearInputs()

ClearInputs clears all inputs, response, and watch state.

func (*Messaging) ClearWatch

func (m *Messaging) ClearWatch()

ClearWatch clears watch state and messages.

func (*Messaging) Focus

func (m *Messaging) Focus()

Focus focuses the component on the topic field.

func (Messaging) Focused

func (m Messaging) Focused() bool

Focused returns whether the component has focus.

func (Messaging) Help

func (m Messaging) Help() string

Help returns help text for the messaging tab.

func (Messaging) Init

func (m Messaging) Init() tea.Cmd

Init initializes the component.

func (Messaging) IsSending

func (m Messaging) IsSending() bool

IsSending returns whether a message is currently being sent.

func (Messaging) IsWatchActive

func (m Messaging) IsWatchActive() bool

IsWatchActive returns whether watching is active.

func (Messaging) LeftContent

func (m Messaging) LeftContent() string

LeftContent returns the content for the left (Send) panel without title.

func (Messaging) LeftTitle

func (m Messaging) LeftTitle() string

LeftTitle returns the title for the left (Send) panel.

func (Messaging) Message

func (m Messaging) Message() string

Message returns the current message content.

func (Messaging) Mode

func (m Messaging) Mode() MessagingMode

Mode returns the current messaging mode.

func (Messaging) RightContent

func (m Messaging) RightContent() string

RightContent returns the content for the right (Watch) panel without title.

func (Messaging) RightTitle

func (m Messaging) RightTitle() string

RightTitle returns the title for the right (Watch) panel.

func (*Messaging) SetResponse

func (m *Messaging) SetResponse(response string, err error)

SetResponse sets the response from a request.

func (*Messaging) SetSending

func (m *Messaging) SetSending(sending bool)

SetSending sets the sending state.

func (*Messaging) SetSize

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

SetSize updates the component size.

func (*Messaging) SetWatchStatus

func (m *Messaging) SetWatchStatus(topic string, err error)

SetWatchStatus updates the watch state.

func (Messaging) Topic

func (m Messaging) Topic() string

Topic returns the current topic value.

func (Messaging) Update

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

Update handles input.

func (Messaging) View

func (m Messaging) View() string

View renders the messaging interface filling exactly width × height.

func (Messaging) WatchTopicValue

func (m Messaging) WatchTopicValue() string

WatchTopicValue returns the current watch topic input value.

func (Messaging) WatchedTopic

func (m Messaging) WatchedTopic() string

WatchedTopic returns the currently watched topic (empty if not watching).

type MessagingMode

type MessagingMode int

MessagingMode represents the message sending mode.

const (
	ModePublish MessagingMode = iota // Fire-and-forget
	ModeRequest                      // Wait for reply
)

type RouteInfo

type RouteInfo struct {
	Topic       string
	Description string
}

RouteInfo holds a routing destination.

type Status

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

Status displays the connection status panel.

func NewStatus

func NewStatus(info AgentInfo) Status

NewStatus creates a new Status component.

func (*Status) AddTokens

func (s *Status) AddTokens(count int)

AddTokens adds tokens to the total count.

func (Status) AgentID

func (s Status) AgentID() string

AgentID returns the current agent ID.

func (Status) Connected

func (s Status) Connected() bool

Connected returns the current connection status.

func (Status) Content

func (s Status) Content() string

Content returns the inner content without panel wrapper.

func (*Status) SetAgentID

func (s *Status) SetAgentID(id string)

SetAgentID updates the agent ID.

func (*Status) SetConnected

func (s *Status) SetConnected(connected bool)

SetConnected updates the connection status.

func (*Status) SetError

func (s *Status) SetError(msg string)

SetError sets an error message.

func (*Status) SetSize

func (s *Status) SetSize(w, h int)

SetSize updates the component size.

func (Status) TotalTokens

func (s Status) TotalTokens() int

TotalTokens returns the total token count.

func (Status) View

func (s Status) View() string

View renders the status panel filling exactly width × height.

type Tab

type Tab struct {
	Name string
	Key  string // Single character shortcut
}

Tab represents a single tab.

func DefaultTabs

func DefaultTabs() []Tab

DefaultTabs returns the standard TUI tabs.

type Tabs

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

Tabs manages tab navigation.

func NewTabs

func NewTabs(tabs []Tab) Tabs

NewTabs creates a new Tabs component.

func (Tabs) Active

func (t Tabs) Active() int

Active returns the index of the active tab.

func (Tabs) ActiveTab

func (t Tabs) ActiveTab() Tab

ActiveTab returns the active tab.

func (Tabs) Help

func (t Tabs) Help() string

Help returns help text for tab navigation.

func (*Tabs) Next

func (t *Tabs) Next()

Next moves to the next tab.

func (*Tabs) Prev

func (t *Tabs) Prev()

Prev moves to the previous tab.

func (*Tabs) SetActive

func (t *Tabs) SetActive(idx int)

SetActive sets the active tab by index.

func (*Tabs) SetWidth

func (t *Tabs) SetWidth(w int)

SetWidth updates the component width.

func (*Tabs) Update

func (t *Tabs) Update(msg tea.Msg) tea.Cmd

Update handles key messages for tab navigation.

func (Tabs) View

func (t Tabs) View() string

View renders the tabs.

type ToolExecution

type ToolExecution struct {
	Time     time.Time
	Status   ToolStatus
	Name     string
	Args     string
	Result   string
	Error    error
	Duration time.Duration
}

ToolExecution represents a tool call and its result.

type ToolStatus

type ToolStatus int

ToolStatus indicates the state of a tool execution.

const (
	ToolStarted ToolStatus = iota
	ToolCompleted
	ToolFailed
)

type Tools

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

Tools displays available tools and execution history in a split view.

func NewTools

func NewTools() Tools

NewTools creates a new Tools component.

func (*Tools) AddEvent

func (t *Tools) AddEvent(exec ToolExecution)

AddEvent adds a new tool execution event.

func (Tools) LeftContent

func (t Tools) LeftContent() string

LeftContent returns the content for the left panel (viewport content).

func (Tools) LeftTitle

func (t Tools) LeftTitle() string

LeftTitle returns the title for the left panel.

func (Tools) RightContent

func (t Tools) RightContent() string

RightContent returns the content for the right panel (viewport content).

func (Tools) RightTitle

func (t Tools) RightTitle() string

RightTitle returns the title for the right panel.

func (*Tools) SetAvailableTools

func (t *Tools) SetAvailableTools(tools []AvailableTool)

SetAvailableTools sets the list of available tools.

func (*Tools) SetSize

func (t *Tools) SetSize(w, h int)

SetSize updates the component size.

func (Tools) Update

func (t Tools) Update(msg tea.Msg) (Tools, tea.Cmd)

Update handles key messages for scrolling.

func (Tools) View

func (t Tools) View() string

View renders the tools panel filling exactly width × height.

type WatchMessage

type WatchMessage struct {
	Timestamp time.Time
	Content   string
}

WatchMessage represents a message received on a watched topic.

Jump to

Keyboard shortcuts

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