webui

package
v1.18.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 27, 2026 License: MIT Imports: 30 Imported by: 0

Documentation

Overview

Package webui – media_handlers.go provides HTTP handlers for media upload/download.

Package webui – security_handlers.go implements the security dashboard API endpoints: audit log, tool guard config, vault status, and API keys.

Package webui implements the DevClaw web dashboard. Serves a React SPA (embedded via embed.FS) with a JSON API backend. Chat streaming uses Server-Sent Events (SSE) for real-time token delivery.

Index

Constants

This section is empty.

Variables

View Source
var ErrAgentNotFound = errors.New("agent not found")

ErrAgentNotFound is returned when an agent/workspace is not found.

Functions

func GetDataDir added in v1.12.0

func GetDataDir() (string, error)

GetDataDir returns the default data directory.

Types

type AgentFilesResponse added in v1.16.0

type AgentFilesResponse struct {
	WorkspaceDir string             `json:"workspace_dir"`
	Files        map[string]*string `json:"files"`
	Inherited    map[string]string  `json:"inherited"`
}

AgentFilesResponse is the response from the agent files list endpoint.

type AgentIdentity added in v1.16.0

type AgentIdentity struct {
	Name     string `json:"name,omitempty"`
	Emoji    string `json:"emoji,omitempty"`
	Theme    string `json:"theme,omitempty"`
	Avatar   string `json:"avatar,omitempty"`
	Vibe     string `json:"vibe,omitempty"`
	Creature string `json:"creature,omitempty"`
}

AgentIdentity holds identity/persona fields for an agent.

type AgentInfoAPI added in v1.16.0

type AgentInfoAPI struct {
	ID           string         `json:"id"`
	Name         string         `json:"name"`
	Description  string         `json:"description,omitempty"`
	Model        string         `json:"model,omitempty"`
	Instructions string         `json:"instructions,omitempty"`
	Soul         string         `json:"soul,omitempty"`
	Language     string         `json:"language,omitempty"`
	Timezone     string         `json:"timezone,omitempty"`
	Trigger      string         `json:"trigger,omitempty"`
	Identity     *AgentIdentity `json:"identity,omitempty"`
	Skills       []string       `json:"skills,omitempty"`
	Channels     []string       `json:"channels,omitempty"`
	Members      []string       `json:"members,omitempty"`
	Groups       []string       `json:"groups,omitempty"`
	ToolProfile  string         `json:"tool_profile,omitempty"`
	ToolsAllow   []string       `json:"tools_allow,omitempty"`
	ToolsDeny    []string       `json:"tools_deny,omitempty"`
	MaxTurns     int            `json:"max_turns,omitempty"`
	RunTimeout   int            `json:"run_timeout,omitempty"`
	Default      bool           `json:"default"`
	Active       bool           `json:"active"`
	Source       string         `json:"source,omitempty"`
	CreatedAt    string         `json:"created_at,omitempty"`
	MemberCount  int            `json:"member_count"`
	GroupCount   int            `json:"group_count"`
	SessionCount int            `json:"session_count"`
	WorkspaceDir string         `json:"workspace_dir,omitempty"`
	FileBacked   bool           `json:"file_backed"`
}

AgentInfoAPI is the agent/workspace info type exposed via the API.

type AssistantAPI

type AssistantAPI interface {
	// GetConfig returns the current config as a map.
	GetConfigMap() map[string]any

	// UpdateConfigMap updates config fields and persists to disk.
	UpdateConfigMap(updates map[string]any) error

	// ListSessions returns active session metadata.
	ListSessions() []SessionInfo

	// GetSessionMessages returns messages for a session.
	GetSessionMessages(sessionID string) []MessageInfo

	// GetUsageGlobal returns global token usage stats.
	GetUsageGlobal() UsageInfo

	// GetChannelHealth returns health of all channels.
	GetChannelHealth() []ChannelHealthInfo

	// GetSchedulerJobs returns all scheduler jobs.
	GetSchedulerJobs() []JobInfo

	// ToggleJob enables or disables a scheduler job by ID.
	ToggleJob(id string, enabled bool) error

	// RemoveJob removes a scheduler job by ID.
	RemoveJob(id string) error

	// ListSkills returns available skills.
	ListSkills() []SkillInfo

	// ToggleSkill enables or disables a skill by name.
	ToggleSkill(name string, enabled bool) error

	// RemoveSkill uninstalls a skill by name (removes from registry and disk).
	RemoveSkill(name string) error

	// ReloadSkills reloads the skill registry from disk (after install/remove).
	ReloadSkills() error

	// SendChatMessage sends a message and blocks until the full response is ready.
	// Used as fallback when streaming is not available.
	SendChatMessage(sessionID, content string) (string, error)

	// StartChatStream starts an agent run with streaming.
	// Returns a RunHandle with an event channel and cancel function.
	// The caller is responsible for reading from Events until it's closed.
	StartChatStream(ctx context.Context, sessionID, content string) (*RunHandle, error)

	// AbortRun cancels an active agent run by session ID.
	AbortRun(sessionID string) bool

	// DeleteSession removes a session.
	DeleteSession(sessionID string) error

	// Security
	GetAuditLog(limit int) []AuditEntry
	GetAuditCount() int
	GetToolGuardStatus() ToolGuardStatus
	UpdateToolGuard(update ToolGuardStatus) error
	GetVaultStatus() VaultStatus
	GetSecurityStatus() SecurityStatus

	// Domain & Network
	GetDomainConfig() DomainConfigInfo
	UpdateDomainConfig(update DomainConfigUpdate) error

	// Webhooks
	ListWebhooks() []WebhookInfo
	CreateWebhook(url string, events []string) (WebhookInfo, error)
	DeleteWebhook(id string) error
	ToggleWebhook(id string, active bool) error
	GetValidWebhookEvents() []string

	// Hooks (lifecycle)
	ListHooks() []HookInfo
	ToggleHook(name string, enabled bool) error
	UnregisterHook(name string) error
	GetHookEvents() []HookEventInfo

	// MCP Servers
	ListMCPServers() []MCPServerInfo
	CreateMCPServer(name, command string, args []string, env map[string]string) error
	UpdateMCPServer(name string, enabled bool) error
	DeleteMCPServer(name string) error
	StartMCPServer(name string) error
	StopMCPServer(name string) error

	// Database
	GetDatabaseStatus() DatabaseStatusInfo

	// Settings: Tool Profiles
	ListToolProfiles() []ToolProfileInfo
	GetToolGroups() map[string][]string
	CreateToolProfile(profile ToolProfileDef) error
	UpdateToolProfile(profile ToolProfileDef) error
	DeleteToolProfile(name string) error

	// Auth Profiles for OAuth/API key management
	GetProfileManager() profiles.ProfileManager

	// Models
	ListModels() []ModelInfo

	// Plugins
	ListPlugins() []PluginInfoAPI
	GetPluginInfo(id string) *PluginInfoAPI
	ConfigurePlugin(id string, updates map[string]any) error
	TogglePlugin(id string, enabled bool) error
	InstallPlugin(source string) (*plugins.PluginInstallResult, error)
	RemovePlugin(name string) error

	// Agents
	ListAgents() []AgentInfoAPI
	CreateAgent(req CreateAgentRequest) (string, error)
	GetAgent(id string) (*AgentInfoAPI, error)
	UpdateAgent(id string, req UpdateAgentRequest) error
	DeleteAgent(id string) error
	SetDefaultAgent(id string) error
	ToggleAgent(id string, active bool) error

	// Agent Files
	ListAgentFiles(id string) (*AgentFilesResponse, error)
	UpdateAgentFile(id, filename, content string) error
}

