Documentation
¶
Index ¶
- func CalculateConversationHeight(totalHeight int) int
- func CalculateInputHeight(totalHeight int) int
- func CalculateStatusHeight(totalHeight int) int
- type A2ATaskCoordinator
- type AgentReadinessState
- type AgentStatus
- type AgentStatusUpdateEvent
- type ApplicationState
- func (s *ApplicationState) AddQueuedMessage(message sdk.Message, requestID string)
- func (s *ApplicationState) AreAllAgentsReady() bool
- func (s *ApplicationState) ClearAgentReadiness()
- func (s *ApplicationState) ClearApprovalUIState()
- func (s *ApplicationState) ClearComputerUsePauseState()
- func (s *ApplicationState) ClearFileSelectionState()
- func (s *ApplicationState) ClearLastClickCoordinates()
- func (s *ApplicationState) ClearLastFocusedApp()
- func (s *ApplicationState) ClearMessageEditState()
- func (s *ApplicationState) ClearPlanApprovalUIState()
- func (s *ApplicationState) ClearQueuedMessages()
- func (s *ApplicationState) ClearUserQuestionUIState()
- func (s *ApplicationState) CompleteCurrentTool(result *agentdomain.ToolExecutionResult) error
- func (s *ApplicationState) CycleAgentMode() agentdomain.AgentMode
- func (s *ApplicationState) EndChatSession()
- func (s *ApplicationState) EndToolExecution()
- func (s *ApplicationState) FailCurrentTool(result *agentdomain.ToolExecutionResult) error
- func (s *ApplicationState) GetAgentMode() agentdomain.AgentMode
- func (s *ApplicationState) GetAgentReadiness() *AgentReadinessState
- func (s *ApplicationState) GetApprovalUIState() *agentdomain.ApprovalUIState
- func (s *ApplicationState) GetChatSession() *agentdomain.ChatSession
- func (s *ApplicationState) GetCurrentView() ViewState
- func (s *ApplicationState) GetDimensions() (int, int)
- func (s *ApplicationState) GetFileSelectionState() *FileSelectionState
- func (s *ApplicationState) GetLastClickCoordinates() (x, y int)
- func (s *ApplicationState) GetLastFocusedApp() string
- func (s *ApplicationState) GetMessageEditState() *MessageEditState
- func (s *ApplicationState) GetPausedRequestID() string
- func (s *ApplicationState) GetPlanApprovalUIState() *agentdomain.PlanApprovalUIState
- func (s *ApplicationState) GetPreviousView() ViewState
- func (s *ApplicationState) GetQueuedMessages() []convdomain.QueuedMessage
- func (s *ApplicationState) GetRetryStatus() *agentdomain.RetryStatus
- func (s *ApplicationState) GetTodos() []agentdomain.TodoItem
- func (s *ApplicationState) GetToolExecution() *agentdomain.ToolExecutionSession
- func (s *ApplicationState) GetUserQuestionUIState() *agentdomain.UserQuestionUIState
- func (s *ApplicationState) InitializeAgentReadiness(totalAgents int)
- func (s *ApplicationState) IsComputerUsePaused() bool
- func (s *ApplicationState) IsDebugMode() bool
- func (s *ApplicationState) IsEditingMessage() bool
- func (s *ApplicationState) PopQueuedMessage() *convdomain.QueuedMessage
- func (s *ApplicationState) RemoveAgent(name string)
- func (s *ApplicationState) SetAgentError(name string, err error)
- func (s *ApplicationState) SetAgentMode(mode agentdomain.AgentMode)
- func (s *ApplicationState) SetChatPending()
- func (s *ApplicationState) SetComputerUsePaused(paused bool, requestID string)
- func (s *ApplicationState) SetDebugMode(enabled bool)
- func (s *ApplicationState) SetDimensions(width, height int)
- func (s *ApplicationState) SetFileSelectedIndex(index int)
- func (s *ApplicationState) SetLastClickCoordinates(x, y int)
- func (s *ApplicationState) SetLastFocusedApp(appID string)
- func (s *ApplicationState) SetMessageEditState(state *MessageEditState)
- func (s *ApplicationState) SetPlanApprovalSelectedIndex(index int)
- func (s *ApplicationState) SetRetryStatus(status *agentdomain.RetryStatus)
- func (s *ApplicationState) SetTodos(todos []agentdomain.TodoItem)
- func (s *ApplicationState) SetupApprovalUIState(toolCall *sdk.ChatCompletionMessageToolCall, ...)
- func (s *ApplicationState) SetupFileSelection(files []string)
- func (s *ApplicationState) SetupPlanApprovalUIState(planContent, planID string, responseChan chan agentdomain.PlanApprovalAction)
- func (s *ApplicationState) SetupUserQuestionUIState(questions []agentdomain.UserQuestion, ...)
- func (s *ApplicationState) StartChatSession(requestID, model string, eventChan <-chan agentdomain.ChatEvent)
- func (s *ApplicationState) StartToolExecution(tools []agentdomain.ToolCall)
- func (s *ApplicationState) TouchChatActivity()
- func (s *ApplicationState) TransitionToView(newView ViewState) error
- func (s *ApplicationState) UpdateAgentPullProgress(name string, done, total int)
- func (s *ApplicationState) UpdateAgentStatus(name string, state agentdomain.AgentState, message string, url string, ...)
- func (s *ApplicationState) UpdateChatStatus(status agentdomain.ChatStatus) error
- func (s *ApplicationState) UpdateFileSearchQuery(query string)
- type ApprovalCoordinator
- type AutocompleteCompleteEvent
- type AutocompleteComponent
- type AutocompleteHideEvent
- type AutocompleteUpdateEvent
- type BashCommandCompletedEvent
- type ChatCompletionRunner
- type ChatEventListener
- type ChatHandler
- type ClearErrorEvent
- type ClearInputEvent
- type ConversationRenderer
- type ConversationSelectedEvent
- type ConversationsLoadedEvent
- type DebugKeyEvent
- type DefaultTheme
- func (t *DefaultTheme) GetAccentColor() string
- func (t *DefaultTheme) GetAssistantColor() string
- func (t *DefaultTheme) GetBorderColor() string
- func (t *DefaultTheme) GetDiffAddColor() string
- func (t *DefaultTheme) GetDiffRemoveColor() string
- func (t *DefaultTheme) GetDimColor() string
- func (t *DefaultTheme) GetErrorColor() string
- func (t *DefaultTheme) GetStatusColor() string
- func (t *DefaultTheme) GetSuccessColor() string
- func (t *DefaultTheme) GetUserColor() string
- type DirectExecutionService
- type DrainQueueRetryEvent
- type FileSelectionRequestEvent
- type FileSelectionState
- type FocusStatusBarEvent
- type GitPRResolvedEvent
- type HelpBarComponent
- type HideHelpBarEvent
- type InputComponent
- type InputStatusBarComponent
- type KeyShortcut
- type MessageEditState
- type MessageHistoryEditEvent
- type MessageHistoryEditReadyEvent
- type MessageHistoryReadyEvent
- type MessageSnapshot
- type ModelSelectedEvent
- type PlanApprovalResponseEvent
- type PlanApprovalSelectionChangedEvent
- type RestoreStatusStateEvent
- type RolloverCompletedEvent
- type SaveStatusStateEvent
- type ScrollDirection
- type ScrollRequestEvent
- type SetInputEvent
- type SetStatusEvent
- type SetupFileSelectionEvent
- type ShowErrorEvent
- type StatusComponent
- type StatusIndicatorAction
- type StatusProgress
- type StatusType
- type StreamingContentEvent
- type TaskCancelledEvent
- type TasksLoadedEvent
- type Theme
- type ThemeSelectedEvent
- type ThemeService
- type TodoUpdateEvent
- type ToggleHelpBarEvent
- type ToggleTodoBoxEvent
- type ToolExecutionCoordinator
- type ToolExecutionStartedEvent
- type TriggerGithubActionSetupEvent
- type TriggerHelpViewEvent
- type UpdateHistoryEvent
- type UpdateStatusEvent
- type VersionInfo
- type ViewManager
- type ViewState
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CalculateConversationHeight ¶
Layout calculation utilities
func CalculateInputHeight ¶
func CalculateStatusHeight ¶
Types ¶
type A2ATaskCoordinator ¶
type A2ATaskCoordinator interface {
HandleTaskSubmitted(msg agentdomain.A2ATaskSubmittedEvent) tea.Cmd
HandleTaskCompleted(msg agentdomain.A2ATaskCompletedEvent) tea.Cmd
HandleTaskFailed(msg agentdomain.A2ATaskFailedEvent) tea.Cmd
HandleTaskStatusUpdate(msg agentdomain.A2ATaskStatusUpdateEvent) tea.Cmd
HandleTaskInputRequired(msg agentdomain.A2ATaskInputRequiredEvent) tea.Cmd
HandleToolCallExecuted(msg agentdomain.A2AToolCallExecutedEvent) tea.Cmd
}
A2ATaskCoordinator owns the UI side of A2A (agent-to-agent) task lifecycle events. It translates the six A2A event types into status updates, streaming-content events, and conversation-history refreshes, and keeps the chat session listener pumping. Self-contained - depends only on the conversation repo, task retention, the chat state manager, and a chat event listener.
type AgentReadinessState ¶
type AgentReadinessState struct {
TotalAgents int `json:"total_agents"`
ReadyAgents int `json:"ready_agents"`
Agents map[string]*AgentStatus `json:"agents"`
StartTime time.Time `json:"start_time"`
}
AgentReadinessState represents the current state of A2A agents during startup
type AgentStatus ¶
type AgentStatus struct {
Name string `json:"name"`
URL string `json:"url"`
Image string `json:"image"`
State agentdomain.AgentState `json:"state"`
Message string `json:"message,omitempty"`
StartTime time.Time `json:"start_time"`
Error string `json:"error,omitempty"`
LayersDone int `json:"layers_done,omitempty"`
LayersTotal int `json:"layers_total,omitempty"`
}
AgentStatus represents the status of an individual A2A agent
type AgentStatusUpdateEvent ¶
type AgentStatusUpdateEvent struct {
AgentName string
State agentdomain.AgentState
Message string
URL string
Image string
}
AgentStatusUpdateEvent indicates an agent's status has changed
type ApplicationState ¶
type ApplicationState struct {
// contains filtered or unexported fields
}
ApplicationState represents the overall application state with proper typing
func NewApplicationState ¶
func NewApplicationState() *ApplicationState
NewApplicationState creates a new application state
func (*ApplicationState) AddQueuedMessage ¶
func (s *ApplicationState) AddQueuedMessage(message sdk.Message, requestID string)
AddQueuedMessage adds a message to the input queue
func (*ApplicationState) AreAllAgentsReady ¶
func (s *ApplicationState) AreAllAgentsReady() bool
AreAllAgentsReady returns true if all agents are ready
func (*ApplicationState) ClearAgentReadiness ¶
func (s *ApplicationState) ClearAgentReadiness()
ClearAgentReadiness clears the agent readiness state
func (*ApplicationState) ClearApprovalUIState ¶
func (s *ApplicationState) ClearApprovalUIState()
ClearApprovalUIState clears the approval UI state
func (*ApplicationState) ClearComputerUsePauseState ¶
func (s *ApplicationState) ClearComputerUsePauseState()
ClearComputerUsePauseState clears the pause state
func (*ApplicationState) ClearFileSelectionState ¶
func (s *ApplicationState) ClearFileSelectionState()
ClearFileSelectionState clears the file selection state
func (*ApplicationState) ClearLastClickCoordinates ¶
func (s *ApplicationState) ClearLastClickCoordinates()
ClearLastClickCoordinates clears the stored click coordinates
func (*ApplicationState) ClearLastFocusedApp ¶
func (s *ApplicationState) ClearLastFocusedApp()
ClearLastFocusedApp clears the stored focused app
func (*ApplicationState) ClearMessageEditState ¶
func (s *ApplicationState) ClearMessageEditState()
ClearMessageEditState clears the message edit state
func (*ApplicationState) ClearPlanApprovalUIState ¶
func (s *ApplicationState) ClearPlanApprovalUIState()
ClearPlanApprovalUIState clears the plan approval UI state
func (*ApplicationState) ClearQueuedMessages ¶
func (s *ApplicationState) ClearQueuedMessages()
ClearQueuedMessages clears all queued messages
func (*ApplicationState) ClearUserQuestionUIState ¶
func (s *ApplicationState) ClearUserQuestionUIState()
ClearUserQuestionUIState clears the AskUserQuestion form state and closes the response channel (without a prior send this signals cancellation to the blocked tool). Nil-safe and idempotent.
func (*ApplicationState) CompleteCurrentTool ¶
func (s *ApplicationState) CompleteCurrentTool(result *agentdomain.ToolExecutionResult) error
CompleteCurrentTool marks the current tool as completed and moves to next
func (*ApplicationState) CycleAgentMode ¶
func (s *ApplicationState) CycleAgentMode() agentdomain.AgentMode
CycleAgentMode cycles to the next agent mode. The human shift+tab cycle is deliberately three-way (Standard -> Plan -> AutoAccept); AgentModeReadOnly is a subagent-only capability set by the Agent tool's `type` parameter, not a mode a user can toggle their own chat into.
func (*ApplicationState) EndChatSession ¶
func (s *ApplicationState) EndChatSession()
EndChatSession cleans up the chat session
func (*ApplicationState) EndToolExecution ¶
func (s *ApplicationState) EndToolExecution()
EndToolExecution cleans up the tool execution session
func (*ApplicationState) FailCurrentTool ¶
func (s *ApplicationState) FailCurrentTool(result *agentdomain.ToolExecutionResult) error
FailCurrentTool marks the current tool as failed and moves to next
func (*ApplicationState) GetAgentMode ¶
func (s *ApplicationState) GetAgentMode() agentdomain.AgentMode
GetAgentMode returns the current agent mode
func (*ApplicationState) GetAgentReadiness ¶
func (s *ApplicationState) GetAgentReadiness() *AgentReadinessState
GetAgentReadiness returns the current agent readiness state
func (*ApplicationState) GetApprovalUIState ¶
func (s *ApplicationState) GetApprovalUIState() *agentdomain.ApprovalUIState
GetApprovalUIState returns the current approval UI state
func (*ApplicationState) GetChatSession ¶
func (s *ApplicationState) GetChatSession() *agentdomain.ChatSession
GetChatSession returns the current chat session
func (*ApplicationState) GetCurrentView ¶
func (s *ApplicationState) GetCurrentView() ViewState
GetCurrentView returns the current view state
func (*ApplicationState) GetDimensions ¶
func (s *ApplicationState) GetDimensions() (int, int)
GetDimensions returns the current UI dimensions
func (*ApplicationState) GetFileSelectionState ¶
func (s *ApplicationState) GetFileSelectionState() *FileSelectionState
GetFileSelectionState returns the current file selection state
func (*ApplicationState) GetLastClickCoordinates ¶
func (s *ApplicationState) GetLastClickCoordinates() (x, y int)
GetLastClickCoordinates returns the coordinates of the last click
func (*ApplicationState) GetLastFocusedApp ¶
func (s *ApplicationState) GetLastFocusedApp() string
GetLastFocusedApp returns the application ID of the last focused application
func (*ApplicationState) GetMessageEditState ¶
func (s *ApplicationState) GetMessageEditState() *MessageEditState
GetMessageEditState returns the current message edit state
func (*ApplicationState) GetPausedRequestID ¶
func (s *ApplicationState) GetPausedRequestID() string
GetPausedRequestID returns the request ID of the paused execution
func (*ApplicationState) GetPlanApprovalUIState ¶
func (s *ApplicationState) GetPlanApprovalUIState() *agentdomain.PlanApprovalUIState
GetPlanApprovalUIState returns the current plan approval UI state
func (*ApplicationState) GetPreviousView ¶
func (s *ApplicationState) GetPreviousView() ViewState
GetPreviousView returns the previous view state
func (*ApplicationState) GetQueuedMessages ¶
func (s *ApplicationState) GetQueuedMessages() []convdomain.QueuedMessage
GetQueuedMessages returns the current queued messages
func (*ApplicationState) GetRetryStatus ¶
func (s *ApplicationState) GetRetryStatus() *agentdomain.RetryStatus
GetRetryStatus returns a copy of the current retry status, or nil when no retry is in progress. Returning a copy keeps callers from sharing the mutable pointer with the agent's streaming goroutine.
func (*ApplicationState) GetTodos ¶
func (s *ApplicationState) GetTodos() []agentdomain.TodoItem
GetTodos returns the current todo list
func (*ApplicationState) GetToolExecution ¶
func (s *ApplicationState) GetToolExecution() *agentdomain.ToolExecutionSession
GetToolExecution returns the current tool execution session
func (*ApplicationState) GetUserQuestionUIState ¶
func (s *ApplicationState) GetUserQuestionUIState() *agentdomain.UserQuestionUIState
GetUserQuestionUIState returns the current AskUserQuestion form state, or nil.
func (*ApplicationState) InitializeAgentReadiness ¶
func (s *ApplicationState) InitializeAgentReadiness(totalAgents int)
InitializeAgentReadiness initializes the agent readiness tracking
func (*ApplicationState) IsComputerUsePaused ¶
func (s *ApplicationState) IsComputerUsePaused() bool
IsComputerUsePaused returns whether computer use is currently paused
func (*ApplicationState) IsDebugMode ¶
func (s *ApplicationState) IsDebugMode() bool
IsDebugMode returns whether debug mode is enabled
func (*ApplicationState) IsEditingMessage ¶
func (s *ApplicationState) IsEditingMessage() bool
IsEditingMessage returns true if currently editing a message
func (*ApplicationState) PopQueuedMessage ¶
func (s *ApplicationState) PopQueuedMessage() *convdomain.QueuedMessage
PopQueuedMessage removes and returns the first message from the queue (FIFO)
func (*ApplicationState) RemoveAgent ¶
func (s *ApplicationState) RemoveAgent(name string)
RemoveAgent removes an agent from the readiness tracking
func (*ApplicationState) SetAgentError ¶
func (s *ApplicationState) SetAgentError(name string, err error)
SetAgentError sets an error for a specific agent
func (*ApplicationState) SetAgentMode ¶
func (s *ApplicationState) SetAgentMode(mode agentdomain.AgentMode)
SetAgentMode sets the agent mode
func (*ApplicationState) SetChatPending ¶
func (s *ApplicationState) SetChatPending()
SetChatPending creates a minimal chat session to mark the agent as busy before the actual chat starts. This prevents race conditions.
func (*ApplicationState) SetComputerUsePaused ¶
func (s *ApplicationState) SetComputerUsePaused(paused bool, requestID string)
SetComputerUsePaused sets the paused state for computer use
func (*ApplicationState) SetDebugMode ¶
func (s *ApplicationState) SetDebugMode(enabled bool)
SetDebugMode enables or disables debug mode
func (*ApplicationState) SetDimensions ¶
func (s *ApplicationState) SetDimensions(width, height int)
SetDimensions updates the UI dimensions
func (*ApplicationState) SetFileSelectedIndex ¶
func (s *ApplicationState) SetFileSelectedIndex(index int)
SetFileSelectedIndex sets the selected file index
func (*ApplicationState) SetLastClickCoordinates ¶
func (s *ApplicationState) SetLastClickCoordinates(x, y int)
SetLastClickCoordinates stores the coordinates of the last click
func (*ApplicationState) SetLastFocusedApp ¶
func (s *ApplicationState) SetLastFocusedApp(appID string)
SetLastFocusedApp stores the application ID of the last focused application This is used to restore focus before keyboard operations
func (*ApplicationState) SetMessageEditState ¶
func (s *ApplicationState) SetMessageEditState(state *MessageEditState)
SetMessageEditState sets the message edit state
func (*ApplicationState) SetPlanApprovalSelectedIndex ¶
func (s *ApplicationState) SetPlanApprovalSelectedIndex(index int)
SetPlanApprovalSelectedIndex sets the plan approval selection index
func (*ApplicationState) SetRetryStatus ¶
func (s *ApplicationState) SetRetryStatus(status *agentdomain.RetryStatus)
SetRetryStatus updates the retry status on the current chat session
func (*ApplicationState) SetTodos ¶
func (s *ApplicationState) SetTodos(todos []agentdomain.TodoItem)
SetTodos sets the todo list
func (*ApplicationState) SetupApprovalUIState ¶
func (s *ApplicationState) SetupApprovalUIState(toolCall *sdk.ChatCompletionMessageToolCall, responseChan chan agentdomain.ApprovalAction)
SetupApprovalUIState initializes approval UI state with the pending tool call
func (*ApplicationState) SetupFileSelection ¶
func (s *ApplicationState) SetupFileSelection(files []string)
SetupFileSelection initializes file selection state
func (*ApplicationState) SetupPlanApprovalUIState ¶
func (s *ApplicationState) SetupPlanApprovalUIState(planContent, planID string, responseChan chan agentdomain.PlanApprovalAction)
SetupPlanApprovalUIState initializes plan approval UI state
func (*ApplicationState) SetupUserQuestionUIState ¶
func (s *ApplicationState) SetupUserQuestionUIState(questions []agentdomain.UserQuestion, responseChan chan []agentdomain.UserQuestionAnswer)
SetupUserQuestionUIState initializes the AskUserQuestion form state for the given questions.
func (*ApplicationState) StartChatSession ¶
func (s *ApplicationState) StartChatSession(requestID, model string, eventChan <-chan agentdomain.ChatEvent)
StartChatSession initializes a new chat session
func (*ApplicationState) StartToolExecution ¶
func (s *ApplicationState) StartToolExecution(tools []agentdomain.ToolCall)
StartToolExecution initializes a new tool execution session
func (*ApplicationState) TouchChatActivity ¶
func (s *ApplicationState) TouchChatActivity()
TouchChatActivity records that the stream produced output: it bumps the session's LastActivity and clears any retry status, since receiving a chunk means the connection is healthy again.
func (*ApplicationState) TransitionToView ¶
func (s *ApplicationState) TransitionToView(newView ViewState) error
TransitionToView changes the current view with validation
func (*ApplicationState) UpdateAgentPullProgress ¶
func (s *ApplicationState) UpdateAgentPullProgress(name string, done, total int)
UpdateAgentPullProgress updates the image pull layer counts for a specific agent
func (*ApplicationState) UpdateAgentStatus ¶
func (s *ApplicationState) UpdateAgentStatus(name string, state agentdomain.AgentState, message string, url string, image string)
UpdateAgentStatus updates the status of a specific agent
func (*ApplicationState) UpdateChatStatus ¶
func (s *ApplicationState) UpdateChatStatus(status agentdomain.ChatStatus) error
UpdateChatStatus updates the chat session status
func (*ApplicationState) UpdateFileSearchQuery ¶
func (s *ApplicationState) UpdateFileSearchQuery(query string)
UpdateFileSearchQuery updates the file search query
type ApprovalCoordinator ¶
type ApprovalCoordinator interface {
HandlePlanApprovalRequested(msg agentdomain.PlanApprovalRequestedEvent) tea.Cmd
HandlePlanApprovalResponse(msg PlanApprovalResponseEvent) (cmd tea.Cmd, restart bool)
HandleUserQuestionRequested(msg agentdomain.UserQuestionRequestedEvent) tea.Cmd
HandleComputerUsePaused(msg agentdomain.ComputerUsePausedEvent) tea.Cmd
HandleComputerUseResumed(msg agentdomain.ComputerUseResumedEvent) (cmd tea.Cmd, restart bool)
}
ApprovalCoordinator owns the "pause the assistant turn pending external decision" family of events: plan approval (the agent stops, presents a plan, awaits user accept/reject) and computer-use pause/resume (the user hits a key to interrupt computer-use execution and later resumes).
Response handlers return a restart bool so the orchestrator can fire ChatCompletionRunner.Start() after the cmds without ApprovalCoordinator having to depend on the runner.
type AutocompleteCompleteEvent ¶
AutocompleteCompleteEvent is fired when a completion is selected
type AutocompleteComponent ¶
type AutocompleteComponent interface {
Update(inputText string, cursorPos int)
HandleKey(key tea.KeyPressMsg) (bool, string)
IsVisible() bool
SetWidth(width int)
SetHeight(height int)
Render() string
GetSelectedShortcut() string
GetCompletionCursorPos() int
Hide()
RefreshToolsList()
GetUsageHint() string
ClearUsageHint()
}
AutocompleteComponent defines the interface for autocomplete functionality
type AutocompleteHideEvent ¶
type AutocompleteHideEvent struct{}
AutocompleteHideEvent is fired when autocomplete should be hidden
type AutocompleteUpdateEvent ¶
AutocompleteUpdateEvent is fired when input text changes and autocomplete should update
type BashCommandCompletedEvent ¶
type BashCommandCompletedEvent struct {
History []convdomain.ConversationEntry
Failed bool
UserInitiated bool
ErrorMessage string
}
BashCommandCompletedEvent indicates a direct bash command (! prefix) has completed
type ChatCompletionRunner ¶
type ChatCompletionRunner interface {
Start(holder agentdomain.BashDetachChannelHolder) tea.Cmd
HandleChatStart(msg agentdomain.ChatStartEvent) tea.Cmd
HandleChatChunk(msg agentdomain.ChatChunkEvent) tea.Cmd
HandleChatComplete(msg agentdomain.ChatCompleteEvent) tea.Cmd
HandleChatError(msg agentdomain.ChatErrorEvent) tea.Cmd
HandleOptimizationStatus(msg agentdomain.OptimizationStatusEvent) tea.Cmd
SetPendingRestoration(originalModel string)
}
ChatCompletionRunner owns the LLM streaming lifecycle - initiating streaming, translating chat-start / chat-chunk / chat-complete / chat-error events into UI state transitions, and handling the model-restoration side effect after a temporary /model switch.
Start takes a BashDetachChannelHolder because the agent core needs that narrow interface attached to its context when launching tools that may require backgrounding. In #529 commit 3 that holder is the orchestrator itself; in commit 4 it becomes the DirectExecutionService.
type ChatEventListener ¶
type ChatEventListener interface {
ListenForChatEvents(eventChan <-chan agentdomain.ChatEvent) tea.Cmd
ListenForEvents(eventChan <-chan tea.Msg) tea.Cmd
}
ChatEventListener wraps the small "read one message off a channel as a tea.Cmd" pattern used throughout the handlers. Extracted so services can chain channel reads back into the Bubble Tea event loop without each one re-implementing the same closure.
type ChatHandler ¶
type ChatHandler interface {
// Core event handling (to be deprecated as we move to component-based handling)
Handle(msg tea.Msg) tea.Cmd
// Specific event handlers
HandleUserInputEvent(msg agentdomain.UserInputEvent) tea.Cmd
HandleFileSelectionRequestEvent(msg FileSelectionRequestEvent) tea.Cmd
HandleConversationSelectedEvent(msg ConversationSelectedEvent) tea.Cmd
HandleToolApprovalRequestedEvent(msg agentdomain.ToolApprovalRequestedEvent) tea.Cmd
HandleToolApprovalResponseEvent(msg agentdomain.ToolApprovalResponseEvent) tea.Cmd
HandlePlanApprovalRequestedEvent(msg agentdomain.PlanApprovalRequestedEvent) tea.Cmd
HandlePlanApprovalResponseEvent(msg PlanApprovalResponseEvent) tea.Cmd
// Command handlers
HandleCommand(commandText string) tea.Cmd
HandleBashCommand(commandText string) tea.Cmd
HandleToolCommand(commandText string) tea.Cmd
HandleBackgroundShellRequest() tea.Cmd
// Event channel listeners
ListenForEvents(eventChan <-chan tea.Msg) tea.Cmd
ListenForChatEvents(eventChan <-chan agentdomain.ChatEvent) tea.Cmd
// State management
GetActiveToolCallID() string
SetActiveToolCallID(id string)
// Utility methods
ParseToolCall(input string) (string, map[string]any, error)
ParseArguments(argsStr string) (map[string]any, error)
SetBashDetachChan(chan<- struct{})
GetBashDetachChan() chan<- struct{}
ClearBashDetachChan()
}
ChatHandler defines the interface for the chat handler This interface enables testing handlers in isolation and provides a clear contract
type ConversationRenderer ¶
type ConversationRenderer interface {
SetConversation([]convdomain.ConversationEntry)
GetScrollOffset() int
CanScrollUp() bool
CanScrollDown() bool
ToggleToolResultExpansion(index int)
ToggleAllToolResultsExpansion()
IsToolResultExpanded(index int) bool
ToggleAllThinkingExpansion()
IsThinkingExpanded(index int) bool
ToggleRawFormat()
IsRawFormat() bool
ResetUserScroll()
SetWidth(width int)
SetHeight(height int)
Render() string
}
ConversationRenderer interface for conversation display
type ConversationSelectedEvent ¶
type ConversationSelectedEvent struct {
ConversationID string
}
ConversationSelectedEvent indicates conversation selection
type ConversationsLoadedEvent ¶
ConversationsLoadedEvent indicates conversations have been loaded
type DebugKeyEvent ¶
DebugKeyEvent provides debug information about key presses
type DefaultTheme ¶
type DefaultTheme struct{}
DefaultTheme provides a concrete implementation of the Theme interface
func NewDefaultTheme ¶
func NewDefaultTheme() *DefaultTheme
func (*DefaultTheme) GetAccentColor ¶
func (t *DefaultTheme) GetAccentColor() string
func (*DefaultTheme) GetAssistantColor ¶
func (t *DefaultTheme) GetAssistantColor() string
func (*DefaultTheme) GetBorderColor ¶
func (t *DefaultTheme) GetBorderColor() string
func (*DefaultTheme) GetDiffAddColor ¶
func (t *DefaultTheme) GetDiffAddColor() string
func (*DefaultTheme) GetDiffRemoveColor ¶
func (t *DefaultTheme) GetDiffRemoveColor() string
func (*DefaultTheme) GetDimColor ¶
func (t *DefaultTheme) GetDimColor() string
func (*DefaultTheme) GetErrorColor ¶
func (t *DefaultTheme) GetErrorColor() string
func (*DefaultTheme) GetStatusColor ¶
func (t *DefaultTheme) GetStatusColor() string
func (*DefaultTheme) GetSuccessColor ¶
func (t *DefaultTheme) GetSuccessColor() string
func (*DefaultTheme) GetUserColor ¶
func (t *DefaultTheme) GetUserColor() string
type DirectExecutionService ¶
type DirectExecutionService interface {
agentdomain.BashDetachChannelHolder
HandleBashCommand(commandText string) tea.Cmd
HandleToolCommand(commandText string) tea.Cmd
HandleBackgroundShellRequest() tea.Cmd
HandleBashOutputChunk(msg agentdomain.BashOutputChunkEvent) tea.Cmd
HandleBashCommandCompleted(msg BashCommandCompletedEvent) tea.Cmd
ParseToolCall(input string) (string, map[string]any, error)
ParseArguments(argsStr string) (map[string]any, error)
PendingBashChannel() <-chan tea.Msg
PendingToolChannel() <-chan tea.Msg
}
DirectExecutionService owns user-typed `!command` (bash) and `!!Tool(...)` (tool) execution. It synthesizes the conversation entries, spawns the async goroutines, owns the per-call event/detach channels, and exposes the channels via PendingBashChannel / PendingToolChannel so the ToolExecutionCoordinator can keep pumping them.
Implements BashDetachChannelHolder so the agent core can find it on the request context (see WithChatHandler / GetChatHandler in context_helpers.go).
type DrainQueueRetryEvent ¶
type DrainQueueRetryEvent struct{}
DrainQueueRetryEvent is the bounded retry behind DrainQueueEvent, and is NOT a clock. A DrainQueueEvent can land while the agent is momentarily busy (e.g. a background job finishes in the same instant the turn is still completing); the gate drops it, so without a retry the queue would strand. HandleDrainQueueEvent arms a single DrainQueueRetryEvent in that case, and the drainRetryArmed guard keeps it to exactly one outstanding timer no matter how many DrainQueueEvents arrived. When it fires, HandleDrainQueueRetryEvent re-runs the gate, which re-arms only while work is still stranded and stops the moment the queue drains.
type FileSelectionRequestEvent ¶
type FileSelectionRequestEvent struct{}
FileSelectionRequestEvent requests file selection UI
type FileSelectionState ¶
type FileSelectionState struct {
Files []string `json:"files"`
SearchQuery string `json:"search_query"`
SelectedIndex int `json:"selected_index"`
}
FileSelectionState represents the state of file selection UI
type FocusStatusBarEvent ¶
type FocusStatusBarEvent struct{}
FocusStatusBarEvent moves keyboard focus to the status-indicator row below the input, fired when arrow-down would otherwise be a no-op
type GitPRResolvedEvent ¶
type GitPRResolvedEvent struct {
PR string
}
GitPRResolvedEvent carries the PR number for the current branch, resolved asynchronously by the input view's fetch command. An empty PR means no PR exists (or gh is unavailable). Defined here rather than as a component-local msg because the chat application only routes domain-prefixed messages to UI components.
type HelpBarComponent ¶
type HelpBarComponent interface {
SetShortcuts(shortcuts []key.Binding)
IsEnabled() bool
SetEnabled(enabled bool)
SetWidth(width int)
SetHeight(height int)
Render() string
}
HelpBarComponent interface for help bar
type HideHelpBarEvent ¶
type HideHelpBarEvent struct{}
HideHelpBarEvent hides the help bar when typing other characters
type InputComponent ¶
type InputComponent interface {
GetInput() string
ClearInput()
SetPlaceholder(text string)
GetCursor() int
SetCursor(position int)
SetText(text string)
SetWidth(width int)
SetHeight(height int)
Render() string
HandleKey(key tea.KeyPressMsg) (tea.Model, tea.Cmd)
CanHandle(key tea.KeyPressMsg) bool
AddImageAttachment(image agentdomain.ImageAttachment)
GetImageAttachments() []agentdomain.ImageAttachment
ClearImageAttachments()
AddToHistory(text string) error
SetUsageHint(hint string)
GetUsageHint() string
IsDisabled() bool
}
InputComponent interface for input handling
type InputStatusBarComponent ¶
type InputStatusBarComponent interface {
SetWidth(width int)
SetHeight(height int)
SetInputText(text string)
UpdateMCPStatus(status *agentdomain.MCPServerStatus)
Focus() bool
Blur()
IsFocused() bool
SelectNext()
SelectPrev()
SelectedAction() StatusIndicatorAction
Render() string
}
InputStatusBarComponent interface for input status bar
type KeyShortcut ¶
KeyShortcut represents a keyboard shortcut with description
type MessageEditState ¶
type MessageEditState struct {
OriginalMessageIndex int `json:"original_message_index"`
}
MessageEditState represents the state when editing a message
type MessageHistoryEditEvent ¶
type MessageHistoryEditEvent struct {
RequestID string
Timestamp time.Time
MessageIndex int
MessageContent string
MessageSnapshot MessageSnapshot
}
MessageHistoryEditEvent is emitted when user wants to edit a selected message
func (MessageHistoryEditEvent) GetRequestID ¶
func (e MessageHistoryEditEvent) GetRequestID() string
func (MessageHistoryEditEvent) GetTimestamp ¶
func (e MessageHistoryEditEvent) GetTimestamp() time.Time
type MessageHistoryEditReadyEvent ¶
type MessageHistoryEditReadyEvent struct {
MessageIndex int
Content string
Snapshot MessageSnapshot
}
MessageHistoryEditReadyEvent indicates editing is ready to begin
type MessageHistoryReadyEvent ¶
type MessageHistoryReadyEvent struct {
Messages []MessageSnapshot
}
MessageHistoryReadyEvent indicates message history has been loaded and is ready to display
type MessageSnapshot ¶
type MessageSnapshot struct {
Index int `json:"index"`
Role sdk.MessageRole `json:"role"`
Content string `json:"content"`
Timestamp time.Time `json:"timestamp"`
}
MessageSnapshot represents a snapshot of a message for the history view
type ModelSelectedEvent ¶
type ModelSelectedEvent struct {
Model string
}
ModelSelectedEvent indicates model selection
type PlanApprovalResponseEvent ¶
type PlanApprovalResponseEvent struct {
Action agentdomain.PlanApprovalAction
}
PlanApprovalResponseEvent captures the user's plan approval decision
type PlanApprovalSelectionChangedEvent ¶
type PlanApprovalSelectionChangedEvent struct {
NewIndex int
}
PlanApprovalSelectionChangedEvent signals that the plan-approval button selection has moved and the conversation viewport needs to re-render so the highlighted button reflects the new index.
type RestoreStatusStateEvent ¶
type RestoreStatusStateEvent struct{}
RestoreStatusStateEvent restores a previously saved status state
type RolloverCompletedEvent ¶
type RolloverCompletedEvent struct {
Message sdk.Message
Images []agentdomain.ImageAttachment
}
RolloverCompletedEvent is dispatched when an asynchronous auto-rollover finishes in chat mode. It carries the already-built sdk.Message + images that were pending while the summary LLM call was in flight, so the post-rollover handler can resume the deferred AddMessage + start-chat completion flow without re-parsing user input.
type SaveStatusStateEvent ¶
type SaveStatusStateEvent struct{}
SaveStatusStateEvent saves the current status state for later restoration
type ScrollDirection ¶
type ScrollDirection int
ScrollDirection represents different scroll directions
const ( ScrollUp ScrollDirection = iota ScrollDown ScrollLeft ScrollRight ScrollToTop ScrollToBottom )
type ScrollRequestEvent ¶
type ScrollRequestEvent struct {
ComponentID string
Direction ScrollDirection
Amount int
}
ScrollRequestEvent requests scrolling in a component
type SetInputEvent ¶
type SetInputEvent struct {
Text string
}
SetInputEvent sets text in the input field
type SetStatusEvent ¶
type SetStatusEvent struct {
Message string
Spinner bool
StatusType StatusType
Progress *StatusProgress
ToolName string
}
SetStatusEvent sets a status message
type SetupFileSelectionEvent ¶
type SetupFileSelectionEvent struct {
Files []string
}
SetupFileSelectionEvent sets up file selection state with files
type ShowErrorEvent ¶
ShowErrorEvent displays an error message
type StatusComponent ¶
type StatusComponent interface {
ShowStatus(message string)
ShowError(message string)
ShowSpinner(message string)
ClearStatus()
IsShowingError() bool
IsShowingSpinner() bool
SetWidth(width int)
SetHeight(height int)
Render() string
SaveCurrentState()
RestoreSavedState() tea.Cmd
HasSavedState() bool
}
StatusComponent interface for status display
type StatusIndicatorAction ¶
type StatusIndicatorAction int
StatusIndicatorAction identifies the view a status-bar indicator opens when activated; indicators without a view map to StatusIndicatorActionNone
const ( StatusIndicatorActionNone StatusIndicatorAction = iota StatusIndicatorActionModelSelection StatusIndicatorActionTaskManagement StatusIndicatorActionThemeSelection StatusIndicatorActionToolsList StatusIndicatorActionA2AAgents )
type StatusProgress ¶
StatusProgress represents progress information for status messages
type StatusType ¶
type StatusType int
StatusType represents different types of status messages
const ( StatusDefault StatusType = iota StatusThinking StatusGenerating StatusWorking StatusProcessing StatusPreparing StatusError )
type StreamingContentEvent ¶
type StreamingContentEvent struct {
RequestID string
Content string
ReasoningContent string
Delta bool
Model string
}
StreamingContentEvent delivers live streaming content for immediate UI display
type TaskCancelledEvent ¶
TaskCancelledEvent indicates a task has been cancelled
type TasksLoadedEvent ¶
TasksLoadedEvent indicates tasks have been loaded
type Theme ¶
type Theme interface {
GetUserColor() string
GetAssistantColor() string
GetErrorColor() string
GetSuccessColor() string
GetStatusColor() string
GetAccentColor() string
GetDimColor() string
GetBorderColor() string
GetDiffAddColor() string
GetDiffRemoveColor() string
}
Theme interface for UI theming
type ThemeSelectedEvent ¶
type ThemeSelectedEvent struct {
Theme string
}
ThemeSelectedEvent indicates theme selection
type ThemeService ¶
type ThemeService interface {
ListThemes() []string
GetCurrentTheme() Theme
GetCurrentThemeName() string
SetTheme(themeName string) error
}
ThemeService handles theme management
type TodoUpdateEvent ¶
type TodoUpdateEvent struct {
Todos []agentdomain.TodoItem
}
TodoUpdateEvent indicates the todo list has been updated
type ToggleHelpBarEvent ¶
type ToggleHelpBarEvent struct{}
ToggleHelpBarEvent toggles the help bar visibility
type ToggleTodoBoxEvent ¶
type ToggleTodoBoxEvent struct{}
ToggleTodoBoxEvent toggles the todo box expanded/collapsed state
type ToolExecutionCoordinator ¶
type ToolExecutionCoordinator interface {
GetActiveToolCallID() string
SetActiveToolCallID(id string)
HandleToolCallUpdate(msg agentdomain.ToolCallUpdateEvent) tea.Cmd
HandleToolCallReady(msg agentdomain.ToolCallReadyEvent) tea.Cmd
HandleToolApprovalRequested(msg agentdomain.ToolApprovalRequestedEvent) tea.Cmd
HandleToolApprovalResponse(msg agentdomain.ToolApprovalResponseEvent) tea.Cmd
HandleToolExecutionStarted(msg ToolExecutionStartedEvent) tea.Cmd
HandleToolExecutionProgress(msg agentdomain.ToolExecutionProgressEvent) tea.Cmd
HandleToolExecutionCompleted(msg agentdomain.ToolExecutionCompletedEvent) tea.Cmd
HandleToolCancelled(msg agentdomain.ToolCancelledEvent) tea.Cmd
}
ToolExecutionCoordinator owns the tool round-trip: streaming-status updates emitted while the model is producing a tool call, approval coordination (forwarding the user's decision back to the agent), and execution-progress events while the tool runs. Also owns the active-tool-call indicator the UI uses to render the in-flight tool name.
type ToolExecutionStartedEvent ¶
ToolExecutionStartedEvent indicates tool execution has started
type TriggerGithubActionSetupEvent ¶
type TriggerGithubActionSetupEvent struct{}
TriggerGithubActionSetupEvent triggers the GitHub App setup flow
type TriggerHelpViewEvent ¶
type TriggerHelpViewEvent struct{}
TriggerHelpViewEvent opens the full-screen, scrollable help overlay that lists every slash command and keybinding in two tables.
type UpdateHistoryEvent ¶
type UpdateHistoryEvent struct {
History []convdomain.ConversationEntry
}
UpdateHistoryEvent updates the conversation history display
type UpdateStatusEvent ¶
type UpdateStatusEvent struct {
Message string
StatusType StatusType
ToolName string
}
UpdateStatusEvent updates an existing status message without resetting timer
type VersionInfo ¶
type VersionInfo struct {
Version string
}
VersionInfo contains build-time version information
type ViewManager ¶
type ViewManager interface {
GetCurrentView() ViewState
GetPreviousView() ViewState
TransitionToView(newView ViewState) error
}
ViewManager handles view state transitions
type ViewState ¶
type ViewState int
ViewState represents the current view with proper state management
const ( ViewStateModelSelection ViewState = iota ViewStateChat ViewStateFileSelection ViewStateConversationSelection ViewStateThemeSelection ViewStateA2ATaskManagement ViewStatePlanApproval ViewStateGithubActionSetup ViewStateDiffViewer ViewStateExplorer ViewStateHelp ViewStateToolsList ViewStateA2AAgents )
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
diffview
Package diffview renders unified or side-by-side file diffs to a string of ANSI-styled output, using go-udiff for the underlying diff algorithm and chroma for in-line syntax highlighting.
|
Package diffview renders unified or side-by-side file diffs to a string of ANSI-styled output, using go-udiff for the underlying diff algorithm and chroma for in-line syntax highlighting. |
|
Package directexec owns the UI side of user-typed direct-execution commands: `!command` (bash) and `!!Tool(...)` (tool).
|
Package directexec owns the UI side of user-typed direct-execution commands: `!command` (bash) and `!!Tool(...)` (tool). |
|
Package gitdiff is a small, focused data layer behind the `/diff` changes panel.
|
Package gitdiff is a small, focused data layer behind the `/diff` changes panel. |
|
Package inputsyntax highlights reserved tokens in the chat input field.
|
Package inputsyntax highlights reserved tokens in the chat input field. |
|
Package toolcoordinator owns the UI side of the tool round-trip - the streaming-status events emitted while the model is producing a tool call, the approval handshake that forwards the user's accept/reject back to the agent, and the execution-progress events while the tool runs.
|
Package toolcoordinator owns the UI side of the tool round-trip - the streaming-status events emitted while the model is producing a tool call, the approval handshake that forwards the user's accept/reject back to the agent, and the execution-progress events while the tool runs. |