Documentation
¶
Index ¶
- Constants
- Variables
- func GetLightningBoltWidth() int
- func GetRobotWidth() int
- func GetRuneWidth(r rune) int
- func Gline(prompt string, historyValues []string, explanation string, predictor Predictor, ...) (string, error)
- func WordwrapWithRuneWidth(s string, width int) string
- type BorderStatusModel
- func (m BorderStatusModel) RenderBottomCenter() string
- func (m BorderStatusModel) RenderBottomLeft() string
- func (m BorderStatusModel) RenderTopContext(maxWidth int) string
- func (m BorderStatusModel) RenderTopLeft() string
- func (m *BorderStatusModel) SetWidth(w int)
- func (m BorderStatusModel) TopLeftWidth() int
- func (m *BorderStatusModel) UpdateContext(user, host, cwd string)
- func (m *BorderStatusModel) UpdateGit(status *git.RepoStatus)
- func (m *BorderStatusModel) UpdateInput(input string)
- func (m *BorderStatusModel) UpdateResources(res *system.Resources)
- type BorderStyles
- type CommandKind
- type Explainer
- type IdleSummaryGenerator
- type LLMIndicator
- type LLMStatus
- type LLMTickMsg
- type MultilineState
- func (m *MultilineState) AddLine(line string) (complete bool, prompt string)
- func (m *MultilineState) GetAccumulatedLines() string
- func (m *MultilineState) GetCompleteCommand() string
- func (m *MultilineState) GetLines() []string
- func (m *MultilineState) IsActive() bool
- func (m *MultilineState) Reset()
- type NoopExplainer
- type NoopPredictionAnalytics
- type NoopPredictor
- type Options
- type PredictionAnalytics
- type Predictor
- type RiskLevel
- type ShellCompletionProvider
Constants ¶
const ( Active appState = iota Terminated )
const ( ESC = "\033" BACKSPACE = "\b \b" RESET_CURSOR = ESC + "[H" RESET_CURSOR_COLUMN = ESC + "[G" CLEAR_REMAINING_LINE = ESC + "[K" CLEAR_LINE = RESET_CURSOR_COLUMN + ESC + "[2K" CLEAR_AFTER_CURSOR = ESC + "[J" SAVE_CURSOR = ESC + "[s" RESTORE_CURSOR = ESC + "[u" GET_CURSOR_POS = ESC + "[6n" MOVE_CURSOR = ESC + "[%d;%dH" )
Variables ¶
var ErrInterrupted = errors.New("interrupted by user")
ErrInterrupted is returned when the user presses Ctrl+C
Functions ¶
func GetLightningBoltWidth ¶
func GetLightningBoltWidth() int
GetLightningBoltWidth returns the width of the lightning bolt character. Uses the generic emoji width cache with terminal probing.
func GetRobotWidth ¶
func GetRobotWidth() int
GetRobotWidth returns the width of the robot emoji character. Uses the generic emoji width cache with terminal probing.
func GetRuneWidth ¶
GetRuneWidth returns the display width of a rune, using terminal probing for emoji. For emoji characters, the width is detected once and cached. For other characters, it returns 1 for ASCII or 2 for wide characters.
func WordwrapWithRuneWidth ¶
WordwrapWithRuneWidth wraps text to the given width using GetRuneWidth for accurate Unicode character width calculation. This is needed because the standard ansi.Wordwrap uses its own width calculation that may not match terminal-specific emoji rendering. It preserves ANSI escape codes in the output.
Types ¶
type BorderStatusModel ¶
type BorderStatusModel struct {
// contains filtered or unexported fields
}
BorderStatusModel manages the state and rendering of border status elements
func NewBorderStatusModel ¶
func NewBorderStatusModel() BorderStatusModel
func (BorderStatusModel) RenderBottomCenter ¶
func (m BorderStatusModel) RenderBottomCenter() string
func (BorderStatusModel) RenderBottomLeft ¶
func (m BorderStatusModel) RenderBottomLeft() string
func (BorderStatusModel) RenderTopContext ¶
func (m BorderStatusModel) RenderTopContext(maxWidth int) string
func (BorderStatusModel) RenderTopLeft ¶
func (m BorderStatusModel) RenderTopLeft() string
func (*BorderStatusModel) SetWidth ¶
func (m *BorderStatusModel) SetWidth(w int)
func (BorderStatusModel) TopLeftWidth ¶
func (m BorderStatusModel) TopLeftWidth() int
TopLeftWidth returns the actual display width of the top-left section. This accounts for terminal-specific rendering of emoji characters like 🤖.
func (*BorderStatusModel) UpdateContext ¶
func (m *BorderStatusModel) UpdateContext(user, host, cwd string)
func (*BorderStatusModel) UpdateGit ¶
func (m *BorderStatusModel) UpdateGit(status *git.RepoStatus)
func (*BorderStatusModel) UpdateInput ¶
func (m *BorderStatusModel) UpdateInput(input string)
func (*BorderStatusModel) UpdateResources ¶
func (m *BorderStatusModel) UpdateResources(res *system.Resources)
type BorderStyles ¶
type BorderStyles struct {
BadgeRaw lipgloss.Style
BadgeAgent lipgloss.Style
BadgeControl lipgloss.Style
BadgeSub lipgloss.Style
RiskCalm lipgloss.Style
RiskWarning lipgloss.Style
RiskAlert lipgloss.Style
ContextUser lipgloss.Style
ContextDir lipgloss.Style
ContextGit lipgloss.Style
Divider lipgloss.Style
ResCool lipgloss.Style
ResWarm lipgloss.Style
ResHot lipgloss.Style
ResLabel lipgloss.Style
}
type CommandKind ¶
type CommandKind int
Command Classification
const ( KindRawShell CommandKind = iota KindAgentChat KindAgentControl KindSubagent KindUnknown )
type IdleSummaryGenerator ¶
IdleSummaryGenerator is a function that generates an idle summary
type LLMIndicator ¶
type LLMIndicator struct {
// contains filtered or unexported fields
}
LLMIndicator holds the state for an LLM status indicator
func NewLLMIndicator ¶
func NewLLMIndicator() LLMIndicator
NewLLMIndicator creates a new LLM indicator
func (LLMIndicator) GetStatus ¶
func (i LLMIndicator) GetStatus() LLMStatus
GetStatus returns the current status
func (*LLMIndicator) SetStatus ¶
func (i *LLMIndicator) SetStatus(status LLMStatus)
SetStatus updates the indicator status
func (LLMIndicator) Tick ¶
func (i LLMIndicator) Tick() tea.Cmd
Tick returns a command that sends LLMTickMsg after the animation interval
func (LLMIndicator) Width ¶
func (i LLMIndicator) Width() int
Width returns the display width of the indicator. Note: ⚡ (U+26A1) has ambiguous East Asian width; runewidth returns 2 but many western terminals render it as 1 cell. We detect the actual terminal behavior at runtime using cursor position probing.
type LLMStatus ¶
type LLMStatus int
LLMStatus represents the current status of an LLM request
const ( // LLMStatusIdle means no request has been made yet LLMStatusIdle LLMStatus = iota // LLMStatusInFlight means a request is currently in progress LLMStatusInFlight // LLMStatusSuccess means the last request was successful LLMStatusSuccess // LLMStatusError means the last request encountered an error LLMStatusError )
type MultilineState ¶
type MultilineState struct {
// contains filtered or unexported fields
}
MultilineState tracks the state of multiline input
func NewMultilineState ¶
func NewMultilineState() *MultilineState
NewMultilineState creates a new multiline state
func (*MultilineState) AddLine ¶
func (m *MultilineState) AddLine(line string) (complete bool, prompt string)
AddLine adds a line to the multiline buffer and checks if more input is needed
IMPORTANT: This method expects individual lines without embedded newlines. In real shell usage, users type one line at a time, and the shell determines whether more input is needed based on syntax analysis.
For here-documents, the usage pattern is: 1. User types: cat <<EOF 2. Shell shows: > (continuation prompt) 3. User types: content line 4. Shell shows: > (continuation prompt) 5. User types: EOF 6. Command completes
func (*MultilineState) GetAccumulatedLines ¶
func (m *MultilineState) GetAccumulatedLines() string
GetAccumulatedLines returns the accumulated lines for display purposes
func (*MultilineState) GetCompleteCommand ¶
func (m *MultilineState) GetCompleteCommand() string
GetCompleteCommand returns the complete command and resets the state
func (*MultilineState) GetLines ¶
func (m *MultilineState) GetLines() []string
GetLines returns the individual lines that have been entered
func (*MultilineState) IsActive ¶
func (m *MultilineState) IsActive() bool
IsActive returns true if we're in the middle of a multiline input
type NoopExplainer ¶
type NoopExplainer struct{}
type NoopPredictionAnalytics ¶
type NoopPredictionAnalytics struct{}
type NoopPredictor ¶
type NoopPredictor struct{}
type Options ¶
type Options struct {
// Deprecated: use AssistantHeight instead
MinHeight int
AssistantHeight int
CompletionProvider shellinput.CompletionProvider
RichHistory []shellinput.HistoryItem
CurrentDirectory string
CurrentSessionID string
User string
Host string
// InitialValue is the initial text to populate in the input field.
// Used for features like editing a suggested fix before execution.
InitialValue string
// IdleSummaryTimeout is the number of seconds of idle time before generating a summary.
// Set to 0 to disable idle summaries.
IdleSummaryTimeout int
// IdleSummaryGenerator is called when the user is idle to generate a summary
IdleSummaryGenerator IdleSummaryGenerator
// ResourceUpdateInterval is the interval in seconds between resource (CPU/RAM) updates.
// Higher values reduce energy consumption. Default is 5 seconds.
// Set to 0 to disable resource monitoring.
ResourceUpdateInterval int
}
func NewOptions ¶
func NewOptions() Options
type PredictionAnalytics ¶
type ShellCompletionProvider ¶
type ShellCompletionProvider struct {
CompletionManager *completion.CompletionManager
Runner *interp.Runner
}
ShellCompletionProvider implements shellinput.CompletionProvider using the shell's CompletionManager
func (*ShellCompletionProvider) GetCompletions ¶
func (p *ShellCompletionProvider) GetCompletions(line string, pos int) []shellinput.CompletionCandidate
GetCompletions returns completion suggestions for the current input line
func (*ShellCompletionProvider) GetHelpInfo ¶
func (p *ShellCompletionProvider) GetHelpInfo(line string, pos int) string
GetHelpInfo returns help information for special commands like #! and #/ Returns empty string if no help is available