AssistantAPI defines the interface the web UI uses to access assistant state. This avoids a direct dependency on the copilot package.

type AssistantAdapter

type AssistantAdapter struct {
	GetConfigMapFn       func() map[string]any
	UpdateConfigMapFn    func(updates map[string]any) error
	ListSessionsFn       func() []SessionInfo
	GetSessionMessagesFn func(sessionID string) []MessageInfo
	GetUsageGlobalFn     func() UsageInfo
	GetChannelHealthFn   func() []ChannelHealthInfo
	GetSchedulerJobsFn   func() []JobInfo
	ToggleJobFn          func(id string, enabled bool) error
	RemoveJobFn          func(id string) error
	ListSkillsFn         func() []SkillInfo
	ToggleSkillFn        func(name string, enabled bool) error
	RemoveSkillFn        func(name string) error
	ReloadSkillsFn       func() error
	SendChatMessageFn    func(sessionID, content string) (string, error)
	StartChatStreamFn    func(ctx context.Context, sessionID, content string) (*RunHandle, error)
	AbortRunFn           func(sessionID string) bool
	DeleteSessionFn      func(sessionID string) error

	// WhatsApp QR support (default instance)
	GetWhatsAppStatusFn   func() WhatsAppStatus
	SubscribeWhatsAppQRFn func() (chan WhatsAppQREvent, func())
	RequestWhatsAppQRFn   func() error
	DisconnectWhatsAppFn  func() error

	// Instance-aware WhatsApp operations
	GetWhatsAppStatusByInstanceFn   func(instanceID string) WhatsAppStatus
	SubscribeWhatsAppQRByInstanceFn func(instanceID string) (chan WhatsAppQREvent, func())
	RequestWhatsAppQRByInstanceFn   func(instanceID string) error
	DisconnectWhatsAppByInstanceFn  func(instanceID string) error

	// Channel instance management (all channel types)
	ListChannelInstancesFn  func(channelType string) []ChannelInstanceInfo
	CreateChannelInstanceFn func(channelType, instanceID string, config map[string]any) error
	DeleteChannelInstanceFn func(channelType, instanceID string) error

	// WhatsApp Access & Groups
	GetWhatsAppAccessConfigFn           func() WhatsAppAccessConfig
	GrantWhatsAppUserAccessFn           func(jid, level string) error
	RevokeWhatsAppUserAccessFn          func(jid string) error
	BlockWhatsAppUserFn                 func(jid string) error
	UnblockWhatsAppUserFn               func(jid string) error
	GetWhatsAppGroupPoliciesFn          func() WhatsAppGroupPolicies
	SetWhatsAppGroupPolicyFn            func(jid string, policy any) error
	UpdateWhatsAppGroupDefaultPolicyFn  func(policy string) error
	UpdateWhatsAppAccessDefaultPolicyFn func(policy string) error
	GetWhatsAppJoinedGroupsFn           func() ([]WhatsAppJoinedGroup, error)
	GetWhatsAppConfigFn                 func() map[string]any
	UpdateWhatsAppConfigFn              func(config map[string]any) error

	// Telegram
	GetTelegramConfigFn    func() TelegramConfig
	UpdateTelegramConfigFn func(config map[string]any) error
	ConnectTelegramFn      func(token string) error
	DisconnectTelegramFn   func() error

	// Telegram Access
	GetTelegramAccessConfigFn           func() TelegramAccessConfig
	UpdateTelegramAccessDefaultPolicyFn func(policy string) error
	GrantTelegramUserAccessFn           func(id, level string) error
	RevokeTelegramUserAccessFn          func(id string) error
	BlockTelegramUserFn                 func(id string) error
	UnblockTelegramUserFn               func(id string) error

	// Security: Audit Log
	GetAuditLogFn   func(limit int) []AuditEntry
	GetAuditCountFn func() int

	// Security: Tool Guard
	GetToolGuardStatusFn func() ToolGuardStatus
	UpdateToolGuardFn    func(update ToolGuardStatus) error

	// Security: Vault (read-only, no values)
	GetVaultStatusFn func() VaultStatus

	// Security: Overview
	GetSecurityStatusFn func() SecurityStatus

	// Domain & Network
	GetDomainConfigFn    func() DomainConfigInfo
	UpdateDomainConfigFn func(update DomainConfigUpdate) error

	// Webhooks
	ListWebhooksFn          func() []WebhookInfo
	CreateWebhookFn         func(url string, events []string) (WebhookInfo, error)
	DeleteWebhookFn         func(id string) error
	ToggleWebhookFn         func(id string, active bool) error
	GetValidWebhookEventsFn func() []string

	// Hooks (lifecycle)
	ListHooksFn      func() []HookInfo
	ToggleHookFn     func(name string, enabled bool) error
	UnregisterHookFn func(name string) error
	GetHookEventsFn  func() []HookEventInfo

	// MCP Servers
	ListMCPServersFn  func() []MCPServerInfo
	CreateMCPServerFn func(name, command string, args []string, env map[string]string) error
	UpdateMCPServerFn func(name string, enabled bool) error
	DeleteMCPServerFn func(name string) error
	StartMCPServerFn  func(name string) error
	StopMCPServerFn   func(name string) error

	// Database
	GetDatabaseStatusFn func() DatabaseStatusInfo

	// Settings: Tool Profiles
	ListToolProfilesFn  func() []ToolProfileInfo
	CreateToolProfileFn func(profile ToolProfileDef) error
	UpdateToolProfileFn func(name string, profile ToolProfileDef) error
	DeleteToolProfileFn func(name string) error

	// Auth Profiles
	GetProfileManagerFn func() profiles.ProfileManager

	// Plugins
	ListPluginsFn     func() []PluginInfoAPI
	GetPluginInfoFn   func(id string) *PluginInfoAPI
	ConfigurePluginFn func(id string, updates map[string]any) error
	TogglePluginFn    func(id string, enabled bool) error
	InstallPluginFn   func(source string) (*plugins.PluginInstallResult, error)
	RemovePluginFn    func(name string) error

	// Models
	ListModelsFn func() []ModelInfo

	// Agents
	ListAgentsFn      func() []AgentInfoAPI
	CreateAgentFn     func(req CreateAgentRequest) (string, error)
	GetAgentFn        func(id string) (*AgentInfoAPI, error)
	UpdateAgentFn     func(id string, req UpdateAgentRequest) error
	DeleteAgentFn     func(id string) error
	SetDefaultAgentFn func(id string) error
	ToggleAgentFn     func(id string, active bool) error

	// Agent Files
	ListAgentFilesFn  func(id string) (*AgentFilesResponse, error)
	UpdateAgentFileFn func(id, filename, content string) error
}

