Documentation
¶
Overview ¶
Package tui implements the interactive terminal UI using Bubble Tea v2.
Index ¶
- func GenerateCommitMsgFunc(llm llmmodel.LLM) func(ctx context.Context, diffs string) (string, error)
- func Run(ctx context.Context, cfg Config) error
- type AgentSubEvent
- type CompactStatsProvider
- type CompleteResult
- type CompletionCandidate
- type CompletionType
- type Config
- type Gate
- type GateResult
- type Screen
- type TokenTracker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AgentSubEvent ¶
type AgentSubEvent struct {
AgentID string
Kind string // "tool_call", "tool_result", "text_delta", etc.
Content string
}
AgentSubEvent carries a subagent event from the agent tool to the TUI.
type CompactStatsProvider ¶ added in v0.0.4
type CompactStatsProvider interface {
FormatStats() string
}
CompactStatsProvider provides compaction statistics for TUI display.
type CompleteResult ¶
type CompleteResult struct {
Candidates []CompletionCandidate
Selected int
Type CompletionType
}
CompleteResult holds all completion results.
func Complete ¶
func Complete(input string, skills []extension.Skill, workDir string) *CompleteResult
Complete returns completion candidates for the given input. It analyzes the input and returns all matching options for commands, skills, and specs.
func (*CompleteResult) ApplySelection ¶
func (r *CompleteResult) ApplySelection(index int) string
ApplySelection returns the text of the candidate at the given index.
func (*CompleteResult) CycleSelection ¶
func (r *CompleteResult) CycleSelection(dir int)
CycleSelection moves the selection index in the given direction. dir should be 1 for next, -1 for previous.
func (*CompleteResult) SelectedCandidate ¶
func (r *CompleteResult) SelectedCandidate() *CompletionCandidate
SelectedCandidate returns the currently selected candidate.
type CompletionCandidate ¶
type CompletionCandidate struct {
Text string
Description string
Type CompletionType
}
CompletionCandidate represents a single completion option.
type CompletionType ¶
type CompletionType int
CompletionType identifies what kind of completion to perform.
const ( CompletionTypeNone CompletionType = iota CompletionTypeCommand CompletionTypeSkill CompletionTypeSpec )
type Config ¶
type Config struct {
Agent *agent.Agent
SessionID string
ModelName string
ActiveRole string
Roles map[string]config.RoleConfig
SessionService *pisession.FileService
WorkDir string
Orchestrator *subagent.Orchestrator
// GenerateCommitMsg is called by /commit to generate a conventional commit message from diffs.
// If nil, /commit is disabled.
GenerateCommitMsg func(ctx context.Context, diffs string) (string, error)
// Logger is the session logger. If nil, logging is disabled.
Logger *logger.Logger
// Screen receives screen content updates for the screen tool.
// If nil, the screen tool won't have access to TUI content.
Screen *Screen
// Skills is loaded from skill directories for command completion.
Skills []extension.Skill
// SkillDirs are the directories to re-scan for skills on each completion.
SkillDirs []string
// RestartCh receives a signal when the agent calls the restart tool.
RestartCh chan struct{}
// AgentEventCh receives subagent events from the agent tool for live display.
AgentEventCh <-chan AgentSubEvent
// TokenTracker tracks daily token usage and enforces limits. May be nil.
TokenTracker TokenTracker
// CompactMetrics tracks output compaction statistics. May be nil.
CompactMetrics CompactStatsProvider
}
Config holds configuration for the TUI.
type GateResult ¶
GateResult holds the result of running a single gate command.
type Screen ¶
type Screen struct {
// contains filtered or unexported fields
}
Screen provides thread-safe access to the current TUI screen content. It implements tools.ScreenProvider so the LLM can read what the user sees.
func (*Screen) ScreenContent ¶
ScreenContent returns the current screen content.