Documentation
¶
Index ¶
- Variables
- type AgentHandler
- func (h *AgentHandler) HandleRequest(ctx context.Context, parsed parser.ParseResult) (agent.Response, error)
- func (h *AgentHandler) SetClipboard(buf *clipboard.Buffer)
- func (h *AgentHandler) SetSelectedContext(ctx *hashcontext.Collection)
- func (h *AgentHandler) StreamRequest(ctx context.Context, parsed parser.ParseResult) (<-chan string, <-chan error)
- type AgentState
- type ClipboardBuffer
- type CommandSuggestor
- type ConfirmAction
- type ConfirmationType
- type ErrorHandler
- func (h *ErrorHandler) FormatErrorPrompt(exitCode int, stderr string) string
- func (h *ErrorHandler) GetSuggestion(command, stderr string, exitCode int) string
- func (h *ErrorHandler) HandleCommandNotFound(cmd string, suggestions []string, installHint string)
- func (h *ErrorHandler) HandleError(command, stderr string, exitCode int)
- func (h *ErrorHandler) RecordFixAttempt(command, stderr string, exitCode int, fix string, success bool)
- type Mode
- type ResponseUI
- func (u *ResponseUI) ClearLine()
- func (u *ResponseUI) ClearLines(n int)
- func (u *ResponseUI) ClearThinking()
- func (u *ResponseUI) ShowAgentHint(transport, command, url string)
- func (u *ResponseUI) ShowConfirmation(ct ConfirmationType)
- func (u *ResponseUI) ShowError(errMsg string)
- func (u *ResponseUI) ShowResponse(resp agent.Response)
- func (u *ResponseUI) ShowState(state AgentState)
- func (u *ResponseUI) ShowStateWithSize(state AgentState, sizeBytes int)
- func (u *ResponseUI) ShowStreamedResponse(text string, isCommand bool)
- func (u *ResponseUI) ShowThinking(model string)deprecated
- func (u *ResponseUI) ShowThinkingInline(model string)deprecated
- func (u *ResponseUI) StartProgress()
- func (u *ResponseUI) StopProgress()
- func (u *ResponseUI) StopSpinner()
- func (u *ResponseUI) WaitForConfirmation() ConfirmAction
- func (u *ResponseUI) WaitForConfirmationByType(ct ConfirmationType) ConfirmAction
- type Shell
- type SystemStatus
- type Welcome
Constants ¶
This section is empty.
Variables ¶
var ErrEditorCanceled = errors.New("editor canceled")
ErrEditorCanceled is returned when the editor is canceled (Ctrl+C).
var ErrEditorEOF = errors.New("editor EOF")
ErrEditorEOF is returned when the editor receives EOF (Ctrl+D).
Functions ¶
This section is empty.
Types ¶
type AgentHandler ¶
type AgentHandler struct {
// contains filtered or unexported fields
}
AgentHandler handles agent requests.
func NewAgentHandler ¶
func NewAgentHandler(client *agent.Client) *AgentHandler
NewAgentHandler creates a new agent handler.
func (*AgentHandler) HandleRequest ¶
func (h *AgentHandler) HandleRequest(ctx context.Context, parsed parser.ParseResult) (agent.Response, error)
HandleRequest processes a parsed agent request and returns the response.
func (*AgentHandler) SetClipboard ¶
func (h *AgentHandler) SetClipboard(buf *clipboard.Buffer)
SetClipboard sets the clipboard buffer for context.
func (*AgentHandler) SetSelectedContext ¶
func (h *AgentHandler) SetSelectedContext(ctx *hashcontext.Collection)
SetSelectedContext sets the user-selected context.
func (*AgentHandler) StreamRequest ¶
func (h *AgentHandler) StreamRequest(ctx context.Context, parsed parser.ParseResult) (<-chan string, <-chan error)
StreamRequest processes a parsed agent request and returns streaming channels. Text chunks arrive on the text channel, errors on the error channel.
type AgentState ¶
type AgentState int
AgentState represents the current state of an agent request.
const ( AgentStateConnecting AgentState = iota AgentStateSending AgentStateThinking AgentStateReceiving )
func (AgentState) String ¶
func (s AgentState) String() string
type ClipboardBuffer ¶
ClipboardBuffer is a type alias for easier external access.
type CommandSuggestor ¶
type CommandSuggestor struct {
// contains filtered or unexported fields
}
CommandSuggestor finds similar commands for typos.
func NewCommandSuggestor ¶
func NewCommandSuggestor(historyStore *history.Store) *CommandSuggestor
NewCommandSuggestor creates a new suggestor and starts PATH caching in background.
func (*CommandSuggestor) InstallHint ¶
func (s *CommandSuggestor) InstallHint(cmd string) string
InstallHint returns install instructions if known, empty otherwise.
func (*CommandSuggestor) Suggest ¶
func (s *CommandSuggestor) Suggest(cmd string) []string
Suggest returns up to 3 similar command names.
type ConfirmAction ¶
type ConfirmAction int
ConfirmAction represents the user's response to a command suggestion.
const ( ConfirmRun ConfirmAction = iota // User pressed Enter - run the command ConfirmEdit // User pressed Tab - edit the command ConfirmCancel // User pressed Esc - cancel )
type ConfirmationType ¶
type ConfirmationType int
ConfirmationType determines which confirmation options to show.
const ( ConfirmTypeCommand ConfirmationType = iota // [Enter: run] [Tab: edit] [Esc: cancel] ConfirmTypeExplanation // [Enter: ok] [Tab: copy] [Esc: cancel] ConfirmTypeError // [Enter: retry] [Esc: cancel] )
type ErrorHandler ¶
type ErrorHandler struct {
// contains filtered or unexported fields
}
ErrorHandler manages error detection and fix suggestions.
func NewErrorHandler ¶
func NewErrorHandler(store *learning.FixStore) *ErrorHandler
NewErrorHandler creates a new error handler.
func (*ErrorHandler) FormatErrorPrompt ¶
func (h *ErrorHandler) FormatErrorPrompt(exitCode int, stderr string) string
FormatErrorPrompt formats an error prompt string.
func (*ErrorHandler) GetSuggestion ¶
func (h *ErrorHandler) GetSuggestion(command, stderr string, exitCode int) string
GetSuggestion returns a fix suggestion for the given error, or empty string.
func (*ErrorHandler) HandleCommandNotFound ¶
func (h *ErrorHandler) HandleCommandNotFound(cmd string, suggestions []string, installHint string)
HandleCommandNotFound displays a command-not-found error with suggestions.
func (*ErrorHandler) HandleError ¶
func (h *ErrorHandler) HandleError(command, stderr string, exitCode int)
HandleError processes a command error and suggests fixes.
func (*ErrorHandler) RecordFixAttempt ¶
func (h *ErrorHandler) RecordFixAttempt(command, stderr string, exitCode int, fix string, success bool)
RecordFixAttempt records whether a suggested fix worked.
type Mode ¶
type Mode struct {
Login bool // Login shell (sources profile files)
Interactive bool // Interactive shell (has TTY)
}
Mode represents the shell's startup mode.
type ResponseUI ¶
type ResponseUI struct {
// contains filtered or unexported fields
}
ResponseUI handles displaying agent responses.
func NewResponseUI ¶
func NewResponseUI(out io.Writer) *ResponseUI
NewResponseUI creates a new response UI.
func (*ResponseUI) ClearLine ¶
func (u *ResponseUI) ClearLine()
ClearLine clears the current line (for replacing thinking with response).
func (*ResponseUI) ClearLines ¶
func (u *ResponseUI) ClearLines(n int)
ClearLines moves cursor up n lines and clears each one. Used to remove streamed response when user cancels.
func (*ResponseUI) ClearThinking ¶
func (u *ResponseUI) ClearThinking()
ClearThinking clears the thinking indicator.
func (*ResponseUI) ShowAgentHint ¶
func (u *ResponseUI) ShowAgentHint(transport, command, url string)
ShowAgentHint displays troubleshooting hints for agent connection failures.
func (*ResponseUI) ShowConfirmation ¶
func (u *ResponseUI) ShowConfirmation(ct ConfirmationType)
ShowConfirmation displays the compact confirmation UI below the response.
func (*ResponseUI) ShowError ¶
func (u *ResponseUI) ShowError(errMsg string)
ShowError displays an error message in the response area.
func (*ResponseUI) ShowResponse ¶
func (u *ResponseUI) ShowResponse(resp agent.Response)
ShowResponse displays an agent response.
func (*ResponseUI) ShowState ¶
func (u *ResponseUI) ShowState(state AgentState)
ShowState displays the current agent state with animated spinner. If a spinner is already running, it updates the text. If no spinner is running, it starts one.
func (*ResponseUI) ShowStateWithSize ¶
func (u *ResponseUI) ShowStateWithSize(state AgentState, sizeBytes int)
ShowStateWithSize displays state with context size info.
func (*ResponseUI) ShowStreamedResponse ¶
func (u *ResponseUI) ShowStreamedResponse(text string, isCommand bool)
ShowStreamedResponse displays a streamed response with dim styling. The response appears tentative until confirmed.
func (*ResponseUI) ShowThinking
deprecated
func (u *ResponseUI) ShowThinking(model string)
ShowThinking displays a thinking indicator with optional model name.
Deprecated: Use ShowState(AgentStateThinking) instead for consistent styling.
func (*ResponseUI) ShowThinkingInline
deprecated
func (u *ResponseUI) ShowThinkingInline(model string)
ShowThinkingInline displays thinking indicator (for streaming modes).
Deprecated: Use ShowState(AgentStateThinking) instead for consistent styling.
func (*ResponseUI) StartProgress ¶
func (u *ResponseUI) StartProgress()
StartProgress starts the OSC 9;4 progress bar without showing text.
func (*ResponseUI) StopProgress ¶
func (u *ResponseUI) StopProgress()
StopProgress stops the OSC 9;4 progress bar.
func (*ResponseUI) StopSpinner ¶
func (u *ResponseUI) StopSpinner()
StopSpinner stops the animated spinner if running and waits for it to exit.
func (*ResponseUI) WaitForConfirmation ¶
func (u *ResponseUI) WaitForConfirmation() ConfirmAction
WaitForConfirmation waits for user to press Enter, Tab, or Esc.
func (*ResponseUI) WaitForConfirmationByType ¶
func (u *ResponseUI) WaitForConfirmationByType(ct ConfirmationType) ConfirmAction
WaitForConfirmationByType waits for confirmation based on response type. Returns ConfirmAction appropriate for the confirmation type.
type Shell ¶
type Shell struct {
// contains filtered or unexported fields
}
Shell is the main Hash shell instance.
func NewWithMode ¶
NewWithMode creates a new Shell instance with explicit mode.
type SystemStatus ¶
type SystemStatus struct {
Version string
// Prompt
PromptMode string
PromptOK bool
PromptErr string
// History
HistoryPath string
HistoryOK bool
HistoryErr string
HistoryCount int64
// Learning
LearningOK bool
LearningErr string
PatternCount int64
// Agent
AgentName string
AgentOK bool
AgentErr string
// PTY
PTYOK bool
PTYErr string
// Clipboard
ClipboardOK bool
ClipboardErr string
}
SystemStatus holds the current status of all shell subsystems.
func (*SystemStatus) Format ¶
func (s *SystemStatus) Format() string
Format returns a formatted status display.
type Welcome ¶
type Welcome struct {
// contains filtered or unexported fields
}
Welcome handles first-run welcome message.
func NewWelcome ¶
NewWelcome creates a new Welcome handler.
func (*Welcome) ShouldShow ¶
ShouldShow returns true if welcome message should be displayed.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package integration provides terminal integration escape sequences.
|
Package integration provides terminal integration escape sequences. |