AssistantAdapter wraps a generic set of callbacks to satisfy the AssistantAPI interface. This avoids a direct import cycle between copilot and webui.

func (*AssistantAdapter) AbortRun

func (a *AssistantAdapter) AbortRun(sessionID string) bool

func (*AssistantAdapter) BlockTelegramUser added in v1.16.5

func (a *AssistantAdapter) BlockTelegramUser(id string) error

func (*AssistantAdapter) BlockWhatsAppUser added in v1.13.0

func (a *AssistantAdapter) BlockWhatsAppUser(jid string) error

func (*AssistantAdapter) ConfigurePlugin added in v1.16.0

func (a *AssistantAdapter) ConfigurePlugin(id string, updates map[string]any) error

func (*AssistantAdapter) ConnectTelegram added in v1.16.0

func (a *AssistantAdapter) ConnectTelegram(token string) error

func (*AssistantAdapter) CreateAgent added in v1.16.0

func (a *AssistantAdapter) CreateAgent(req CreateAgentRequest) (string, error)

func (*AssistantAdapter) CreateMCPServer added in v1.8.0

func (a *AssistantAdapter) CreateMCPServer(name, command string, args []string, env map[string]string) error

func (*AssistantAdapter) CreateToolProfile added in v1.12.0

func (a *AssistantAdapter) CreateToolProfile(profile ToolProfileDef) error

func (*AssistantAdapter) CreateWebhook

func (a *AssistantAdapter) CreateWebhook(url string, events []string) (WebhookInfo, error)

func (*AssistantAdapter) DeleteAgent added in v1.16.0

func (a *AssistantAdapter) DeleteAgent(id string) error

func (*AssistantAdapter) DeleteMCPServer added in v1.8.0

func (a *AssistantAdapter) DeleteMCPServer(name string) error

func (*AssistantAdapter) DeleteSession

func (a *AssistantAdapter) DeleteSession(sessionID string) error

func (*AssistantAdapter) DeleteToolProfile added in v1.12.0

func (a *AssistantAdapter) DeleteToolProfile(name string) error

func (*AssistantAdapter) DeleteWebhook

func (a *AssistantAdapter) DeleteWebhook(id string) error

func (*AssistantAdapter) DisconnectTelegram added in v1.16.0

func (a *AssistantAdapter) DisconnectTelegram() error

func (*AssistantAdapter) DisconnectWhatsApp added in v1.13.0

func (a *AssistantAdapter) DisconnectWhatsApp() error

func (*AssistantAdapter) GetAgent added in v1.16.0

func (a *AssistantAdapter) GetAgent(id string) (*AgentInfoAPI, error)

func (*AssistantAdapter) GetAuditCount

func (a *AssistantAdapter) GetAuditCount() int

func (*AssistantAdapter) GetAuditLog

func (a *AssistantAdapter) GetAuditLog(limit int) []AuditEntry

func (*AssistantAdapter) GetChannelHealth

func (a *AssistantAdapter) GetChannelHealth() []ChannelHealthInfo

func (*AssistantAdapter) GetConfigMap

func (a *AssistantAdapter) GetConfigMap() map[string]any

func (*AssistantAdapter) GetDatabaseStatus added in v1.8.0

func (a *AssistantAdapter) GetDatabaseStatus() DatabaseStatusInfo

func (*AssistantAdapter) GetDomainConfig

func (a *AssistantAdapter) GetDomainConfig() DomainConfigInfo

func (*AssistantAdapter) GetHookEvents

func (a *AssistantAdapter) GetHookEvents() []HookEventInfo

func (*AssistantAdapter) GetPluginInfo added in v1.16.0

func (a *AssistantAdapter) GetPluginInfo(id string) *PluginInfoAPI

func (*AssistantAdapter) GetProfileManager added in v1.13.0

func (a *AssistantAdapter) GetProfileManager() profiles.ProfileManager

GetProfileManager returns the auth profile manager for OAuth/API key management.

func (*AssistantAdapter) GetSchedulerJobs

func (a *AssistantAdapter) GetSchedulerJobs() []JobInfo

func (*AssistantAdapter) GetSecurityStatus

func (a *AssistantAdapter) GetSecurityStatus() SecurityStatus

func (*AssistantAdapter) GetSessionMessages

func (a *AssistantAdapter) GetSessionMessages(sessionID string) []MessageInfo

func (*AssistantAdapter) GetTelegramAccessConfig added in v1.16.5

func (a *AssistantAdapter) GetTelegramAccessConfig() TelegramAccessConfig

func (*AssistantAdapter) GetTelegramConfig added in v1.16.0

func (a *AssistantAdapter) GetTelegramConfig() TelegramConfig

func (*AssistantAdapter) GetToolGroups added in v1.12.0

func (a *AssistantAdapter) GetToolGroups() map[string][]string

func (*AssistantAdapter) GetToolGuardStatus

func (a *AssistantAdapter) GetToolGuardStatus() ToolGuardStatus

func (*AssistantAdapter) GetUsageGlobal

func (a *AssistantAdapter) GetUsageGlobal() UsageInfo

func (*AssistantAdapter) GetValidWebhookEvents

func (a *AssistantAdapter) GetValidWebhookEvents() []string

func (*AssistantAdapter) GetVaultStatus

func (a *AssistantAdapter) GetVaultStatus() VaultStatus

func (*AssistantAdapter) GetWhatsAppAccessConfig added in v1.13.0

func (a *AssistantAdapter) GetWhatsAppAccessConfig() WhatsAppAccessConfig

func (*AssistantAdapter) GetWhatsAppConfig added in v1.13.0

func (a *AssistantAdapter) GetWhatsAppConfig() map[string]any

func (*AssistantAdapter) GetWhatsAppGroupPolicies added in v1.13.0

func (a *AssistantAdapter) GetWhatsAppGroupPolicies() WhatsAppGroupPolicies

func (*AssistantAdapter) GetWhatsAppJoinedGroups added in v1.13.0

func (a *AssistantAdapter) GetWhatsAppJoinedGroups() ([]WhatsAppJoinedGroup, error)

func (*AssistantAdapter) GrantTelegramUserAccess added in v1.16.5

func (a *AssistantAdapter) GrantTelegramUserAccess(id, level string) error

func (*AssistantAdapter) GrantWhatsAppUserAccess added in v1.13.0

