Documentation
¶
Index ¶
- Constants
- type AgentApp
- func (app *AgentApp) ApproveTool(ctx context.Context, req approval.Request) (bool, error)
- func (app *AgentApp) AskUser(ctx context.Context, question string, options []string) (string, error)
- func (app *AgentApp) Interrupt()
- func (app *AgentApp) Run() error
- func (app *AgentApp) Stop()
- func (app *AgentApp) UpdateTodos(ctx context.Context, items []tools.TodoItem) error
- type AskQuestionMsg
- type CancelQuestionMsg
- type CommandResult
- type ErrorMsg
- type Message
- type MessageType
- type NoticeMsg
- type ReasoningChunkMsg
- type ResponseMsg
- type SlashCommand
- type SlashHandler
- type StreamChunkMsg
- type StreamEndMsg
- type Theme
- type ThemeVariant
- type TodoItem
- type TodoUpdateMsg
- type ToolEndMsg
- type ToolStartMsg
- type ToolStatus
- type ViewModel
- func (m *ViewModel) ApplyTheme(name, mode string) error
- func (m *ViewModel) DarkMode() bool
- func (m *ViewModel) Init() tea.Cmd
- func (m *ViewModel) SetMouseToggle(fn func() bool)
- func (m *ViewModel) SetOnClear(fn func())
- func (m *ViewModel) SetOnInterrupt(fn func())
- func (m *ViewModel) SetSlashCommands(cmds []SlashCommand, handler SlashHandler)
- func (m *ViewModel) SetSubtitle(subtitle string)
- func (m *ViewModel) SetTodos(items []TodoItem)
- func (m *ViewModel) SetTranscript(msgs []Message)
- func (m *ViewModel) SetWorkDir(dir string)
- func (m *ViewModel) ThemeName() string
- func (m *ViewModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (m *ViewModel) View() string
Constants ¶
const ( TodoPending = "pending" TodoInProgress = "in_progress" TodoCompleted = "completed" )
Task statuses shown in the TUI task panel.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AgentApp ¶
type AgentApp struct {
// contains filtered or unexported fields
}
AgentApp represents the Agent application structure
func NewAgentApp ¶
NewAgentApp creates a new Agent application
func (*AgentApp) ApproveTool ¶
ApproveTool implements tools.Host for agent sessions.
func (*AgentApp) AskUser ¶
func (app *AgentApp) AskUser(ctx context.Context, question string, options []string) (string, error)
AskUser implements tools.Host for agent sessions.
type AskQuestionMsg ¶
type AskQuestionMsg struct {
Question string
Options []string
Reply chan string
Approval bool // tool-approval prompt: options only, no free text
Detail string // extra context shown dim below the question
}
AskQuestionMsg asks the user a question from a running tool. The answer is sent back on Reply ("" means the user cancelled). Approval prompts reuse the question panel but only accept one of the offered options.
type CancelQuestionMsg ¶
type CancelQuestionMsg struct{}
CancelQuestionMsg dismisses a pending question when the turn was cancelled before the user answered.
type CommandResult ¶
type CommandResult struct {
Message string // transcript message (empty = nothing to show)
Error bool // render the message as an error
Subtitle string // new header subtitle (empty = unchanged)
Cmd tea.Cmd // asynchronous work started by the command
}
CommandResult is returned by a command handler.
type Message ¶
type Message struct {
Type MessageType
Content string
Name string // Tool name (only used for tool messages)
CallID string // Tool call id, pairs a call with its result
ToolStatus ToolStatus // Status of tool execution (only used for tool messages)
Arguments string // Tool arguments (only used for tool messages)
Result string // Tool result (only used for tool messages)
StartTime int64 // Tool start time (Unix timestamp, only used for tool messages)
EndTime int64 // Tool end time (Unix timestamp, only used for tool messages)
// contains filtered or unexported fields
}
Message represents a chat message
type MessageType ¶
type MessageType int
MessageType represents the type of a message
const ( UserMessage MessageType = iota AssistantMessage ToolStartMessage ToolEndMessage ErrorMessage ReasoningMessage InfoMessage )
type ReasoningChunkMsg ¶
type ReasoningChunkMsg string
type SlashCommand ¶
type SlashCommand struct {
Name string // command name without the leading slash
Args string // argument hint, e.g. "<name>" (optional)
Description string // short description shown in the palette
Values []string // optional argument suggestions
// ValueLabels optionally annotates each Values entry (same order and
// length). The label is appended after the value in the palette.
ValueLabels []string
// KeepArgs keeps a chosen value in the input box instead of executing,
// so the user can continue typing (e.g. "/skill coder " + a message).
KeepArgs bool
}
SlashCommand describes a command available in the TUI command palette.
type SlashHandler ¶
type SlashHandler func(input string) CommandResult
SlashHandler executes a command line without the leading slash.
type StreamChunkMsg ¶
type StreamChunkMsg string
type StreamEndMsg ¶
type StreamEndMsg struct{}
type Theme ¶
type Theme struct {
Name string
Description string
Light ThemeVariant
Dark ThemeVariant
}
Theme is a named color scheme with light and dark variants.
type ThemeVariant ¶
type ThemeVariant = plugins.ThemeVariant
ThemeVariant is a set of interface colors tuned for one background mode.
type TodoUpdateMsg ¶
type TodoUpdateMsg struct {
Items []TodoItem
}
TodoUpdateMsg replaces the task panel contents.
type ToolStartMsg ¶
type ToolStatus ¶
type ToolStatus int
ToolStatus represents the status of a tool call
const ( ToolWaiting ToolStatus = iota // Tool is being called (orange) ToolSuccess // Tool completed successfully (green) ToolError // Tool failed (red) )
type ViewModel ¶
type ViewModel struct {
// contains filtered or unexported fields
}
ViewModel is the model for the Agent interface
func NewViewModel ¶
NewViewModel creates a new ViewModel
func (*ViewModel) ApplyTheme ¶
ApplyTheme switches the color theme. mode may be "", "auto", "light" or "dark"; empty/auto follows the terminal background.
func (*ViewModel) SetMouseToggle ¶
SetMouseToggle registers the callback used by Ctrl+Y to toggle mouse capture. It returns the new state (true = mouse captured).
func (*ViewModel) SetOnClear ¶
func (m *ViewModel) SetOnClear(fn func())
SetOnClear registers a callback invoked whenever the transcript is cleared.
func (*ViewModel) SetOnInterrupt ¶
func (m *ViewModel) SetOnInterrupt(fn func())
SetOnInterrupt registers the callback invoked when the user stops a running reply with Esc twice.
func (*ViewModel) SetSlashCommands ¶
func (m *ViewModel) SetSlashCommands(cmds []SlashCommand, handler SlashHandler)
SetSlashCommands registers host-provided commands and their handler. Commands are shown in the palette while typing "/" and executed on enter.
func (*ViewModel) SetSubtitle ¶
SetSubtitle sets the header subtitle (agent or model name).
func (*ViewModel) SetTodos ¶
SetTodos replaces the task panel contents (used when resuming a session).
func (*ViewModel) SetTranscript ¶
SetTranscript replaces the conversation with the given messages (used when resuming a saved session).
func (*ViewModel) SetWorkDir ¶ added in v0.4.0
SetWorkDir sets the working directory shown in the header. An empty value hides it.