Documentation
¶
Index ¶
- type Store
- func (sm *Store) AddQueuedMessage(message sdk.Message, requestID string)
- func (sm *Store) AreAllAgentsReady() bool
- func (sm *Store) BroadcastEvent(event agentdomain.ChatEvent)
- func (sm *Store) ClearAgentReadiness()
- func (sm *Store) ClearApprovalUIState()
- func (sm *Store) ClearComputerUsePauseState()
- func (sm *Store) ClearLastClickCoordinates()
- func (sm *Store) ClearLastFocusedApp()
- func (sm *Store) ClearMessageEditState()
- func (sm *Store) ClearPlanApprovalUIState()
- func (sm *Store) ClearQueuedMessages()
- func (sm *Store) ClearUserQuestionUIState()
- func (sm *Store) CompleteCurrentTool(result *agentdomain.ToolExecutionResult) error
- func (sm *Store) CycleAgentMode() agentdomain.AgentMode
- func (sm *Store) EndChatSession()
- func (sm *Store) EndToolExecution()
- func (sm *Store) FailCurrentTool(result *agentdomain.ToolExecutionResult) error
- func (sm *Store) GetAgentMode() agentdomain.AgentMode
- func (sm *Store) GetAgentReadiness() *tui.AgentReadinessState
- func (sm *Store) GetApprovalUIState() *tui.ApprovalUIState
- func (sm *Store) GetChatSession() *tui.ChatSession
- func (sm *Store) GetCurrentView() tui.ViewState
- func (sm *Store) GetDimensions() (int, int)
- func (sm *Store) GetEventBridge() agentdomain.EventBridge
- func (sm *Store) GetLastClickCoordinates() (x, y int)
- func (sm *Store) GetLastFocusedApp() string
- func (sm *Store) GetMessageEditState() *tui.MessageEditState
- func (sm *Store) GetPausedRequestID() string
- func (sm *Store) GetPlanApprovalUIState() *tui.PlanApprovalUIState
- func (sm *Store) GetPreviousView() tui.ViewState
- func (sm *Store) GetQueuedMessages() []convdomain.QueuedMessage
- func (sm *Store) GetRetryStatus() *agentdomain.RetryStatus
- func (sm *Store) GetTodos() []agentdomain.TodoItem
- func (sm *Store) GetToolExecution() *tui.ToolExecutionSession
- func (sm *Store) GetUserQuestionUIState() *tui.UserQuestionUIState
- func (sm *Store) InitializeAgentReadiness(totalAgents int)
- func (sm *Store) IsAgentBusy() bool
- func (sm *Store) IsComputerUsePaused() bool
- func (sm *Store) IsDebugMode() bool
- func (sm *Store) IsEditingMessage() bool
- func (sm *Store) PopQueuedMessage() *convdomain.QueuedMessage
- func (sm *Store) RecoverFromInconsistentState() error
- func (sm *Store) RemoveAgent(name string)
- func (sm *Store) SetAgentError(name string, err error)
- func (sm *Store) SetAgentMode(mode agentdomain.AgentMode)
- func (sm *Store) SetChatPending()
- func (sm *Store) SetComputerUsePaused(paused bool, requestID string)
- func (sm *Store) SetDebugMode(enabled bool)
- func (sm *Store) SetDimensions(width, height int)
- func (sm *Store) SetEventBridge(bridge agentdomain.EventBridge)
- func (sm *Store) SetLastClickCoordinates(x, y int)
- func (sm *Store) SetLastFocusedApp(appID string)
- func (sm *Store) SetMessageEditState(state *tui.MessageEditState)
- func (sm *Store) SetPlanApprovalSelectedIndex(index int)
- func (sm *Store) SetRetryStatus(status *agentdomain.RetryStatus)
- func (sm *Store) SetStallThreshold(threshold time.Duration)
- func (sm *Store) SetTodos(todos []agentdomain.TodoItem)
- func (sm *Store) SetupApprovalUIState(toolCall *sdk.ChatCompletionMessageToolCall, ...)
- func (sm *Store) SetupPlanApprovalUIState(planContent, planID string, responseChan chan agentdomain.PlanApprovalAction)
- func (sm *Store) SetupUserQuestionUIState(questions []agentdomain.UserQuestion, ...)
- func (sm *Store) StartChatSession(requestID, model string, eventChan <-chan agentdomain.ChatEvent) error
- func (sm *Store) StartToolExecution(toolCalls []sdk.ChatCompletionMessageToolCall) error
- func (sm *Store) TouchChatActivity()
- func (sm *Store) TransitionToView(newView tui.ViewState) error
- func (sm *Store) UpdateAgentPullProgress(name string, done, total int)
- func (sm *Store) UpdateAgentStatus(name string, state agentdomain.AgentState, message string, url string, ...)
- func (sm *Store) UpdateChatStatus(status tui.ChatStatus) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Store ¶ added in v0.207.0
type Store struct {
// contains filtered or unexported fields
}
Store provides centralized state management with proper synchronization
func (*Store) AddQueuedMessage ¶ added in v0.207.0
AddQueuedMessage adds a message to the input queue
func (*Store) AreAllAgentsReady ¶ added in v0.207.0
AreAllAgentsReady returns true if all agents are ready
func (*Store) BroadcastEvent ¶ added in v0.207.0
func (sm *Store) BroadcastEvent(event agentdomain.ChatEvent)
BroadcastEvent publishes an event to the EventBridge for external consumers
func (*Store) ClearAgentReadiness ¶ added in v0.207.0
func (sm *Store) ClearAgentReadiness()
ClearAgentReadiness clears the agent readiness state
func (*Store) ClearApprovalUIState ¶ added in v0.207.0
func (sm *Store) ClearApprovalUIState()
ClearApprovalUIState clears the approval UI state
func (*Store) ClearComputerUsePauseState ¶ added in v0.207.0
func (sm *Store) ClearComputerUsePauseState()
ClearComputerUsePauseState clears the pause state
func (*Store) ClearLastClickCoordinates ¶ added in v0.207.0
func (sm *Store) ClearLastClickCoordinates()
ClearLastClickCoordinates clears the stored click coordinates
func (*Store) ClearLastFocusedApp ¶ added in v0.207.0
func (sm *Store) ClearLastFocusedApp()
ClearLastFocusedApp clears the stored focused app
func (*Store) ClearMessageEditState ¶ added in v0.207.0
func (sm *Store) ClearMessageEditState()
ClearMessageEditState clears the message edit state
func (*Store) ClearPlanApprovalUIState ¶ added in v0.207.0
func (sm *Store) ClearPlanApprovalUIState()
ClearPlanApprovalUIState clears the plan approval UI state
func (*Store) ClearQueuedMessages ¶ added in v0.207.0
func (sm *Store) ClearQueuedMessages()
ClearQueuedMessages clears all queued messages
func (*Store) ClearUserQuestionUIState ¶ added in v0.207.0
func (sm *Store) ClearUserQuestionUIState()
ClearUserQuestionUIState clears the AskUserQuestion form state
func (*Store) CompleteCurrentTool ¶ added in v0.207.0
func (sm *Store) CompleteCurrentTool(result *agentdomain.ToolExecutionResult) error
CompleteCurrentTool marks the current tool as completed
func (*Store) CycleAgentMode ¶ added in v0.207.0
func (sm *Store) CycleAgentMode() agentdomain.AgentMode
CycleAgentMode cycles to the next agent mode
func (*Store) EndChatSession ¶ added in v0.207.0
func (sm *Store) EndChatSession()
EndChatSession ends the current chat session
func (*Store) EndToolExecution ¶ added in v0.207.0
func (sm *Store) EndToolExecution()
EndToolExecution ends the current tool execution session
func (*Store) FailCurrentTool ¶ added in v0.207.0
func (sm *Store) FailCurrentTool(result *agentdomain.ToolExecutionResult) error
FailCurrentTool marks the current tool as failed
func (*Store) GetAgentMode ¶ added in v0.207.0
func (sm *Store) GetAgentMode() agentdomain.AgentMode
GetAgentMode returns the current agent mode
func (*Store) GetAgentReadiness ¶ added in v0.207.0
func (sm *Store) GetAgentReadiness() *tui.AgentReadinessState
GetAgentReadiness returns the current agent readiness state
func (*Store) GetApprovalUIState ¶ added in v0.207.0
func (sm *Store) GetApprovalUIState() *tui.ApprovalUIState
GetApprovalUIState returns the current approval UI state
func (*Store) GetChatSession ¶ added in v0.207.0
func (sm *Store) GetChatSession() *tui.ChatSession
GetChatSession returns the current chat session (read-only)
func (*Store) GetCurrentView ¶ added in v0.207.0
GetCurrentView returns the current view state
func (*Store) GetDimensions ¶ added in v0.207.0
GetDimensions returns the current UI dimensions
func (*Store) GetEventBridge ¶ added in v0.207.0
func (sm *Store) GetEventBridge() agentdomain.EventBridge
GetEventBridge returns the event bridge for control event forwarding
func (*Store) GetLastClickCoordinates ¶ added in v0.207.0
GetLastClickCoordinates returns the coordinates of the last click
func (*Store) GetLastFocusedApp ¶ added in v0.207.0
GetLastFocusedApp returns the application ID of the last focused application
func (*Store) GetMessageEditState ¶ added in v0.207.0
func (sm *Store) GetMessageEditState() *tui.MessageEditState
GetMessageEditState returns the current message edit state
func (*Store) GetPausedRequestID ¶ added in v0.207.0
GetPausedRequestID returns the request ID of the paused execution
func (*Store) GetPlanApprovalUIState ¶ added in v0.207.0
func (sm *Store) GetPlanApprovalUIState() *tui.PlanApprovalUIState
GetPlanApprovalUIState returns the current plan approval UI state
func (*Store) GetPreviousView ¶ added in v0.207.0
GetPreviousView returns the previous view state
func (*Store) GetQueuedMessages ¶ added in v0.207.0
func (sm *Store) GetQueuedMessages() []convdomain.QueuedMessage
GetQueuedMessages returns the current queued messages
func (*Store) GetRetryStatus ¶ added in v0.207.0
func (sm *Store) GetRetryStatus() *agentdomain.RetryStatus
GetRetryStatus returns a copy of the current retry status, or nil when the connection is healthy. Besides explicit reconnect attempts (set by the agent's reconnect loop), it synthesizes a zero-attempt status when a streaming session has produced no chunks for stallThreshold - the render tick calls this on every frame, so a stalled connection surfaces without any timer of its own. A synthesized status has Attempt == 0. Terminal sessions never report a status, so a stale explicit retry can't outlive the turn it belonged to (the input field is disabled while this returns non-nil).
func (*Store) GetTodos ¶ added in v0.207.0
func (sm *Store) GetTodos() []agentdomain.TodoItem
GetTodos returns the current todo list
func (*Store) GetToolExecution ¶ added in v0.207.0
func (sm *Store) GetToolExecution() *tui.ToolExecutionSession
GetToolExecution returns the current tool execution session (read-only)
func (*Store) GetUserQuestionUIState ¶ added in v0.207.0
func (sm *Store) GetUserQuestionUIState() *tui.UserQuestionUIState
GetUserQuestionUIState returns the current AskUserQuestion form state
func (*Store) InitializeAgentReadiness ¶ added in v0.207.0
InitializeAgentReadiness initializes the agent readiness tracking
func (*Store) IsAgentBusy ¶ added in v0.207.0
IsAgentBusy returns true if the agent is currently processing a request
func (*Store) IsComputerUsePaused ¶ added in v0.207.0
IsComputerUsePaused returns whether computer use is currently paused
func (*Store) IsDebugMode ¶ added in v0.207.0
IsDebugMode returns whether debug mode is enabled
func (*Store) IsEditingMessage ¶ added in v0.207.0
IsEditingMessage returns true if currently editing a message
func (*Store) PopQueuedMessage ¶ added in v0.207.0
func (sm *Store) PopQueuedMessage() *convdomain.QueuedMessage
PopQueuedMessage removes and returns the first message from the queue (FIFO order)
func (*Store) RecoverFromInconsistentState ¶ added in v0.207.0
RecoverFromInconsistentState attempts to recover from an inconsistent state
func (*Store) RemoveAgent ¶ added in v0.207.0
RemoveAgent removes an agent from the readiness tracking
func (*Store) SetAgentError ¶ added in v0.207.0
SetAgentError sets an error for a specific agent
func (*Store) SetAgentMode ¶ added in v0.207.0
func (sm *Store) SetAgentMode(mode agentdomain.AgentMode)
SetAgentMode sets the agent mode
func (*Store) SetChatPending ¶ added in v0.207.0
func (sm *Store) SetChatPending()
SetChatPending marks the agent as busy before the chat actually starts. This prevents race conditions where messages might not be queued between the time we decide to start a chat and when StartChatSession is called.
Promotes to "pending" if there is no existing chat session OR if the existing session is in a terminal status (Completed/Error/Cancelled/Idle). Terminal sessions are leftovers from a prior chat that hasn't been GC'd yet; treating them as "in progress" would make IsAgentBusy() return false here but true for a subsequent caller that just won the SetChatPending race, which is exactly the window the chat-mode async rollover relies on for queueing.
func (*Store) SetComputerUsePaused ¶ added in v0.207.0
SetComputerUsePaused sets the paused state for computer use
func (*Store) SetDebugMode ¶ added in v0.207.0
SetDebugMode enables or disables debug mode
func (*Store) SetDimensions ¶ added in v0.207.0
SetDimensions updates the UI dimensions
func (*Store) SetEventBridge ¶ added in v0.207.0
func (sm *Store) SetEventBridge(bridge agentdomain.EventBridge)
SetEventBridge sets the event bridge for multicasting events to external consumers
func (*Store) SetLastClickCoordinates ¶ added in v0.207.0
SetLastClickCoordinates stores the coordinates of the last click
func (*Store) SetLastFocusedApp ¶ added in v0.207.0
SetLastFocusedApp stores the application ID of the last focused application
func (*Store) SetMessageEditState ¶ added in v0.207.0
func (sm *Store) SetMessageEditState(state *tui.MessageEditState)
SetMessageEditState sets the message edit state
func (*Store) SetPlanApprovalSelectedIndex ¶ added in v0.207.0
SetPlanApprovalSelectedIndex sets the plan approval selection index
func (*Store) SetRetryStatus ¶ added in v0.207.0
func (sm *Store) SetRetryStatus(status *agentdomain.RetryStatus)
SetRetryStatus updates the retry status on the current chat session. Called by the agent's reconnect loop to provide visual feedback in the status bar while it is reconnecting after a failure.
func (*Store) SetStallThreshold ¶ added in v0.207.0
SetStallThreshold sets how long a streaming session may go without chunks before GetRetryStatus reports it as reconnecting. Zero or negative disables stall detection.
func (*Store) SetTodos ¶ added in v0.207.0
func (sm *Store) SetTodos(todos []agentdomain.TodoItem)
SetTodos sets the todo list
func (*Store) SetupApprovalUIState ¶ added in v0.207.0
func (sm *Store) SetupApprovalUIState(toolCall *sdk.ChatCompletionMessageToolCall, responseChan chan agentdomain.ApprovalAction)
SetupApprovalUIState initializes approval UI state
func (*Store) SetupPlanApprovalUIState ¶ added in v0.207.0
func (sm *Store) SetupPlanApprovalUIState(planContent, planID string, responseChan chan agentdomain.PlanApprovalAction)
SetupPlanApprovalUIState initializes plan approval UI state
func (*Store) SetupUserQuestionUIState ¶ added in v0.207.0
func (sm *Store) SetupUserQuestionUIState(questions []agentdomain.UserQuestion, responseChan chan []agentdomain.UserQuestionAnswer)
SetupUserQuestionUIState initializes the AskUserQuestion form state
func (*Store) StartChatSession ¶ added in v0.207.0
func (sm *Store) StartChatSession(requestID, model string, eventChan <-chan agentdomain.ChatEvent) error
StartChatSession starts a new chat session
func (*Store) StartToolExecution ¶ added in v0.207.0
func (sm *Store) StartToolExecution(toolCalls []sdk.ChatCompletionMessageToolCall) error
StartToolExecution starts a new tool execution session
func (*Store) TouchChatActivity ¶ added in v0.207.0
func (sm *Store) TouchChatActivity()
TouchChatActivity records stream output on the current session, clearing any retry status and resetting the stall clock.
func (*Store) TransitionToView ¶ added in v0.207.0
TransitionToView transitions to a new view with validation and logging
func (*Store) UpdateAgentPullProgress ¶ added in v0.207.0
UpdateAgentPullProgress updates the image pull layer counts for a specific agent
func (*Store) UpdateAgentStatus ¶ added in v0.207.0
func (sm *Store) UpdateAgentStatus(name string, state agentdomain.AgentState, message string, url string, image string)
UpdateAgentStatus updates the status of a specific agent
func (*Store) UpdateChatStatus ¶ added in v0.207.0
func (sm *Store) UpdateChatStatus(status tui.ChatStatus) error
UpdateChatStatus updates the chat session status with validation