func (a *AssistantAdapter) GrantWhatsAppUserAccess(jid, level string) error

func (*AssistantAdapter) InstallPlugin added in v1.16.0

func (a *AssistantAdapter) InstallPlugin(source string) (*plugins.PluginInstallResult, error)

func (*AssistantAdapter) ListAgentFiles added in v1.16.0

func (a *AssistantAdapter) ListAgentFiles(id string) (*AgentFilesResponse, error)

func (*AssistantAdapter) ListAgents added in v1.16.0

func (a *AssistantAdapter) ListAgents() []AgentInfoAPI

func (*AssistantAdapter) ListHooks

func (a *AssistantAdapter) ListHooks() []HookInfo

func (*AssistantAdapter) ListMCPServers added in v1.8.0

func (a *AssistantAdapter) ListMCPServers() []MCPServerInfo

func (*AssistantAdapter) ListModels added in v1.16.0

func (a *AssistantAdapter) ListModels() []ModelInfo

func (*AssistantAdapter) ListPlugins added in v1.16.0

func (a *AssistantAdapter) ListPlugins() []PluginInfoAPI

func (*AssistantAdapter) ListSessions

func (a *AssistantAdapter) ListSessions() []SessionInfo

func (*AssistantAdapter) ListSkills

func (a *AssistantAdapter) ListSkills() []SkillInfo

func (*AssistantAdapter) ListToolProfiles added in v1.12.0

func (a *AssistantAdapter) ListToolProfiles() []ToolProfileInfo

func (*AssistantAdapter) ListWebhooks

func (a *AssistantAdapter) ListWebhooks() []WebhookInfo

func (*AssistantAdapter) ReloadSkills added in v1.13.0

func (a *AssistantAdapter) ReloadSkills() error

func (*AssistantAdapter) RemoveJob added in v1.13.0

func (a *AssistantAdapter) RemoveJob(id string) error

func (*AssistantAdapter) RemovePlugin added in v1.16.0

func (a *AssistantAdapter) RemovePlugin(name string) error

func (*AssistantAdapter) RemoveSkill added in v1.13.0

func (a *AssistantAdapter) RemoveSkill(name string) error

func (*AssistantAdapter) RevokeTelegramUserAccess added in v1.16.5

func (a *AssistantAdapter) RevokeTelegramUserAccess(id string) error

func (*AssistantAdapter) RevokeWhatsAppUserAccess added in v1.13.0

func (a *AssistantAdapter) RevokeWhatsAppUserAccess(jid string) error

func (*AssistantAdapter) SendChatMessage

func (a *AssistantAdapter) SendChatMessage(sessionID, content string) (string, error)

func (*AssistantAdapter) SetDefaultAgent added in v1.16.0

func (a *AssistantAdapter) SetDefaultAgent(id string) error

func (*AssistantAdapter) SetWhatsAppGroupPolicy added in v1.13.0

func (a *AssistantAdapter) SetWhatsAppGroupPolicy(jid string, policy any) error

func (*AssistantAdapter) StartChatStream

func (a *AssistantAdapter) StartChatStream(ctx context.Context, sessionID, content string) (*RunHandle, error)

func (*AssistantAdapter) StartMCPServer added in v1.8.0

func (a *AssistantAdapter) StartMCPServer(name string) error

func (*AssistantAdapter) StopMCPServer added in v1.8.0

func (a *AssistantAdapter) StopMCPServer(name string) error

func (*AssistantAdapter) ToggleAgent added in v1.16.0

func (a *AssistantAdapter) ToggleAgent(id string, active bool) error

func (*AssistantAdapter) ToggleHook

func (a *AssistantAdapter) ToggleHook(name string, enabled bool) error

func (*AssistantAdapter) ToggleJob added in v1.13.0

func (a *AssistantAdapter) ToggleJob(id string, enabled bool) error

func (*AssistantAdapter) TogglePlugin added in v1.16.0

func (a *AssistantAdapter) TogglePlugin(id string, enabled bool) error

func (*AssistantAdapter) ToggleSkill

func (a *AssistantAdapter) ToggleSkill(name string, enabled bool) error

func (*AssistantAdapter) ToggleWebhook

func (a *AssistantAdapter) ToggleWebhook(id string, active bool) error

func (*AssistantAdapter) UnblockTelegramUser added in v1.16.5

func (a *AssistantAdapter) UnblockTelegramUser(id string) error

func (*AssistantAdapter) UnblockWhatsAppUser added in v1.13.0

func (a *AssistantAdapter) UnblockWhatsAppUser(jid string) error

func (*AssistantAdapter) UnregisterHook

func (a *AssistantAdapter) UnregisterHook(name string) error

func (*AssistantAdapter) UpdateAgent added in v1.16.0

func (a *AssistantAdapter) UpdateAgent(id string, req UpdateAgentRequest) error

func (*AssistantAdapter) UpdateAgentFile added in v1.16.0

func (a *AssistantAdapter) UpdateAgentFile(id, filename, content string) error

func (*AssistantAdapter) UpdateConfigMap

func (a *AssistantAdapter) UpdateConfigMap(updates map[string]any) error

func (*AssistantAdapter) UpdateDomainConfig

func (a *AssistantAdapter) UpdateDomainConfig(update DomainConfigUpdate) error

func (*AssistantAdapter) UpdateMCPServer added in v1.8.0

func (a *AssistantAdapter) UpdateMCPServer(name string, enabled bool) error

func (*AssistantAdapter) UpdateTelegramAccessDefaultPolicy added in v1.16.5

func (a *AssistantAdapter) UpdateTelegramAccessDefaultPolicy(policy string) error

func (*AssistantAdapter) UpdateTelegramConfig added in v1.16.0

func (a *AssistantAdapter) UpdateTelegramConfig(config map[string]any) error

func (*AssistantAdapter) UpdateToolGuard

func (a *AssistantAdapter) UpdateToolGuard(update ToolGuardStatus) error

func (*AssistantAdapter) UpdateToolProfile added in v1.12.0

func (a *AssistantAdapter) UpdateToolProfile(profile ToolProfileDef) error

func (*AssistantAdapter) UpdateWhatsAppAccessDefaultPolicy added in v1.13.0

func (a *AssistantAdapter) UpdateWhatsAppAccessDefaultPolicy(policy string) error

func (*AssistantAdapter) UpdateWhatsAppConfig added in v1.13.0

func (a *AssistantAdapter) UpdateWhatsAppConfig(config map[string]any) error

func (*AssistantAdapter) UpdateWhatsAppGroupDefaultPolicy added in v1.13.0

func (a *AssistantAdapter) UpdateWhatsAppGroupDefaultPolicy(policy string) error

type AuditEntry

