Documentation
¶
Index ¶
- Constants
- Variables
- func NewFileService() agentdomain.FileService
- func ProcessAlive(pid int) bool
- func PruneClipboardImages(dir string)
- type A2AAgentService
- type AgentManager
- func (am *AgentManager) GetAllAgentNames() []string
- func (am *AgentManager) GetExternalAgentURL(agentName string) string
- func (am *AgentManager) GetTotalAgentCount() int
- func (am *AgentManager) IsExternalAgent(agentName string) bool
- func (am *AgentManager) IsRunning() bool
- func (am *AgentManager) SetPullProgressCallback(callback func(agentName string, done, total int))
- func (am *AgentManager) SetStatusCallback(...)
- func (am *AgentManager) StartAgent(ctx context.Context, agent config.AgentEntry) error
- func (am *AgentManager) StartAgents(ctx context.Context) error
- func (am *AgentManager) StopAgent(ctx context.Context, agentName string) error
- func (am *AgentManager) StopAgents(ctx context.Context) error
- func (am *AgentManager) WaitForAgentsReady(ctx context.Context)
- type ChannelManagerService
- func (cm *ChannelManagerService) GetChannel(name string) chn.Channel
- func (cm *ChannelManagerService) Register(ch chn.Channel)
- func (cm *ChannelManagerService) SetCommandSupport(reg *shortcuts.Registry, conv storage.ConversationStorage, ...)
- func (cm *ChannelManagerService) Start(ctx context.Context) error
- func (cm *ChannelManagerService) Stop() error
- type DirectoryFrameSource
- type FileServiceImpl
- func (s *FileServiceImpl) GetFileInfo(path string) (agentdomain.FileInfo, error)
- func (s *FileServiceImpl) ListProjectFiles() ([]string, error)
- func (s *FileServiceImpl) ReadFile(path string) (string, error)
- func (s *FileServiceImpl) ReadFileLines(path string, startLine, endLine int) (string, error)
- func (s *FileServiceImpl) ValidateFile(path string) error
- type GatewayManager
- type HintProvider
- type ImageService
- func (s *ImageService) CreateDataURL(attachment *agentdomain.ImageAttachment) string
- func (s *ImageService) CreateImageVariation(ctx context.Context, model, imagePath, size string) (string, error)
- func (s *ImageService) EditImage(ctx context.Context, model, prompt, imagePath, quality, size, maskPath string) (string, error)
- func (s *ImageService) GenerateImage(ctx context.Context, model, prompt, quality, size string) (string, error)
- func (s *ImageService) IsImageFile(filePath string) bool
- func (s *ImageService) IsImageModel(model string) bool
- func (s *ImageService) IsImageURL(urlStr string) bool
- func (s *ImageService) ReadImageFromBinary(imageData []byte, filename string) (*agentdomain.ImageAttachment, error)
- func (s *ImageService) ReadImageFromFile(filePath string) (*agentdomain.ImageAttachment, error)
- func (s *ImageService) ReadImageFromURL(imageURL string) (*agentdomain.ImageAttachment, error)
- type LLMToolService
- func (s *LLMToolService) ExecuteTool(ctx context.Context, toolCall sdk.ChatCompletionMessageToolCallFunction) (*agentdomain.ToolExecutionResult, error)
- func (s *LLMToolService) ExecuteToolDirect(ctx context.Context, toolCall sdk.ChatCompletionMessageToolCallFunction) (*agentdomain.ToolExecutionResult, error)
- func (s *LLMToolService) GetA2ATaskTracker() agentdomain.A2ATaskTracker
- func (s *LLMToolService) GetTool(name string) (agentdomain.Tool, error)
- func (s *LLMToolService) IsToolEnabled(name string) bool
- func (s *LLMToolService) ListAvailableTools() []string
- func (s *LLMToolService) ListTools() []sdk.ChatCompletionTool
- func (s *LLMToolService) ListToolsForMode(mode agentdomain.AgentMode) []sdk.ChatCompletionTool
- func (s *LLMToolService) SetCurrentModelFn(fn func() string)
- func (s *LLMToolService) ValidateTool(name string, args map[string]any) error
- type MCPManager
- func (m *MCPManager) ClearToolCount(serverName string)
- func (m *MCPManager) Close() error
- func (m *MCPManager) GetClient(serverName string) agentdomain.MCPClient
- func (m *MCPManager) GetClients() []agentdomain.MCPClient
- func (m *MCPManager) GetTotalServers() int
- func (m *MCPManager) StartMonitoring(ctx context.Context)
- func (m *MCPManager) StartServer(ctx context.Context, server config.MCPServerEntry) error
- func (m *MCPManager) StartServers(ctx context.Context) error
- func (m *MCPManager) StopServers(ctx context.Context) error
- func (m *MCPManager) UpdateToolCount(serverName string, count int)
- type NoOpToolService
- func (s *NoOpToolService) ExecuteTool(ctx context.Context, toolCall sdk.ChatCompletionMessageToolCallFunction) (*agentdomain.ToolExecutionResult, error)
- func (s *NoOpToolService) ExecuteToolDirect(ctx context.Context, toolCall sdk.ChatCompletionMessageToolCallFunction) (*agentdomain.ToolExecutionResult, error)
- func (s *NoOpToolService) GetA2ATaskTracker() agentdomain.A2ATaskTracker
- func (s *NoOpToolService) GetTool(name string) (agentdomain.Tool, error)
- func (s *NoOpToolService) IsToolEnabled(name string) bool
- func (s *NoOpToolService) ListAvailableTools() []string
- func (s *NoOpToolService) ListTools() []sdk.ChatCompletionTool
- func (s *NoOpToolService) ListToolsForMode(mode agentdomain.AgentMode) []sdk.ChatCompletionTool
- func (s *NoOpToolService) ValidateTool(name string, args map[string]any) error
- type PermissiveApprovalPolicy
- type ResultBodyProvider
- type SSEHTTPClientTransport
- func (t *SSEHTTPClientTransport) Close() error
- func (t *SSEHTTPClientTransport) Send(ctx context.Context, message *transport.BaseJsonRpcMessage) error
- func (t *SSEHTTPClientTransport) SetCloseHandler(handler func())
- func (t *SSEHTTPClientTransport) SetErrorHandler(handler func(error))
- func (t *SSEHTTPClientTransport) SetMessageHandler(handler func(ctx context.Context, message *transport.BaseJsonRpcMessage))
- func (t *SSEHTTPClientTransport) Start(ctx context.Context) error
- func (t *SSEHTTPClientTransport) WithHeader(key, value string) *SSEHTTPClientTransport
- type StandardApprovalPolicy
- type StateManager
- func (sm *StateManager) AddQueuedMessage(message sdk.Message, requestID string)
- func (sm *StateManager) AreAllAgentsReady() bool
- func (sm *StateManager) BroadcastEvent(event agentdomain.ChatEvent)
- func (sm *StateManager) ClearAgentReadiness()
- func (sm *StateManager) ClearApprovalUIState()
- func (sm *StateManager) ClearComputerUsePauseState()
- func (sm *StateManager) ClearFileSelectionState()
- func (sm *StateManager) ClearLastClickCoordinates()
- func (sm *StateManager) ClearLastFocusedApp()
- func (sm *StateManager) ClearMessageEditState()
- func (sm *StateManager) ClearPlanApprovalUIState()
- func (sm *StateManager) ClearQueuedMessages()
- func (sm *StateManager) ClearUserQuestionUIState()
- func (sm *StateManager) CompleteCurrentTool(result *agentdomain.ToolExecutionResult) error
- func (sm *StateManager) CycleAgentMode() agentdomain.AgentMode
- func (sm *StateManager) EndChatSession()
- func (sm *StateManager) EndToolExecution()
- func (sm *StateManager) FailCurrentTool(result *agentdomain.ToolExecutionResult) error
- func (sm *StateManager) GetAgentMode() agentdomain.AgentMode
- func (sm *StateManager) GetAgentReadiness() *ui.AgentReadinessState
- func (sm *StateManager) GetApprovalUIState() *agentdomain.ApprovalUIState
- func (sm *StateManager) GetChatSession() *agentdomain.ChatSession
- func (sm *StateManager) GetCurrentView() ui.ViewState
- func (sm *StateManager) GetDimensions() (int, int)
- func (sm *StateManager) GetEventBridge() agentdomain.EventBridge
- func (sm *StateManager) GetFileSelectionState() *ui.FileSelectionState
- func (sm *StateManager) GetLastClickCoordinates() (x, y int)
- func (sm *StateManager) GetLastFocusedApp() string
- func (sm *StateManager) GetMessageEditState() *ui.MessageEditState
- func (sm *StateManager) GetPausedRequestID() string
- func (sm *StateManager) GetPlanApprovalUIState() *agentdomain.PlanApprovalUIState
- func (sm *StateManager) GetPreviousView() ui.ViewState
- func (sm *StateManager) GetQueuedMessages() []convdomain.QueuedMessage
- func (sm *StateManager) GetRetryStatus() *agentdomain.RetryStatus
- func (sm *StateManager) GetTodos() []agentdomain.TodoItem
- func (sm *StateManager) GetToolExecution() *agentdomain.ToolExecutionSession
- func (sm *StateManager) GetUserQuestionUIState() *agentdomain.UserQuestionUIState
- func (sm *StateManager) InitializeAgentReadiness(totalAgents int)
- func (sm *StateManager) IsAgentBusy() bool
- func (sm *StateManager) IsComputerUsePaused() bool
- func (sm *StateManager) IsDebugMode() bool
- func (sm *StateManager) IsEditingMessage() bool
- func (sm *StateManager) PopQueuedMessage() *convdomain.QueuedMessage
- func (sm *StateManager) RecoverFromInconsistentState() error
- func (sm *StateManager) RemoveAgent(name string)
- func (sm *StateManager) SetAgentError(name string, err error)
- func (sm *StateManager) SetAgentMode(mode agentdomain.AgentMode)
- func (sm *StateManager) SetChatPending()
- func (sm *StateManager) SetComputerUsePaused(paused bool, requestID string)
- func (sm *StateManager) SetDebugMode(enabled bool)
- func (sm *StateManager) SetDimensions(width, height int)
- func (sm *StateManager) SetEventBridge(bridge agentdomain.EventBridge)
- func (sm *StateManager) SetFileSelectedIndex(index int)
- func (sm *StateManager) SetLastClickCoordinates(x, y int)
- func (sm *StateManager) SetLastFocusedApp(appID string)
- func (sm *StateManager) SetMessageEditState(state *ui.MessageEditState)
- func (sm *StateManager) SetPlanApprovalSelectedIndex(index int)
- func (sm *StateManager) SetRetryStatus(status *agentdomain.RetryStatus)
- func (sm *StateManager) SetStallThreshold(threshold time.Duration)
- func (sm *StateManager) SetTodos(todos []agentdomain.TodoItem)
- func (sm *StateManager) SetupApprovalUIState(toolCall *sdk.ChatCompletionMessageToolCall, ...)
- func (sm *StateManager) SetupFileSelection(files []string)
- func (sm *StateManager) SetupPlanApprovalUIState(planContent, planID string, responseChan chan agentdomain.PlanApprovalAction)
- func (sm *StateManager) SetupUserQuestionUIState(questions []agentdomain.UserQuestion, ...)
- func (sm *StateManager) StartChatSession(requestID, model string, eventChan <-chan agentdomain.ChatEvent) error
- func (sm *StateManager) StartToolExecution(toolCalls []sdk.ChatCompletionMessageToolCall) error
- func (sm *StateManager) TouchChatActivity()
- func (sm *StateManager) TransitionToView(newView ui.ViewState) error
- func (sm *StateManager) UpdateAgentPullProgress(name string, done, total int)
- func (sm *StateManager) UpdateAgentStatus(name string, state agentdomain.AgentState, message string, url string, ...)
- func (sm *StateManager) UpdateChatStatus(status agentdomain.ChatStatus) error
- func (sm *StateManager) UpdateFileSearchQuery(query string)
- type StrictApprovalPolicy
- type ToolFormatterService
- func (s *ToolFormatterService) FormatToolCall(toolName string, args map[string]any) string
- func (s *ToolFormatterService) FormatToolResultExpanded(result *agentdomain.ToolExecutionResult, terminalWidth int) string
- func (s *ToolFormatterService) FormatToolResultForLLM(result *agentdomain.ToolExecutionResult) string
- func (s *ToolFormatterService) FormatToolResultForUI(result *agentdomain.ToolExecutionResult, terminalWidth int) string
- func (s *ToolFormatterService) RenderToolSummary(icon, toolName string, args map[string]any, trailing string, terminalWidth int) string
- func (s *ToolFormatterService) SetHintFormatter(h HintProvider)
- func (s *ToolFormatterService) SetMaxResultBytes(n int)
- func (s *ToolFormatterService) ShouldAlwaysExpandTool(toolName string) bool
- type ToolRegistry
Constants ¶
const (
// AgentContainerPrefix is the naming prefix for agent containers
AgentContainerPrefix = "inference-agent-"
)
Variables ¶
var ChannelBuiltinCommands = []channels.ChannelCommand{
{Name: "new", Description: "Start a fresh conversation and wipe recent chat messages (previous one is kept)"},
{Name: "conversations", Description: "List past conversations, tap one to switch"},
{Name: "stats", Description: "Usage stats for this conversation — phone-friendly list (/stats 24h; add 'table' for tables)"},
{Name: "help", Description: "List available commands"},
}
ChannelBuiltinCommands are the shortcuts the daemon implements natively for channels (everything else in the registry is either a custom shortcut, executed as-is, or TUI-only and answered with a pointer to `infer chat`).
Functions ¶
func NewFileService ¶ added in v0.15.0
func NewFileService() agentdomain.FileService
NewFileService creates a new file service
func ProcessAlive ¶ added in v0.167.0
ProcessAlive reports whether a process with the given PID exists.
func PruneClipboardImages ¶ added in v0.159.0
func PruneClipboardImages(dir string)
PruneClipboardImages removes stale clipboard-image files from dir, keeping the newest 20 and anything younger than 24 hours. Recently pasted images must outlive the message that referenced them - the model may read the file via ImageDecode after the send.
Types ¶
type A2AAgentService ¶ added in v0.49.0
type A2AAgentService struct {
// contains filtered or unexported fields
}
func NewA2AAgentService ¶ added in v0.49.0
func NewA2AAgentService(cfg *config.Config) *A2AAgentService
func (*A2AAgentService) GetAgentCard ¶ added in v0.49.0
func (*A2AAgentService) GetAgentCards ¶ added in v0.49.0
func (s *A2AAgentService) GetAgentCards(ctx context.Context) ([]*agentapp.CachedAgentCard, error)
func (*A2AAgentService) GetConfiguredAgents ¶ added in v0.49.0
func (s *A2AAgentService) GetConfiguredAgents() []string
type AgentManager ¶ added in v0.54.0
type AgentManager struct {
// contains filtered or unexported fields
}
AgentManager manages the lifecycle of A2A agent containers (local and external)
func NewAgentManager ¶ added in v0.54.0
func NewAgentManager(sessionID convdomain.SessionID, cfg *config.Config, agentsConfig *config.AgentsConfig, runtime containerruntime.ContainerRuntime, a2aService agentapp.A2AAgentService) *AgentManager
NewAgentManager creates a new agent manager
func (*AgentManager) GetAllAgentNames ¶ added in v0.90.2
func (am *AgentManager) GetAllAgentNames() []string
GetAllAgentNames returns names of all agents (local and external)
func (*AgentManager) GetExternalAgentURL ¶ added in v0.90.2
func (am *AgentManager) GetExternalAgentURL(agentName string) string
GetExternalAgentURL returns the URL for an external agent
func (*AgentManager) GetTotalAgentCount ¶ added in v0.90.2
func (am *AgentManager) GetTotalAgentCount() int
GetTotalAgentCount returns the total number of agents (local + external)
func (*AgentManager) IsExternalAgent ¶ added in v0.90.2
func (am *AgentManager) IsExternalAgent(agentName string) bool
IsExternalAgent returns true if the agent is external (not managed by this CLI)
func (*AgentManager) IsRunning ¶ added in v0.54.0
func (am *AgentManager) IsRunning() bool
IsRunning returns whether any agents are running
func (*AgentManager) SetPullProgressCallback ¶ added in v0.149.0
func (am *AgentManager) SetPullProgressCallback(callback func(agentName string, done, total int))
SetPullProgressCallback sets the callback function for image pull progress updates
func (*AgentManager) SetStatusCallback ¶ added in v0.67.0
func (am *AgentManager) SetStatusCallback(callback func(agentName string, state agentdomain.AgentState, message string, url string, image string))
SetStatusCallback sets the callback function for agent status updates
func (*AgentManager) StartAgent ¶ added in v0.54.0
func (am *AgentManager) StartAgent(ctx context.Context, agent config.AgentEntry) error
StartAgent starts a single agent container with status updates
func (*AgentManager) StartAgents ¶ added in v0.54.0
func (am *AgentManager) StartAgents(ctx context.Context) error
StartAgents starts all local agents (run: true) and monitors external agents
func (*AgentManager) StopAgent ¶ added in v0.54.0
func (am *AgentManager) StopAgent(ctx context.Context, agentName string) error
StopAgent stops a single agent container
func (*AgentManager) StopAgents ¶ added in v0.54.0
func (am *AgentManager) StopAgents(ctx context.Context) error
StopAgents stops all running agent containers, cancels liveness probes, and cleans up the network
func (*AgentManager) WaitForAgentsReady ¶ added in v0.157.0
func (am *AgentManager) WaitForAgentsReady(ctx context.Context)
WaitForAgentsReady blocks until every run:true agent started by StartAgents has settled (ready or failed), or ctx is done. Headless mode calls this before the first LLM turn so the model never races an agent whose 3GB image is still pulling; failed agents settle too, so a broken agent can't block forever. Chat mode never calls it (the TUI streams status instead).
type ChannelManagerService ¶ added in v0.101.0
type ChannelManagerService struct {
// contains filtered or unexported fields
}
ChannelManagerService manages pluggable messaging channels and triggers the agent as a subprocess for each inbound message.
func NewChannelManagerService ¶ added in v0.101.0
func NewChannelManagerService(cfg config.ChannelsConfig, tel *telemetry.Recorder) *ChannelManagerService
NewChannelManagerService creates a new channel manager
func (*ChannelManagerService) GetChannel ¶ added in v0.104.0
func (cm *ChannelManagerService) GetChannel(name string) chn.Channel
GetChannel returns a registered channel by name, or nil if not registered. Used by the scheduler service to deliver scheduled-job output through the in-process channel registry.
func (*ChannelManagerService) Register ¶ added in v0.101.0
func (cm *ChannelManagerService) Register(ch chn.Channel)
Register adds a channel to the manager
func (*ChannelManagerService) SetCommandSupport ¶ added in v0.149.0
func (cm *ChannelManagerService) SetCommandSupport(reg *shortcuts.Registry, conv storage.ConversationStorage, groups storage.SessionGroupStorage)
SetCommandSupport enables slash-command handling for inbound channel messages. A nil registry leaves the feature disabled.
func (*ChannelManagerService) Start ¶ added in v0.101.0
func (cm *ChannelManagerService) Start(ctx context.Context) error
Start begins all registered channels and the message routing loop
func (*ChannelManagerService) Stop ¶ added in v0.101.0
func (cm *ChannelManagerService) Stop() error
Stop gracefully shuts down all channels
type DirectoryFrameSource ¶ added in v0.159.0
type DirectoryFrameSource struct {
// contains filtered or unexported fields
}
DirectoryFrameSource serves the newest image file under a configured directory - the integration surface for camera daemons and anything else that drops frames on disk. An optional retention sweep (max_files/max_age) runs after each read; omit retention when the producer manages cleanup.
func NewDirectoryFrameSource ¶ added in v0.159.0
func NewDirectoryFrameSource(name string, cfg config.VisionSourceConfig, images agentdomain.ImageService) *DirectoryFrameSource
NewDirectoryFrameSource creates a frame source over cfg.Path. The retention max_age was validated at config load, so a parse failure here means zero (no age limit).
func (*DirectoryFrameSource) GetLatestFrame ¶ added in v0.159.0
func (d *DirectoryFrameSource) GetLatestFrame() (*agentdomain.Frame, error)
GetLatestFrame returns the newest image file in the directory by mtime.
type FileServiceImpl ¶ added in v0.15.0
type FileServiceImpl struct{}
FileServiceImpl implements agentdomain.FileService
func (*FileServiceImpl) GetFileInfo ¶ added in v0.15.0
func (s *FileServiceImpl) GetFileInfo(path string) (agentdomain.FileInfo, error)
GetFileInfo returns information about a file
func (*FileServiceImpl) ListProjectFiles ¶ added in v0.15.0
func (s *FileServiceImpl) ListProjectFiles() ([]string, error)
ListProjectFiles returns a list of all files in the current directory and subdirectories
func (*FileServiceImpl) ReadFile ¶ added in v0.15.0
func (s *FileServiceImpl) ReadFile(path string) (string, error)
ReadFile reads the content of a file
func (*FileServiceImpl) ReadFileLines ¶ added in v0.15.0
func (s *FileServiceImpl) ReadFileLines(path string, startLine, endLine int) (string, error)
ReadFileLines reads specific lines from a file
func (*FileServiceImpl) ValidateFile ¶ added in v0.15.0
func (s *FileServiceImpl) ValidateFile(path string) error
ValidateFile checks if a file path is valid and accessible
type GatewayManager ¶ added in v0.54.0
type GatewayManager struct {
// contains filtered or unexported fields
}
GatewayManager manages the lifecycle of the gateway container or binary
func NewGatewayManager ¶ added in v0.54.0
func NewGatewayManager(sessionID convdomain.SessionID, cfg *config.Config, runtime containerruntime.ContainerRuntime) *GatewayManager
NewGatewayManager creates a new gateway manager
func (*GatewayManager) EnsureStarted ¶ added in v0.87.0
func (gm *GatewayManager) EnsureStarted() error
EnsureStarted starts the gateway if configured and not already running This is a convenience method that checks config and running state before starting
func (*GatewayManager) GetGatewayURL ¶ added in v0.82.0
func (gm *GatewayManager) GetGatewayURL() string
GetGatewayURL returns the actual gateway URL with the assigned port
func (*GatewayManager) IsRunning ¶ added in v0.54.0
func (gm *GatewayManager) IsRunning() bool
IsRunning returns whether the gateway container is running
type HintProvider ¶ added in v0.118.0
HintProvider resolves keybinding hints for tool result affordances. It is satisfied by *hints.Formatter.
type ImageService ¶ added in v0.57.0
type ImageService struct {
// contains filtered or unexported fields
}
ImageService handles image operations including file-based image loading and base64 encoding Note: Direct clipboard support requires platform-specific dependencies and is not yet implemented
func NewImageService ¶ added in v0.57.0
func NewImageService(cfg *config.Config, client sdk.Client) *ImageService
NewImageService creates a new image service
func (*ImageService) CreateDataURL ¶ added in v0.57.0
func (s *ImageService) CreateDataURL(attachment *agentdomain.ImageAttachment) string
CreateDataURL creates a data URL from an image attachment
func (*ImageService) CreateImageVariation ¶ added in v0.158.0
func (s *ImageService) CreateImageVariation(ctx context.Context, model, imagePath, size string) (string, error)
CreateImageVariation creates a variation of the image at imagePath using model ("provider/name") and returns the path of the saved PNG. A blank size is omitted from the request, leaving the provider's own default.
func (*ImageService) EditImage ¶ added in v0.158.0
func (s *ImageService) EditImage(ctx context.Context, model, prompt, imagePath, quality, size, maskPath string) (string, error)
EditImage edits the image at imagePath using prompt and model ("provider/name") and returns the path of the saved PNG. A blank quality or size is omitted from the request, leaving the provider's own default. A non-empty maskPath points to a PNG whose transparent (alpha=0) areas mark the editable region; all other pixels are preserved exactly.
func (*ImageService) GenerateImage ¶ added in v0.156.0
func (s *ImageService) GenerateImage(ctx context.Context, model, prompt, quality, size string) (string, error)
GenerateImage generates an image from prompt using model ("provider/name") and returns the path of the saved PNG. A blank quality or size is omitted from the request, leaving the provider's own default.
func (*ImageService) IsImageFile ¶ added in v0.57.0
func (s *ImageService) IsImageFile(filePath string) bool
IsImageFile checks if a file is a supported image format
func (*ImageService) IsImageModel ¶ added in v0.156.0
func (s *ImageService) IsImageModel(model string) bool
IsImageModel reports whether the model generates images rather than text. Uses gateway-reported modalities: a model is an image-generation model if its modalities include "image" but NOT "text". Falls back to false when the model is not in the registry.
func (*ImageService) IsImageURL ¶ added in v0.72.0
func (s *ImageService) IsImageURL(urlStr string) bool
IsImageURL checks if a string is a valid image URL
func (*ImageService) ReadImageFromBinary ¶ added in v0.57.0
func (s *ImageService) ReadImageFromBinary(imageData []byte, filename string) (*agentdomain.ImageAttachment, error)
ReadImageFromBinary reads an image from binary data and returns it as a base64 attachment
func (*ImageService) ReadImageFromFile ¶ added in v0.57.0
func (s *ImageService) ReadImageFromFile(filePath string) (*agentdomain.ImageAttachment, error)
ReadImageFromFile reads an image from a file path and returns it as a base64 attachment
func (*ImageService) ReadImageFromURL ¶ added in v0.72.0
func (s *ImageService) ReadImageFromURL(imageURL string) (*agentdomain.ImageAttachment, error)
ReadImageFromURL fetches an image from a URL and returns it as a base64 attachment
type LLMToolService ¶
type LLMToolService struct {
// contains filtered or unexported fields
}
LLMToolService implements ToolService with the new tools package architecture
func NewLLMToolServiceWithRegistry ¶ added in v0.14.1
func NewLLMToolServiceWithRegistry(cfg *config.Config, registry *tools.Registry) *LLMToolService
NewLLMToolServiceWithRegistry creates a new LLM tool service with an existing registry
func (*LLMToolService) ExecuteTool ¶
func (s *LLMToolService) ExecuteTool(ctx context.Context, toolCall sdk.ChatCompletionMessageToolCallFunction) (*agentdomain.ToolExecutionResult, error)
ExecuteTool executes a tool with the given arguments
func (*LLMToolService) ExecuteToolDirect ¶ added in v0.68.0
func (s *LLMToolService) ExecuteToolDirect(ctx context.Context, toolCall sdk.ChatCompletionMessageToolCallFunction) (*agentdomain.ToolExecutionResult, error)
ExecuteToolDirect executes a tool directly without checking if it's enabled Used for user-initiated commands where the user explicitly wants to run the tool
func (*LLMToolService) GetA2ATaskTracker ¶ added in v0.101.0
func (s *LLMToolService) GetA2ATaskTracker() agentdomain.A2ATaskTracker
func (*LLMToolService) GetTool ¶ added in v0.81.0
func (s *LLMToolService) GetTool(name string) (agentdomain.Tool, error)
func (*LLMToolService) IsToolEnabled ¶
func (s *LLMToolService) IsToolEnabled(name string) bool
IsToolEnabled checks if a tool is enabled
func (*LLMToolService) ListAvailableTools ¶ added in v0.32.0
func (s *LLMToolService) ListAvailableTools() []string
ListAvailableTools returns names of all enabled tools
func (*LLMToolService) ListTools ¶
func (s *LLMToolService) ListTools() []sdk.ChatCompletionTool
ListTools returns definitions for all enabled tools
func (*LLMToolService) ListToolsForMode ¶ added in v0.56.0
func (s *LLMToolService) ListToolsForMode(mode agentdomain.AgentMode) []sdk.ChatCompletionTool
ListToolsForMode returns definitions for enabled tools filtered by agent mode
func (*LLMToolService) SetCurrentModelFn ¶ added in v0.163.0
func (s *LLMToolService) SetCurrentModelFn(fn func() string)
SetCurrentModelFn wires the current-model accessor used for per-model tool filtering (e.g. hiding ImageDecode from vision-capable models).
func (*LLMToolService) ValidateTool ¶
func (s *LLMToolService) ValidateTool(name string, args map[string]any) error
ValidateTool validates tool arguments
type MCPManager ¶ added in v0.79.0
type MCPManager struct {
// contains filtered or unexported fields
}
MCPManager manages multiple MCP server connections and their container lifecycle
func NewMCPManager ¶ added in v0.79.0
func NewMCPManager(sessionID convdomain.SessionID, cfg *config.MCPConfig, runtime containerruntime.ContainerRuntime, notifier agentdomain.UINotifier) *MCPManager
NewMCPManager creates a new MCP manager. notifier is the single UI ingress the liveness probes push MCPServerStatusUpdateEvent through; a nil notifier degrades to no UI pushes.
func (*MCPManager) ClearToolCount ¶ added in v0.79.0
func (m *MCPManager) ClearToolCount(serverName string)
ClearToolCount removes the tool count for a specific server
func (*MCPManager) Close ¶ added in v0.79.0
func (m *MCPManager) Close() error
Close stops monitoring, stops containers, and cleans up resources
func (*MCPManager) GetClient ¶ added in v0.109.10
func (m *MCPManager) GetClient(serverName string) agentdomain.MCPClient
GetClient returns the client for a specific server by name, or nil if no such client exists. Direct map lookup - does not perform any network I/O, in contrast to iterating GetClients() and calling DiscoverTools to identify the owning client.
func (*MCPManager) GetClients ¶ added in v0.79.0
func (m *MCPManager) GetClients() []agentdomain.MCPClient
GetClients returns a list of MCP clients
func (*MCPManager) GetTotalServers ¶ added in v0.79.0
func (m *MCPManager) GetTotalServers() int
GetTotalServers returns the total number of configured MCP servers from config
func (*MCPManager) StartMonitoring ¶ added in v0.79.0
func (m *MCPManager) StartMonitoring(ctx context.Context)
StartMonitoring begins background health monitoring, pushing every MCPServerStatusUpdateEvent through the injected UI notifier. It is idempotent - subsequent calls are no-ops. The initial status is emitted from a goroutine because Notify wraps the unbuffered (*tea.Program).Send, which blocks until the Bubble Tea loop consumes; emitting it synchronously from app.Init (before the loop runs) would deadlock.
func (*MCPManager) StartServer ¶ added in v0.80.0
func (m *MCPManager) StartServer(ctx context.Context, server config.MCPServerEntry) error
StartServer starts a single MCP server container
func (*MCPManager) StartServers ¶ added in v0.80.0
func (m *MCPManager) StartServers(ctx context.Context) error
StartServers starts all MCP servers that have run=true This method is non-fatal and always returns nil
func (*MCPManager) StopServers ¶ added in v0.80.0
func (m *MCPManager) StopServers(ctx context.Context) error
StopServers stops all running MCP server containers
func (*MCPManager) UpdateToolCount ¶ added in v0.79.0
func (m *MCPManager) UpdateToolCount(serverName string, count int)
UpdateToolCount updates the tool count for a specific server
type NoOpToolService ¶
type NoOpToolService struct{}
NoOpToolService implements ToolService as a no-op (when tools are disabled)
func NewNoOpToolService ¶
func NewNoOpToolService() *NoOpToolService
NewNoOpToolService creates a new no-op tool service
func (*NoOpToolService) ExecuteTool ¶
func (s *NoOpToolService) ExecuteTool(ctx context.Context, toolCall sdk.ChatCompletionMessageToolCallFunction) (*agentdomain.ToolExecutionResult, error)
func (*NoOpToolService) ExecuteToolDirect ¶ added in v0.68.0
func (s *NoOpToolService) ExecuteToolDirect(ctx context.Context, toolCall sdk.ChatCompletionMessageToolCallFunction) (*agentdomain.ToolExecutionResult, error)
func (*NoOpToolService) GetA2ATaskTracker ¶ added in v0.101.0
func (s *NoOpToolService) GetA2ATaskTracker() agentdomain.A2ATaskTracker
func (*NoOpToolService) GetTool ¶ added in v0.81.0
func (s *NoOpToolService) GetTool(name string) (agentdomain.Tool, error)
func (*NoOpToolService) IsToolEnabled ¶
func (s *NoOpToolService) IsToolEnabled(name string) bool
func (*NoOpToolService) ListAvailableTools ¶ added in v0.32.0
func (s *NoOpToolService) ListAvailableTools() []string
func (*NoOpToolService) ListTools ¶
func (s *NoOpToolService) ListTools() []sdk.ChatCompletionTool
func (*NoOpToolService) ListToolsForMode ¶ added in v0.56.0
func (s *NoOpToolService) ListToolsForMode(mode agentdomain.AgentMode) []sdk.ChatCompletionTool
func (*NoOpToolService) ValidateTool ¶
func (s *NoOpToolService) ValidateTool(name string, args map[string]any) error
type PermissiveApprovalPolicy ¶ added in v0.97.0
type PermissiveApprovalPolicy struct{}
PermissiveApprovalPolicy is an alternative policy that bypasses all approval Useful for automation, testing, or highly trusted environments
func NewPermissiveApprovalPolicy ¶ added in v0.97.0
func NewPermissiveApprovalPolicy() *PermissiveApprovalPolicy
NewPermissiveApprovalPolicy creates a new permissive approval policy
func (*PermissiveApprovalPolicy) ShouldRequireApproval ¶ added in v0.97.0
func (p *PermissiveApprovalPolicy) ShouldRequireApproval( ctx context.Context, toolCall *sdk.ChatCompletionMessageToolCall, isChatMode bool, ) bool
ShouldRequireApproval always returns false (no approval required)
type ResultBodyProvider ¶ added in v0.118.0
type ResultBodyProvider interface {
FormatResultBody(result *agentdomain.ToolExecutionResult) string
}
ResultBodyProvider is an optional interface a tool may implement to expose its primary output (command stdout, file content, …) for the collapsed preview and the full-on-failure view. It is distinct from FormatPreview (a one-line summary) and FormatForLLM (the full tree) and lives in the services package so adding it does not touch the agentdomain.Tool interface or its generated mocks.
type SSEHTTPClientTransport ¶ added in v0.80.0
type SSEHTTPClientTransport struct {
// contains filtered or unexported fields
}
SSEHTTPClientTransport implements an SSE-aware HTTP client transport for MCP This handles servers that respond with Server-Sent Events format
func NewSSEHTTPClientTransport ¶ added in v0.80.0
func NewSSEHTTPClientTransport(endpoint string) *SSEHTTPClientTransport
NewSSEHTTPClientTransport creates a new SSE-aware HTTP client transport
func (*SSEHTTPClientTransport) Close ¶ added in v0.80.0
func (t *SSEHTTPClientTransport) Close() error
Close implements Transport.Close
func (*SSEHTTPClientTransport) Send ¶ added in v0.80.0
func (t *SSEHTTPClientTransport) Send(ctx context.Context, message *transport.BaseJsonRpcMessage) error
Send implements Transport.Send
func (*SSEHTTPClientTransport) SetCloseHandler ¶ added in v0.80.0
func (t *SSEHTTPClientTransport) SetCloseHandler(handler func())
SetCloseHandler implements Transport.SetCloseHandler
func (*SSEHTTPClientTransport) SetErrorHandler ¶ added in v0.80.0
func (t *SSEHTTPClientTransport) SetErrorHandler(handler func(error))
SetErrorHandler implements Transport.SetErrorHandler
func (*SSEHTTPClientTransport) SetMessageHandler ¶ added in v0.80.0
func (t *SSEHTTPClientTransport) SetMessageHandler(handler func(ctx context.Context, message *transport.BaseJsonRpcMessage))
SetMessageHandler implements Transport.SetMessageHandler
func (*SSEHTTPClientTransport) Start ¶ added in v0.80.0
func (t *SSEHTTPClientTransport) Start(ctx context.Context) error
Start implements Transport.Start
func (*SSEHTTPClientTransport) WithHeader ¶ added in v0.80.0
func (t *SSEHTTPClientTransport) WithHeader(key, value string) *SSEHTTPClientTransport
WithHeader adds a header to the request
type StandardApprovalPolicy ¶ added in v0.97.0
type StandardApprovalPolicy struct {
// contains filtered or unexported fields
}
StandardApprovalPolicy implements the default approval policy with the following rules:
- Computer use tools (mouse, keyboard) always bypass approval (background execution)
- Auto-accept mode bypasses all approval 2.5. ReadOnly mode (Explore-like subagent) bypasses approval; its toolset is read-only by construction so nothing it can call mutates
- Non-chat (headless agent) mode bypasses approval; there the Bash tool's own per-mode gate (executeBash) decides what runs
- Bash commands are governed by the per-mode allow-list (config.IsBashCommandAllowed): reached only in chat, non-auto mode, so allowed commands bypass approval and anything off-list prompts the user
- Other tools check configuration (per-tool or global require_approval setting)
func NewStandardApprovalPolicy ¶ added in v0.97.0
func NewStandardApprovalPolicy(cfg *config.Config, stateManager agentdomain.AgentModeManager) *StandardApprovalPolicy
NewStandardApprovalPolicy creates a new standard approval policy
func (*StandardApprovalPolicy) ShouldRequireApproval ¶ added in v0.97.0
func (p *StandardApprovalPolicy) ShouldRequireApproval( ctx context.Context, toolCall *sdk.ChatCompletionMessageToolCall, isChatMode bool, ) bool
ShouldRequireApproval implements the approval decision logic
type StateManager ¶ added in v0.27.0
type StateManager struct {
// contains filtered or unexported fields
}
StateManager provides centralized state management with proper synchronization
func NewStateManager ¶ added in v0.27.0
func NewStateManager(debugMode bool) *StateManager
NewStateManager creates a new state manager
func (*StateManager) AddQueuedMessage ¶ added in v0.53.0
func (sm *StateManager) AddQueuedMessage(message sdk.Message, requestID string)
AddQueuedMessage adds a message to the input queue
func (*StateManager) AreAllAgentsReady ¶ added in v0.67.0
func (sm *StateManager) AreAllAgentsReady() bool
AreAllAgentsReady returns true if all agents are ready
func (*StateManager) BroadcastEvent ¶ added in v0.96.0
func (sm *StateManager) BroadcastEvent(event agentdomain.ChatEvent)
BroadcastEvent publishes an event to the EventBridge for external consumers
func (*StateManager) ClearAgentReadiness ¶ added in v0.67.0
func (sm *StateManager) ClearAgentReadiness()
ClearAgentReadiness clears the agent readiness state
func (*StateManager) ClearApprovalUIState ¶ added in v0.27.0
func (sm *StateManager) ClearApprovalUIState()
ClearApprovalUIState clears the approval UI state
func (*StateManager) ClearComputerUsePauseState ¶ added in v0.96.0
func (sm *StateManager) ClearComputerUsePauseState()
ClearComputerUsePauseState clears the pause state
func (*StateManager) ClearFileSelectionState ¶ added in v0.27.0
func (sm *StateManager) ClearFileSelectionState()
ClearFileSelectionState clears the file selection state
func (*StateManager) ClearLastClickCoordinates ¶ added in v0.96.0
func (sm *StateManager) ClearLastClickCoordinates()
ClearLastClickCoordinates clears the stored click coordinates
func (*StateManager) ClearLastFocusedApp ¶ added in v0.96.0
func (sm *StateManager) ClearLastFocusedApp()
ClearLastFocusedApp clears the stored focused app
func (*StateManager) ClearMessageEditState ¶ added in v0.92.0
func (sm *StateManager) ClearMessageEditState()
ClearMessageEditState clears the message edit state
func (*StateManager) ClearPlanApprovalUIState ¶ added in v0.68.0
func (sm *StateManager) ClearPlanApprovalUIState()
ClearPlanApprovalUIState clears the plan approval UI state
func (*StateManager) ClearQueuedMessages ¶ added in v0.53.0
func (sm *StateManager) ClearQueuedMessages()
ClearQueuedMessages clears all queued messages
func (*StateManager) ClearUserQuestionUIState ¶ added in v0.124.0
func (sm *StateManager) ClearUserQuestionUIState()
ClearUserQuestionUIState clears the AskUserQuestion form state
func (*StateManager) CompleteCurrentTool ¶ added in v0.27.0
func (sm *StateManager) CompleteCurrentTool(result *agentdomain.ToolExecutionResult) error
CompleteCurrentTool marks the current tool as completed
func (*StateManager) CycleAgentMode ¶ added in v0.56.0
func (sm *StateManager) CycleAgentMode() agentdomain.AgentMode
CycleAgentMode cycles to the next agent mode
func (*StateManager) EndChatSession ¶ added in v0.27.0
func (sm *StateManager) EndChatSession()
EndChatSession ends the current chat session
func (*StateManager) EndToolExecution ¶ added in v0.27.0
func (sm *StateManager) EndToolExecution()
EndToolExecution ends the current tool execution session
func (*StateManager) FailCurrentTool ¶ added in v0.27.0
func (sm *StateManager) FailCurrentTool(result *agentdomain.ToolExecutionResult) error
FailCurrentTool marks the current tool as failed
func (*StateManager) GetAgentMode ¶ added in v0.56.0
func (sm *StateManager) GetAgentMode() agentdomain.AgentMode
GetAgentMode returns the current agent mode
func (*StateManager) GetAgentReadiness ¶ added in v0.67.0
func (sm *StateManager) GetAgentReadiness() *ui.AgentReadinessState
GetAgentReadiness returns the current agent readiness state
func (*StateManager) GetApprovalUIState ¶ added in v0.27.0
func (sm *StateManager) GetApprovalUIState() *agentdomain.ApprovalUIState
GetApprovalUIState returns the current approval UI state
func (*StateManager) GetChatSession ¶ added in v0.27.0
func (sm *StateManager) GetChatSession() *agentdomain.ChatSession
GetChatSession returns the current chat session (read-only)
func (*StateManager) GetCurrentView ¶ added in v0.27.0
func (sm *StateManager) GetCurrentView() ui.ViewState
GetCurrentView returns the current view state
func (*StateManager) GetDimensions ¶ added in v0.27.0
func (sm *StateManager) GetDimensions() (int, int)
GetDimensions returns the current UI dimensions
func (*StateManager) GetEventBridge ¶ added in v0.96.0
func (sm *StateManager) GetEventBridge() agentdomain.EventBridge
GetEventBridge returns the event bridge for control event forwarding
func (*StateManager) GetFileSelectionState ¶ added in v0.27.0
func (sm *StateManager) GetFileSelectionState() *ui.FileSelectionState
GetFileSelectionState returns the current file selection state
func (*StateManager) GetLastClickCoordinates ¶ added in v0.96.0
func (sm *StateManager) GetLastClickCoordinates() (x, y int)
GetLastClickCoordinates returns the coordinates of the last click
func (*StateManager) GetLastFocusedApp ¶ added in v0.96.0
func (sm *StateManager) GetLastFocusedApp() string
GetLastFocusedApp returns the application ID of the last focused application
func (*StateManager) GetMessageEditState ¶ added in v0.92.0
func (sm *StateManager) GetMessageEditState() *ui.MessageEditState
GetMessageEditState returns the current message edit state
func (*StateManager) GetPausedRequestID ¶ added in v0.96.0
func (sm *StateManager) GetPausedRequestID() string
GetPausedRequestID returns the request ID of the paused execution
func (*StateManager) GetPlanApprovalUIState ¶ added in v0.68.0
func (sm *StateManager) GetPlanApprovalUIState() *agentdomain.PlanApprovalUIState
GetPlanApprovalUIState returns the current plan approval UI state
func (*StateManager) GetPreviousView ¶ added in v0.86.0
func (sm *StateManager) GetPreviousView() ui.ViewState
GetPreviousView returns the previous view state
func (*StateManager) GetQueuedMessages ¶ added in v0.53.0
func (sm *StateManager) GetQueuedMessages() []convdomain.QueuedMessage
GetQueuedMessages returns the current queued messages
func (*StateManager) GetRetryStatus ¶ added in v0.142.0
func (sm *StateManager) 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 (*StateManager) GetTodos ¶ added in v0.63.1
func (sm *StateManager) GetTodos() []agentdomain.TodoItem
GetTodos returns the current todo list
func (*StateManager) GetToolExecution ¶ added in v0.27.0
func (sm *StateManager) GetToolExecution() *agentdomain.ToolExecutionSession
GetToolExecution returns the current tool execution session (read-only)
func (*StateManager) GetUserQuestionUIState ¶ added in v0.124.0
func (sm *StateManager) GetUserQuestionUIState() *agentdomain.UserQuestionUIState
GetUserQuestionUIState returns the current AskUserQuestion form state
func (*StateManager) InitializeAgentReadiness ¶ added in v0.67.0
func (sm *StateManager) InitializeAgentReadiness(totalAgents int)
InitializeAgentReadiness initializes the agent readiness tracking
func (*StateManager) IsAgentBusy ¶ added in v0.53.0
func (sm *StateManager) IsAgentBusy() bool
IsAgentBusy returns true if the agent is currently processing a request
func (*StateManager) IsComputerUsePaused ¶ added in v0.96.0
func (sm *StateManager) IsComputerUsePaused() bool
IsComputerUsePaused returns whether computer use is currently paused
func (*StateManager) IsDebugMode ¶ added in v0.27.0
func (sm *StateManager) IsDebugMode() bool
IsDebugMode returns whether debug mode is enabled
func (*StateManager) IsEditingMessage ¶ added in v0.92.0
func (sm *StateManager) IsEditingMessage() bool
IsEditingMessage returns true if currently editing a message
func (*StateManager) PopQueuedMessage ¶ added in v0.53.0
func (sm *StateManager) PopQueuedMessage() *convdomain.QueuedMessage
PopQueuedMessage removes and returns the first message from the queue (FIFO order)
func (*StateManager) RecoverFromInconsistentState ¶ added in v0.27.0
func (sm *StateManager) RecoverFromInconsistentState() error
RecoverFromInconsistentState attempts to recover from an inconsistent state
func (*StateManager) RemoveAgent ¶ added in v0.67.0
func (sm *StateManager) RemoveAgent(name string)
RemoveAgent removes an agent from the readiness tracking
func (*StateManager) SetAgentError ¶ added in v0.67.0
func (sm *StateManager) SetAgentError(name string, err error)
SetAgentError sets an error for a specific agent
func (*StateManager) SetAgentMode ¶ added in v0.56.0
func (sm *StateManager) SetAgentMode(mode agentdomain.AgentMode)
SetAgentMode sets the agent mode
func (*StateManager) SetChatPending ¶ added in v0.63.1
func (sm *StateManager) 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 (*StateManager) SetComputerUsePaused ¶ added in v0.96.0
func (sm *StateManager) SetComputerUsePaused(paused bool, requestID string)
SetComputerUsePaused sets the paused state for computer use
func (*StateManager) SetDebugMode ¶ added in v0.27.0
func (sm *StateManager) SetDebugMode(enabled bool)
SetDebugMode enables or disables debug mode
func (*StateManager) SetDimensions ¶ added in v0.27.0
func (sm *StateManager) SetDimensions(width, height int)
SetDimensions updates the UI dimensions
func (*StateManager) SetEventBridge ¶ added in v0.96.0
func (sm *StateManager) SetEventBridge(bridge agentdomain.EventBridge)
SetEventBridge sets the event bridge for multicasting events to external consumers
func (*StateManager) SetFileSelectedIndex ¶ added in v0.27.0
func (sm *StateManager) SetFileSelectedIndex(index int)
SetFileSelectedIndex sets the selected file index
func (*StateManager) SetLastClickCoordinates ¶ added in v0.96.0
func (sm *StateManager) SetLastClickCoordinates(x, y int)
SetLastClickCoordinates stores the coordinates of the last click
func (*StateManager) SetLastFocusedApp ¶ added in v0.96.0
func (sm *StateManager) SetLastFocusedApp(appID string)
SetLastFocusedApp stores the application ID of the last focused application
func (*StateManager) SetMessageEditState ¶ added in v0.92.0
func (sm *StateManager) SetMessageEditState(state *ui.MessageEditState)
SetMessageEditState sets the message edit state
func (*StateManager) SetPlanApprovalSelectedIndex ¶ added in v0.68.0
func (sm *StateManager) SetPlanApprovalSelectedIndex(index int)
SetPlanApprovalSelectedIndex sets the plan approval selection index
func (*StateManager) SetRetryStatus ¶ added in v0.142.0
func (sm *StateManager) 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 (*StateManager) SetStallThreshold ¶ added in v0.142.0
func (sm *StateManager) SetStallThreshold(threshold time.Duration)
SetStallThreshold sets how long a streaming session may go without chunks before GetRetryStatus reports it as reconnecting. Zero or negative disables stall detection.
func (*StateManager) SetTodos ¶ added in v0.63.1
func (sm *StateManager) SetTodos(todos []agentdomain.TodoItem)
SetTodos sets the todo list
func (*StateManager) SetupApprovalUIState ¶ added in v0.56.0
func (sm *StateManager) SetupApprovalUIState(toolCall *sdk.ChatCompletionMessageToolCall, responseChan chan agentdomain.ApprovalAction)
SetupApprovalUIState initializes approval UI state
func (*StateManager) SetupFileSelection ¶ added in v0.27.0
func (sm *StateManager) SetupFileSelection(files []string)
SetupFileSelection initializes file selection state
func (*StateManager) SetupPlanApprovalUIState ¶ added in v0.68.0
func (sm *StateManager) SetupPlanApprovalUIState(planContent, planID string, responseChan chan agentdomain.PlanApprovalAction)
SetupPlanApprovalUIState initializes plan approval UI state
func (*StateManager) SetupUserQuestionUIState ¶ added in v0.124.0
func (sm *StateManager) SetupUserQuestionUIState(questions []agentdomain.UserQuestion, responseChan chan []agentdomain.UserQuestionAnswer)
SetupUserQuestionUIState initializes the AskUserQuestion form state
func (*StateManager) StartChatSession ¶ added in v0.27.0
func (sm *StateManager) StartChatSession(requestID, model string, eventChan <-chan agentdomain.ChatEvent) error
StartChatSession starts a new chat session
func (*StateManager) StartToolExecution ¶ added in v0.27.0
func (sm *StateManager) StartToolExecution(toolCalls []sdk.ChatCompletionMessageToolCall) error
StartToolExecution starts a new tool execution session
func (*StateManager) TouchChatActivity ¶ added in v0.142.0
func (sm *StateManager) TouchChatActivity()
TouchChatActivity records stream output on the current session, clearing any retry status and resetting the stall clock.
func (*StateManager) TransitionToView ¶ added in v0.27.0
func (sm *StateManager) TransitionToView(newView ui.ViewState) error
TransitionToView transitions to a new view with validation and logging
func (*StateManager) UpdateAgentPullProgress ¶ added in v0.149.0
func (sm *StateManager) UpdateAgentPullProgress(name string, done, total int)
UpdateAgentPullProgress updates the image pull layer counts for a specific agent
func (*StateManager) UpdateAgentStatus ¶ added in v0.67.0
func (sm *StateManager) UpdateAgentStatus(name string, state agentdomain.AgentState, message string, url string, image string)
UpdateAgentStatus updates the status of a specific agent
func (*StateManager) UpdateChatStatus ¶ added in v0.27.0
func (sm *StateManager) UpdateChatStatus(status agentdomain.ChatStatus) error
UpdateChatStatus updates the chat session status with validation
func (*StateManager) UpdateFileSearchQuery ¶ added in v0.27.0
func (sm *StateManager) UpdateFileSearchQuery(query string)
UpdateFileSearchQuery updates the file search query
type StrictApprovalPolicy ¶ added in v0.97.0
type StrictApprovalPolicy struct{}
StrictApprovalPolicy is an alternative policy that requires approval for all tools Useful for security-sensitive environments or auditing
func NewStrictApprovalPolicy ¶ added in v0.97.0
func NewStrictApprovalPolicy() *StrictApprovalPolicy
NewStrictApprovalPolicy creates a new strict approval policy
func (*StrictApprovalPolicy) ShouldRequireApproval ¶ added in v0.97.0
func (p *StrictApprovalPolicy) ShouldRequireApproval( ctx context.Context, toolCall *sdk.ChatCompletionMessageToolCall, isChatMode bool, ) bool
ShouldRequireApproval always returns true (approval required for all tools) Exception: Computer use tools still bypass for UX reasons
type ToolFormatterService ¶ added in v0.33.4
type ToolFormatterService struct {
// contains filtered or unexported fields
}
ToolFormatterService provides formatting for tool results by delegating to individual tools
func NewToolFormatterService ¶ added in v0.33.4
func NewToolFormatterService(registry ToolRegistry, styleProvider *styles.Provider) *ToolFormatterService
NewToolFormatterService creates a new tool formatter service
func (*ToolFormatterService) FormatToolCall ¶ added in v0.33.4
func (s *ToolFormatterService) FormatToolCall(toolName string, args map[string]any) string
FormatToolCall formats a tool call for consistent display
func (*ToolFormatterService) FormatToolResultExpanded ¶ added in v0.33.4
func (s *ToolFormatterService) FormatToolResultExpanded(result *agentdomain.ToolExecutionResult, terminalWidth int) string
FormatToolResultExpanded formats the expanded (ctrl+o) tool result: the tool's existing detail tree, themed for consistency with the rest of the UI (accent+bold tool-call line, dim connectors, accent field labels), with a dim collapse hint. The underlying tree text is unchanged, so tool-specific bodies (diffs, raw output) are preserved exactly.
func (*ToolFormatterService) FormatToolResultForLLM ¶ added in v0.33.4
func (s *ToolFormatterService) FormatToolResultForLLM(result *agentdomain.ToolExecutionResult) string
FormatToolResultForLLM formats tool execution results for LLM consumption
func (*ToolFormatterService) FormatToolResultForUI ¶ added in v0.33.4
func (s *ToolFormatterService) FormatToolResultForUI(result *agentdomain.ToolExecutionResult, terminalWidth int) string
FormatToolResultForUI formats the collapsed (default) tool result: a themed status line followed by an indented dim output preview (first 5 lines on success, the full output on failure) and a "+N lines · ctrl+o to expand" footer.
func (*ToolFormatterService) RenderToolSummary ¶ added in v0.143.0
func (s *ToolFormatterService) RenderToolSummary(icon, toolName string, args map[string]any, trailing string, terminalWidth int) string
RenderToolSummary renders the shared "<icon> Name(args) <trailing>" line used by the collapsed status line, the live preview, the approval summary and the queue preview. icon and trailing are already-styled by the caller (each surface owns its own status semantics); the tool name and the width-aware, path-shortened argument preview are formatted identically everywhere, replacing the per-call-site drift (e.g. the old byte-slice `args[:47]` truncation in the live renderer). Pass icon=="" / trailing=="" to omit either segment.
func (*ToolFormatterService) SetHintFormatter ¶ added in v0.118.0
func (s *ToolFormatterService) SetHintFormatter(h HintProvider)
SetHintFormatter wires the keybinding hint resolver so the collapsed and expanded views can show the "ctrl+o to expand/collapse" affordance. Nil is safe - the hint is simply omitted.
func (*ToolFormatterService) SetMaxResultBytes ¶ added in v0.143.0
func (s *ToolFormatterService) SetMaxResultBytes(n int)
SetMaxResultBytes caps the size of a single tool result fed back to the LLM (FormatToolResultForLLM). 0 disables the cap. Wired from tools.max_result_bytes in the container so one oversized tool output can't dominate the context window.
func (*ToolFormatterService) ShouldAlwaysExpandTool ¶ added in v0.36.0
func (s *ToolFormatterService) ShouldAlwaysExpandTool(toolName string) bool
ShouldAlwaysExpandTool checks if a tool result should always be expanded
type ToolRegistry ¶ added in v0.33.4
type ToolRegistry interface {
GetTool(name string) (agentdomain.Tool, error)
ListAvailableTools() []string
}
ToolRegistry interface for accessing tools (implemented by tools.Registry)
Source Files
¶
- agent_manager.go
- agent_manager_additions.go
- agents.go
- approval_policy.go
- channel_commands.go
- channel_manager.go
- file.go
- frame_source_directory.go
- gateway_manager.go
- image_service.go
- mcp_manager.go
- mcp_sse_transport.go
- process_alive.go
- process_alive_unix.go
- prune.go
- state_manager.go
- tool_formatter.go
- tool_result_view.go
- tools.go
Directories
¶
| Path | Synopsis |
|---|---|
|
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 githubissues provides cached, gh-CLI-backed access to the current repository's GitHub issues for the chat input's "#" autocomplete and "#N" inline expansion features.
|
Package githubissues provides cached, gh-CLI-backed access to the current repository's GitHub issues for the chat input's "#" autocomplete and "#N" inline expansion features. |
|
Package githubsetup implements agentdomain.GitHubSetupService for the GitHub Action CI setup flow.
|
Package githubsetup implements agentdomain.GitHubSetupService for the GitHub Action CI setup flow. |
|
Package plugins implements installation and runtime surfacing of Claude Code-format plugins: SKILL.md skills plus an optional AGENTS.md instruction ruleset.
|
Package plugins implements installation and runtime surfacing of Claude Code-format plugins: SKILL.md skills plus an optional AGENTS.md instruction ruleset. |
|
Package provisioner rents on-demand GPU instances running llama.cpp and exposes them as a llamacpp provider endpoint (issue #939).
|
Package provisioner rents on-demand GPU instances running llama.cpp and exposes them as a llamacpp provider endpoint (issue #939). |
|
Package skills implements discovery of Agent Skills.
|
Package skills implements discovery of Agent Skills. |
|
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. |