type AuditEntry struct {
	ID            int64  `json:"id"`
	Tool          string `json:"tool"`
	Caller        string `json:"caller"`
	Level         string `json:"level"`
	Allowed       bool   `json:"allowed"`
	ArgsSummary   string `json:"args_summary"`
	ResultSummary string `json:"result_summary"`
	CreatedAt     string `json:"created_at"`
}

AuditEntry represents a single audit log record for the UI.

type ChannelHealthInfo

type ChannelHealthInfo struct {
	Name       string    `json:"name"`
	AccountID  string    `json:"account_id,omitempty"`
	FullID     string    `json:"full_id"`
	Connected  bool      `json:"connected"`
	ErrorCount int       `json:"error_count"`
	LastMsgAt  time.Time `json:"last_msg_at"`
	Configured bool      `json:"configured"`
}

ChannelHealthInfo contains channel health for display.

type ChannelInstanceInfo added in v1.16.0

type ChannelInstanceInfo struct {
	Type       string `json:"type"`        // "whatsapp", "telegram", etc.
	InstanceID string `json:"instance_id"` // "" for default, "business" for named
	FullName   string `json:"full_name"`   // "whatsapp" or "whatsapp:business"
	Label      string `json:"label"`       // Display name: "WhatsApp" or "WhatsApp (business)"
	Connected  bool   `json:"connected"`
	Configured bool   `json:"configured"`
	NeedsQR    bool   `json:"needs_qr"`
	ErrorCount int    `json:"error_count"`
}

ChannelInstanceInfo describes a single channel instance for the UI.

type Config

type Config struct {
	// Enabled turns the web UI on/off.
	Enabled bool `yaml:"enabled"`

	// Address is the listen address (default: ":47716").
	Address string `yaml:"address"`

	// AuthToken is the Bearer token for authentication (empty = no auth).
	AuthToken string `yaml:"auth_token"`

	// TLS configures HTTPS for the WebUI.
	TLS TLSConfig `yaml:"tls"`
}

Config holds web UI configuration.

type CreateAgentRequest added in v1.16.0

type CreateAgentRequest struct {
	ID           string         `json:"id"`
	Name         string         `json:"name"`
	Description  string         `json:"description,omitempty"`
	Model        string         `json:"model,omitempty"`
	Instructions string         `json:"instructions,omitempty"`
	Soul         string         `json:"soul,omitempty"`
	Language     string         `json:"language,omitempty"`
	Identity     *AgentIdentity `json:"identity,omitempty"`
	Skills       []string       `json:"skills,omitempty"`
	Channels     []string       `json:"channels,omitempty"`
	ToolProfile  string         `json:"tool_profile,omitempty"`
	MaxTurns     int            `json:"max_turns,omitempty"`
	RunTimeout   int            `json:"run_timeout,omitempty"`
}

CreateAgentRequest is the request body for creating a new agent.

type DatabaseStatusInfo added in v1.8.0

type DatabaseStatusInfo struct {
	Name         string `json:"name"`
	Healthy      bool   `json:"healthy"`
	Latency      int64  `json:"latency"` // ms
	Version      string `json:"version"`
	OpenConns    int    `json:"open_connections"`
	InUse        int    `json:"in_use"`
	Idle         int    `json:"idle"`
	WaitCount    int    `json:"wait_count"`
	WaitDuration int64  `json:"wait_duration"` // ms
	MaxOpenConns int    `json:"max_open_conns"`
	Error        string `json:"error,omitempty"`
}

DatabaseStatusInfo contains database health status for the UI.

type DeviceCodeProvider added in v1.12.0

type DeviceCodeProvider interface {
	Name() string
	StartDeviceFlow(ctx context.Context) (*oauth.DeviceCodeResponse, error)
	PollForToken(ctx context.Context, deviceCode string, interval time.Duration) (*oauth.OAuthCredential, error)
}

DeviceCodeProvider is the interface for device code OAuth providers.

type DomainConfigInfo

type DomainConfigInfo struct {
	// WebUI settings
	WebuiAddress   string `json:"webui_address"`
	WebuiAuthToken bool   `json:"webui_auth_configured"` // never expose the actual token

	// Gateway API settings
	GatewayEnabled   bool     `json:"gateway_enabled"`
	GatewayAddress   string   `json:"gateway_address"`
	GatewayAuthToken bool     `json:"gateway_auth_configured"`
	CORSOrigins      []string `json:"cors_origins"`

	// TLS settings
	WebuiTLSEnabled   bool   `json:"webui_tls_enabled"`
	GatewayTLSEnabled bool   `json:"gateway_tls_enabled"`
	TLSCertPath       string `json:"tls_cert_path"`
	TLSFingerprint    string `json:"tls_fingerprint,omitempty"`

	// Tailscale settings
	TailscaleEnabled  bool   `json:"tailscale_enabled"`
	TailscaleServe    bool   `json:"tailscale_serve"`
	TailscaleFunnel   bool   `json:"tailscale_funnel"`
	TailscalePort     int    `json:"tailscale_port"`
	TailscaleHostname string `json:"tailscale_hostname"`
	TailscaleURL      string `json:"tailscale_url"` // resolved URL if active

	// Computed URLs
	WebuiURL   string `json:"webui_url"`
	GatewayURL string `json:"gateway_url"`
	PublicURL  string `json:"public_url"` // tailscale funnel URL if active
}

DomainConfigInfo contains domain/network configuration for the UI.

type DomainConfigUpdate

type DomainConfigUpdate struct {
	WebuiAddress     *string  `json:"webui_address,omitempty"`
	WebuiAuthToken   *string  `json:"webui_auth_token,omitempty"`
	GatewayEnabled   *bool    `json:"gateway_enabled,omitempty"`
	GatewayAddress   *string  `json:"gateway_address,omitempty"`
	GatewayAuthToken *string  `json:"gateway_auth_token,omitempty"`
	CORSOrigins      []string `json:"cors_origins,omitempty"`
	TailscaleEnabled *bool    `json:"tailscale_enabled,omitempty"`
	TailscaleServe   *bool    `json:"tailscale_serve,omitempty"`
	TailscaleFunnel  *bool    `json:"tailscale_funnel,omitempty"`
	TailscalePort    *int     `json:"tailscale_port,omitempty"`
}

DomainConfigUpdate contains the mutable domain/network fields from the UI.

type HookEventInfo

type HookEventInfo struct {
	Event       string   `json:"event"`
	Description string   `json:"description"`
	Hooks       []string `json:"hooks"` // names of hooks subscribed to this event
}

HookEventInfo describes a supported hook event.

type HookInfo

type HookInfo struct {
	Name        string   `json:"name"`
	Description string   `json:"description"`
	Source      string   `json:"source"`
	Events      []string `json:"events"`
	Priority    int      `json:"priority"`
	Enabled     bool     `json:"enabled"`
}

HookInfo contains lifecycle hook metadata for the UI.

type HubConfig added in v1.13.0

type HubConfig struct {
	Enabled bool
	HubURL  string
	APIKey  string
}

HubConfig holds OAuth Hub configuration for Hub mode.

type JobInfo

type JobInfo struct {
	ID        string    `json:"id"`
	Schedule  string    `json:"schedule"`
	Type      string    `json:"type"`
	Command   string    `json:"command"`
	Enabled   bool      `json:"enabled"`
	RunCount  int       `json:"run_count"`
	LastRunAt time.Time `json:"last_run_at"`
	LastError string    `json:"last_error"`
}

JobInfo contains scheduler job info for display.

type MCPServerInfo added in v1.8.0

type MCPServerInfo struct {
	Name    string            `json:"name"`
	Command string            `json:"command"`
	Args    []string          `json:"args"`
	Env     map[string]string `json:"env"`
	Enabled bool              `json:"enabled"`
	Status  string            `json:"status"` // running, stopped, error
	Error   string            `json:"error,omitempty"`
}

MCPServerInfo contains MCP server info for the UI.

type MediaAPI added in v1.8.0

type MediaAPI interface {
	// Upload stores media and returns its ID, type, and URL.
	Upload(r *http.Request, sessionID string) (mediaID string, mediaType string, filename string, size int64, err error)

	// Get retrieves media by ID.
	Get(mediaID string) ([]byte, string, string, error) // data, mimeType, filename, error

	// List returns media matching the filter.
	List(sessionID string, mediaType string, limit int) ([]MediaInfo, error)

	// Delete removes media by ID.
	Delete(mediaID string) error
}

MediaAPI defines the interface for media operations. Implemented by the media service adapter in the copilot package.

type MediaAdapter added in v1.8.0

type MediaAdapter struct {
	UploadFn func(r *http.Request, sessionID string) (mediaID string, mediaType string, filename string, size int64, err error)
	GetFn    func(mediaID string) ([]byte, string, string, error)
	ListFn   func(sessionID string, mediaType string, limit int) ([]MediaInfo, error)
	DeleteFn func(mediaID string) error
}

MediaAdapter wraps a MediaService to implement the MediaAPI interface. This avoids importing the media package directly in webui.

func (*MediaAdapter) Delete added in v1.8.0

func (m *MediaAdapter) Delete(mediaID string) error

Delete implements MediaAPI.Delete.

func (*MediaAdapter) Get added in v1.8.0

func (m *MediaAdapter) Get(mediaID string) ([]byte, string, string, error)

Get implements MediaAPI.Get.

func (*MediaAdapter) List added in v1.8.0

func (m *MediaAdapter) List(sessionID string, mediaType string, limit int) ([]MediaInfo, error)

List implements MediaAPI.List.

func (*MediaAdapter) Upload added in v1.8.0

func (m *MediaAdapter) Upload(r *http.Request, sessionID string) (string, string, string, int64, error)

Upload implements MediaAPI.Upload.

type MediaInfo added in v1.8.0

type MediaInfo struct {
	ID        string `json:"id"`
	Filename  string `json:"filename"`
	Type      string `json:"type"`
	Size      int64  `json:"size"`
	URL       string `json:"url"`
	CreatedAt string `json:"created_at"`
}

MediaInfo contains media metadata for the UI.

type MessageInfo

type MessageInfo struct {
	Role      string    `json:"role"`
	Content   string    `json:"content"`
	Timestamp time.Time `json:"timestamp"`
}

MessageInfo contains a single message for display.

type ModelInfo added in v1.16.0

type ModelInfo struct {
	ID       string `json:"id"`       // e.g. "claude-sonnet-4-20250514"
	Name     string `json:"name"`     // e.g. "Claude Sonnet 4"
	Provider string `json:"provider"` // e.g. "anthropic"
}

ModelInfo contains model info for API responses.

type OAuthAPI added in v1.12.0

type OAuthAPI interface {
	// TokenManager returns the OAuth token manager
	GetTokenManager() *oauth.TokenManager
}

OAuthAPI provides OAuth operations for the web UI.

type OAuthHandlers added in v1.12.0

type OAuthHandlers struct {
	// contains filtered or unexported fields
}

OAuthHandlers manages OAuth-related HTTP handlers.

func NewOAuthHandlers added in v1.12.0

func NewOAuthHandlers(dataDir string, logger *slog.Logger) (*OAuthHandlers, error)

NewOAuthHandlers creates new OAuth handlers.

func (*OAuthHandlers) RegisterRoutes added in v1.12.0

func (h *OAuthHandlers) RegisterRoutes(mux *http.ServeMux, authMiddleware func(http.HandlerFunc) http.HandlerFunc)

RegisterRoutes registers OAuth routes on the mux.

func (*OAuthHandlers) SetHubConfig added in v1.13.0

func (h *OAuthHandlers) SetHubConfig(cfg *HubConfig)

SetHubConfig enables Hub mode for OAuth operations.

func (*OAuthHandlers) SetHubURLSaver added in v1.13.0

func (h *OAuthHandlers) SetHubURLSaver(fn func(hubURL string) error)

SetHubURLSaver sets the callback for persisting the Hub URL to config.

func (*OAuthHandlers) SetSecretSaver added in v1.13.0

func (h *OAuthHandlers) SetSecretSaver(fn func(name, value string) error)

SetSecretSaver sets the callback for storing secrets in the vault.

func (*OAuthHandlers) SetSkillBundleInstaller added in v1.13.0

func (h *OAuthHandlers) SetSkillBundleInstaller(fn func(name string, files map[string]string) error)

SetSkillBundleInstaller sets the callback for writing multi-file skill bundles.

func (*OAuthHandlers) SetSkillInstaller added in v1.13.0

func (h *OAuthHandlers) SetSkillInstaller(fn func(name, content string) error)

SetSkillInstaller sets the callback for writing skills to disk and reloading the registry.

func (*OAuthHandlers) SetSkillReferenceRemover added in v1.13.0

func (h *OAuthHandlers) SetSkillReferenceRemover(fn func(skillName, refPath string) error)

SetSkillReferenceRemover sets the callback for removing skill reference files.

func (*OAuthHandlers) Stop added in v1.12.0

func (h *OAuthHandlers) Stop()

Stop stops the OAuth handlers.

func (*OAuthHandlers) TokenManager added in v1.12.0

func (h *OAuthHandlers) TokenManager() *oauth.TokenManager

TokenManager returns the token manager.

type OAuthProviderInfo added in v1.12.0

type OAuthProviderInfo struct {
	ID           string `json:"id"`
	Label        string `json:"label"`
	FlowType     string `json:"flow_type"` // "pkce" or "device_code"
	Experimental bool   `json:"experimental,omitempty"`
}

OAuthProviderInfo contains provider info for the UI.

type OAuthStartResponse added in v1.12.0

type OAuthStartResponse struct {
	FlowType     string `json:"flow_type"`
	AuthURL      string `json:"auth_url,omitempty"` // For PKCE flow
	Provider     string `json:"provider"`
	UserCode     string `json:"user_code,omitempty"`    // For device code flow
	VerifyURL    string `json:"verify_url,omitempty"`   // For device code flow
	ExpiresIn    int    `json:"expires_in,omitempty"`   // For device code flow
	Experimental bool   `json:"experimental,omitempty"` // Warning flag
}

OAuthStartResponse is returned when starting an OAuth flow.

type PKCEProvider added in v1.12.0

type PKCEProvider interface {
	Name() string
	Label() string
	AuthURL(state, challenge string) string
	ExchangeCode(ctx context.Context, code, verifier string) (*oauth.OAuthCredential, error)
	RedirectPort() int
}

PKCEProvider is the interface for PKCE-based OAuth providers.

type PluginInfoAPI added in v1.16.0

type PluginInfoAPI = plugins.PluginInfo

PluginInfoAPI is the plugin info type exposed via the API.

type RunHandle

type RunHandle struct {
	RunID     string
	SessionID string
	Events    chan StreamEvent // Backend pushes events here; handler writes SSE.
	Cancel    context.CancelFunc
}

RunHandle represents an active agent run that can stream events and be aborted.

type SecurityStatus

type SecurityStatus struct {
	GatewayAuthConfigured bool `json:"gateway_auth_configured"`
	WebUIAuthConfigured   bool `json:"webui_auth_configured"`
	ToolGuardEnabled      bool `json:"tool_guard_enabled"`
	VaultExists           bool `json:"vault_exists"`
	VaultUnlocked         bool `json:"vault_unlocked"`
	AuditEntryCount       int  `json:"audit_entry_count"`
}

SecurityStatus is an overview returned at /api/security.

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server is the web UI HTTP server.

func New

func New(cfg Config, api AssistantAPI, logger *slog.Logger) *Server

New creates a new web UI server.

func (*Server) GetOAuthHandlers added in v1.12.0

func (s *Server) GetOAuthHandlers() *OAuthHandlers

GetOAuthHandlers returns the OAuth handlers (may be nil).

func (*Server) OnRestartRequested added in v1.13.0

func (s *Server) OnRestartRequested(fn func() error)

OnRestartRequested registers a callback invoked when the user requests a restart.

func (*Server) OnSetupDone

func (s *Server) OnSetupDone(fn func())

OnSetupDone registers a callback invoked when the setup wizard finishes.

func (*Server) OnUpdateRequested added in v1.13.0

func (s *Server) OnUpdateRequested(fn func() error)

OnUpdateRequested registers a callback invoked when the user requests an update.

func (*Server) OnVaultInit

func (s *Server) OnVaultInit(fn func(password string, secrets map[string]string) error)

OnVaultInit registers a callback to create the encrypted vault during setup.

func (*Server) SetAuthToken added in v1.13.0

func (s *Server) SetAuthToken(token string)

SetAuthToken updates the auth token at runtime (e.g. when changed via the domain settings page).

func (*Server) SetMediaAPI added in v1.8.0

func (s *Server) SetMediaAPI(api MediaAPI)

SetMediaAPI sets the media API for file upload/download operations.

func (*Server) SetOAuthHandlers added in v1.12.0

func (s *Server) SetOAuthHandlers(handlers *OAuthHandlers)

SetOAuthHandlers sets the OAuth handlers for OAuth endpoints.

func (*Server) SetSetupMode

func (s *Server) SetSetupMode(enabled bool)

SetSetupMode enables setup-only mode (no assistant, only setup + auth endpoints).

func (*Server) SetUpdateChecker added in v1.13.0

func (s *Server) SetUpdateChecker(uc UpdateChecker)

SetUpdateChecker sets the update checker for update endpoints.

func (*Server) SetVersion added in v1.13.0

func (s *Server) SetVersion(v string)

SetVersion sets the current binary version for the version endpoint.

func (*Server) Start

func (s *Server) Start(ctx context.Context) error

Start begins serving the web UI.

func (*Server) Stop

func (s *Server) Stop()

Stop gracefully shuts down the web UI server.

type SessionInfo

type SessionInfo struct {
	ID            string    `json:"id"`
	Channel       string    `json:"channel"`
	ChatID        string    `json:"chat_id"`
	Title         string    `json:"title,omitempty"`
	MessageCount  int       `json:"message_count"`
	LastMessageAt time.Time `json:"last_message_at"`
	CreatedAt     time.Time `json:"created_at"`
}

SessionInfo contains session metadata for the UI.

type SetupRequest

type SetupRequest struct {
	Name          string          `json:"name"`
	Language      string          `json:"language"`
	Timezone      string          `json:"timezone"`
	Provider      string          `json:"provider"`
	APIKey        string          `json:"apiKey"`
	Model         string          `json:"model"`
	BaseURL       string          `json:"baseUrl"`
	OwnerPhone    string          `json:"ownerPhone"`
	WebuiPassword string          `json:"webuiPassword"`
	Password      string          `json:"password"` // V2 wizard sends "password"
	VaultPassword string          `json:"vaultPassword"`
	AccessMode    string          `json:"accessMode"`
	Channels      map[string]bool `json:"channels"`
	EnabledSkills []string        `json:"enabledSkills"`
}

SetupRequest contains all data from the setup wizard frontend.

type SkillInfo

type SkillInfo struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	Enabled     bool   `json:"enabled"`
	ToolCount   int    `json:"tool_count"`
}

SkillInfo contains skill info for display.

type StreamEvent

type StreamEvent struct {
	Type string `json:"type"` // delta, tool_use, tool_result, done, error
	Data any    `json:"data"`
}

StreamEvent is a typed SSE event sent to the frontend.

type TLSConfig added in v1.16.0

type TLSConfig struct {
	// Enabled turns TLS on/off (default: false).
	Enabled bool `yaml:"enabled"`

	// AutoGenerate auto-generates self-signed certificates if they don't exist (default: true).
	AutoGenerate bool `yaml:"auto_generate"`

	// CertPath is the path to the TLS certificate PEM file.
	CertPath string `yaml:"cert_path"`

	// KeyPath is the path to the TLS private key PEM file.
	KeyPath string `yaml:"key_path"`
}

TLSConfig configures TLS/HTTPS for the WebUI server.

type TelegramAccessConfig added in v1.16.5

type TelegramAccessConfig struct {
	DefaultPolicy string   `json:"default_policy"`
	Owners        []string `json:"owners"`
	Admins        []string `json:"admins"`
	AllowedUsers  []string `json:"allowed_users"`
	BlockedUsers  []string `json:"blocked_users"`
}

TelegramAccessConfig holds the Telegram access control configuration for the UI.

type TelegramConfig added in v1.16.0

type TelegramConfig struct {
	Connected             bool    `json:"connected"`
	Configured            bool    `json:"configured"`
	BotUsername           string  `json:"bot_username,omitempty"`
	BotID                 int64   `json:"bot_id,omitempty"`
	RespondToGroups       bool    `json:"respond_to_groups"`
	RespondToDMs          bool    `json:"respond_to_dms"`
	SendTyping            bool    `json:"send_typing"`
	AllowedChats          []int64 `json:"allowed_chats"`
	ReactionNotifications string  `json:"reaction_notifications"`
}

TelegramConfig holds Telegram settings exposed to the UI.

type ToolGuardStatus

type ToolGuardStatus struct {
	Enabled             bool              `json:"enabled"`
	AllowDestructive    bool              `json:"allow_destructive"`
	AllowSudo           bool              `json:"allow_sudo"`
	AllowReboot         bool              `json:"allow_reboot"`
	AutoApprove         []string          `json:"auto_approve"`
	RequireConfirmation []string          `json:"require_confirmation"`
	ProtectedPaths      []string          `json:"protected_paths"`
	SSHAllowedHosts     []string          `json:"ssh_allowed_hosts"`
	DangerousCommands   []string          `json:"dangerous_commands"`
	ToolPermissions     map[string]string `json:"tool_permissions"`
}

ToolGuardStatus represents the tool guard configuration for the UI.

type ToolProfileDef added in v1.12.0

type ToolProfileDef struct {
	Name        string   `json:"name"`
	Description string   `json:"description"`
	Allow       []string `json:"allow"`
	Deny        []string `json:"deny"`
}

ToolProfileDef defines a tool profile for creation/update.

type ToolProfileInfo added in v1.12.0

type ToolProfileInfo struct {
	Name        string   `json:"name"`
	Description string   `json:"description"`
	Allow       []string `json:"allow"`
	Deny        []string `json:"deny"`
	Builtin     bool     `json:"builtin"`
}

ToolProfileInfo contains profile info for API responses.

type UpdateAgentRequest added in v1.16.0

type UpdateAgentRequest struct {
	Name         *string        `json:"name,omitempty"`
	Description  *string        `json:"description,omitempty"`
	Model        *string        `json:"model,omitempty"`
	Instructions *string        `json:"instructions,omitempty"`
	Soul         *string        `json:"soul,omitempty"`
	Language     *string        `json:"language,omitempty"`
	Timezone     *string        `json:"timezone,omitempty"`
	Trigger      *string        `json:"trigger,omitempty"`
	Identity     *AgentIdentity `json:"identity,omitempty"`
	Skills       []string       `json:"skills,omitempty"`
	Channels     []string       `json:"channels,omitempty"`
	Members      []string       `json:"members,omitempty"`
	Groups       []string       `json:"groups,omitempty"`
	ToolProfile  *string        `json:"tool_profile,omitempty"`
	ToolsAllow   []string       `json:"tools_allow,omitempty"`
	ToolsDeny    []string       `json:"tools_deny,omitempty"`
	MaxTurns     *int           `json:"max_turns,omitempty"`
	RunTimeout   *int           `json:"run_timeout,omitempty"`
	Active       *bool          `json:"active,omitempty"`
}

UpdateAgentRequest is the request body for updating an agent.

type UpdateChecker added in v1.13.0

type UpdateChecker interface {
	LastCheck() updater.UpdateInfo
	CheckNow() (updater.UpdateInfo, error)
}

UpdateChecker is the interface used by the web UI to query update status.

type UsageInfo

type UsageInfo struct {
	TotalInputTokens  int64   `json:"total_input_tokens"`
	TotalOutputTokens int64   `json:"total_output_tokens"`
	TotalCost         float64 `json:"total_cost"`
	RequestCount      int64   `json:"request_count"`
}

UsageInfo contains token usage statistics.

type VaultStatus

type VaultStatus struct {
	Exists   bool     `json:"exists"`
	Unlocked bool     `json:"unlocked"`
	Keys     []string `json:"keys"`
}

VaultStatus represents the vault state for the UI (no secret values).

type WebhookInfo

type WebhookInfo struct {
	ID        string    `json:"id"`
	URL       string    `json:"url"`
	Events    []string  `json:"events"`
	Active    bool      `json:"active"`
	CreatedAt time.Time `json:"created_at"`
}

WebhookInfo contains webhook metadata for the UI.

type WhatsAppAccessConfig added in v1.13.0

type WhatsAppAccessConfig struct {
	DefaultPolicy  string   `json:"default_policy"`
	Owners         []string `json:"owners"`
	Admins         []string `json:"admins"`
	AllowedUsers   []string `json:"allowed_users"`
	BlockedUsers   []string `json:"blocked_users"`
	AllowedGroups  []string `json:"allowed_groups"`
	BlockedGroups  []string `json:"blocked_groups"`
	PendingMessage string   `json:"pending_message"`
}

WhatsAppAccessConfig holds the WhatsApp access control configuration.

type WhatsAppGroupPolicies added in v1.13.0

type WhatsAppGroupPolicies struct {
	DefaultPolicy string                `json:"default_policy"`
	Groups        []WhatsAppGroupPolicy `json:"groups"`
}

WhatsAppGroupPolicies holds all group policies.

type WhatsAppGroupPolicy added in v1.13.0

type WhatsAppGroupPolicy struct {
	ID           string   `json:"id"`
	Name         string   `json:"name"`
	Policy       string   `json:"policy"`
	Policies     []string `json:"policies,omitempty"`
	Keywords     []string `json:"keywords,omitempty"`
	AllowedUsers []string `json:"allowed_users,omitempty"`
	Workspace    string   `json:"workspace,omitempty"`
}

WhatsAppGroupPolicy holds a single group's policy configuration.

type WhatsAppJoinedGroup added in v1.13.0

type WhatsAppJoinedGroup struct {
	JID  string `json:"jid"`
	Name string `json:"name"`
}

WhatsAppJoinedGroup represents a WhatsApp group the bot is part of.

type WhatsAppQREvent

type WhatsAppQREvent struct {
	Type        string `json:"type"` // "code", "success", "timeout", "error", "refresh"
	Code        string `json:"code,omitempty"`
	Message     string `json:"message"`
	ExpiresAt   string `json:"expires_at,omitempty"`   // ISO timestamp
	SecondsLeft int    `json:"seconds_left,omitempty"` // Seconds until QR expires
}

WhatsAppQREvent mirrors whatsapp.QREvent without importing the channel package.

type WhatsAppStatus

type WhatsAppStatus struct {
	Connected         bool   `json:"connected"`
	State             string `json:"state"` // "disconnected", "connecting", "connected", "waiting_qr", etc.
	NeedsQR           bool   `json:"needs_qr"`
	Phone             string `json:"phone,omitempty"`
	Platform          string `json:"platform,omitempty"`
	ErrorCount        int    `json:"error_count"`
	ReconnectAttempts int    `json:"reconnect_attempts"`
	Message           string `json:"message,omitempty"` // Human-readable status message
}

WhatsAppStatus holds the current WhatsApp connection state for the UI.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL