Documentation
¶
Overview ¶
Package data provides the foundational data layer for all file I/O operations. It encapsulates config, memory, MCP, and session data access behind strongly-typed structs.
Architecture: cmd → service → data The data layer is the only layer that should directly access files or viper.
Package data provides settings management via settings.json. This file handles user-level settings separate from gllm.yaml configuration.
Index ¶
- Constants
- Variables
- func ClearClipboardText()
- func EnablePlanModeInSession(enable bool)
- func EnsureAgentsDir() error
- func EnsureConfigDir() error
- func EnsureSkillsDir() error
- func EnsureTasksDir() error
- func EnsureWorkflowsDir() error
- func ExportAgent(name, destPath string) error
- func GenerateTaskFilePath(prefix string, ext string) string
- func GetAgentsDirPath() string
- func GetClipboardText() string
- func GetConfigDir() string
- func GetConfigFilePath() string
- func GetCurrentTaskDirPath() string
- func GetGlobalInstructionFilePath() string
- func GetInstructionContent() string
- func GetLocalInstructionFilePath() string
- func GetMcpFilePath() string
- func GetMemoryFilePath() string
- func GetNotification() (string, bool)
- func GetPlanModeInSession() bool
- func GetPlansDirPath() string
- func GetSessionMode() (bool, bool)
- func GetSessionsDirPath() string
- func GetSettingsFilePath() string
- func GetSkillsDirPath() string
- func GetTasksDirPath() string
- func GetThemeFromConfig() string
- func GetWorkflowContent(path string) (string, error)
- func GetWorkflowsDirPath() string
- func GetYoloModeInSession() bool
- func GlobalInstructionFileExists() bool
- func ImportAgent(srcPath string) error
- func IsPlanModeInSessionEnabled() bool
- func ListThemes() []string
- func LoadTheme(name string) error
- func LocalInstructionFileExists() bool
- func MostSimilarGlamourStyle() string
- func ReadClipboardText() (string, error)
- func ResolveNotification()
- func SaveClipboardText(text string)
- func SaveSkillSourceMeta(skillDir string, meta *SkillSourceMeta) error
- func SaveThemeConfig(name string) error
- func SetPlanModeInSession(value bool)
- func SetYoloModeInSession(value bool)
- func StoreNotification(text string)
- func WriteAgentFile(agent *AgentConfig) error
- func WriteClipboardText(text string) error
- type AgentConfig
- type AgentFrontmatter
- type ClipboardImage
- type ConfigStore
- func (c *ConfigStore) ConfigExists() bool
- func (c *ConfigStore) ConfigFileUsed() string
- func (c *ConfigStore) DeleteAgent(name string) error
- func (c *ConfigStore) DeleteModel(name string) error
- func (c *ConfigStore) DeleteSearchEngine(name string) error
- func (c *ConfigStore) Export(path string) error
- func (c *ConfigStore) GetActiveAgent() *AgentConfig
- func (c *ConfigStore) GetActiveAgentName() string
- func (c *ConfigStore) GetAgent(name string) *AgentConfig
- func (c *ConfigStore) GetAgentNames() []string
- func (c *ConfigStore) GetAllAgents() map[string]*AgentConfig
- func (c *ConfigStore) GetInt(key string) int
- func (c *ConfigStore) GetModel(name string) *Model
- func (c *ConfigStore) GetModels() map[string]*Model
- func (c *ConfigStore) GetSearchEngine(name string) *SearchEngine
- func (c *ConfigStore) GetSearchEngines() map[string]*SearchEngine
- func (c *ConfigStore) GetString(key string) string
- func (c *ConfigStore) GetStringMap(key string) map[string]interface{}
- func (c *ConfigStore) GetStringMapString(key string) map[string]string
- func (c *ConfigStore) Import(path string) error
- func (c *ConfigStore) RenameAgent(oldName, newName string) error
- func (c *ConfigStore) RenameModel(oldName, newName string) error
- func (c *ConfigStore) Save() error
- func (c *ConfigStore) SetActiveAgent(name string) error
- func (c *ConfigStore) SetAgent(name string, agent *AgentConfig) error
- func (c *ConfigStore) SetConfigFile(path string) error
- func (c *ConfigStore) SetModel(name string, model *Model) error
- func (c *ConfigStore) SetModelLimits(name string, contextLength, maxOutput int) error
- func (c *ConfigStore) SetSearchEngine(name string, se *SearchEngine) error
- type MCPServer
- type MCPSettings
- type MCPStore
- func (m *MCPStore) AddServer(server *MCPServer) error
- func (m *MCPStore) CreateTemplate() error
- func (m *MCPStore) Export(path string) error
- func (m *MCPStore) GetPath() string
- func (m *MCPStore) GetServer(name string) (*MCPServer, error)
- func (m *MCPStore) Import(path string) error
- func (m *MCPStore) Load() (map[string]*MCPServer, error)
- func (m *MCPStore) LoadFromPath(path string) (map[string]*MCPServer, error)
- func (m *MCPStore) RemoveServer(name string) error
- func (m *MCPStore) Save(servers map[string]*MCPServer) error
- func (m *MCPStore) SaveToPath(servers map[string]*MCPServer, path string) error
- func (m *MCPStore) UpdateServer(server *MCPServer) error
- type MemoryStore
- func (m *MemoryStore) Add(memory string) error
- func (m *MemoryStore) Clear() error
- func (m *MemoryStore) GetAll() string
- func (m *MemoryStore) GetPath() string
- func (m *MemoryStore) Load() ([]string, error)
- func (m *MemoryStore) Remove(memory string) error
- func (m *MemoryStore) Save(memories []string) error
- type Model
- type PluginSettings
- type SearchEngine
- type SearchSettings
- type Settings
- type SettingsStore
- func (s *SettingsStore) AllowMCPServer(name string) error
- func (s *SettingsStore) BlockMCPServer(name string) error
- func (s *SettingsStore) DisablePlugin(id string) error
- func (s *SettingsStore) DisableSkill(name string) error
- func (s *SettingsStore) EnablePlugin(id string) error
- func (s *SettingsStore) EnableSkill(name string) error
- func (s *SettingsStore) GetAllowedMCPServers() []string
- func (s *SettingsStore) GetAllowedSearchEngine() string
- func (s *SettingsStore) GetDisabledSkills() []string
- func (s *SettingsStore) GetEditor() string
- func (s *SettingsStore) GetEnabledPlugins() []string
- func (s *SettingsStore) GetLastUpdateCheck() time.Time
- func (s *SettingsStore) GetTheme() string
- func (s *SettingsStore) GetVerboseEnabled() bool
- func (s *SettingsStore) IsMCPServerAllowed(name string) bool
- func (s *SettingsStore) IsPluginEnabled(id string) bool
- func (s *SettingsStore) IsSkillDisabled(name string) bool
- func (s *SettingsStore) Load() error
- func (s *SettingsStore) Save() error
- func (s *SettingsStore) SetAllowedMCPServers(allowed []string) error
- func (s *SettingsStore) SetAllowedSearchEngine(name string) error
- func (s *SettingsStore) SetEditor(editor string) error
- func (s *SettingsStore) SetEnabledPlugins(ids []string) error
- func (s *SettingsStore) SetLastUpdateCheck(t time.Time) error
- func (s *SettingsStore) SetTheme(name string) error
- func (s *SettingsStore) SetVerboseEnabled(enabled bool) error
- type SharedState
- func (s *SharedState) Clear()
- func (s *SharedState) Delete(key string) bool
- func (s *SharedState) FormatList() string
- func (s *SharedState) Get(key string) (interface{}, bool)
- func (s *SharedState) GetAgentKeys(agentName string) []string
- func (s *SharedState) GetAgentScope(agentName string) map[string]interface{}
- func (s *SharedState) GetMetadata(key string) *StateMetadata
- func (s *SharedState) GetScoped(agentName, key string) (interface{}, bool)
- func (s *SharedState) GetString(key string) string
- func (s *SharedState) Has(key string) bool
- func (s *SharedState) Keys() []string
- func (s *SharedState) Len() int
- func (s *SharedState) List() map[string]*StateMetadata
- func (s *SharedState) Set(key string, value interface{}, agentName string) error
- func (s *SharedState) SetScoped(agentName, key string, value interface{}) error
- type SkillMetadata
- type SkillSourceMeta
- type SkillsSettings
- type StateContentType
- type StateMetadata
- type ToolConfirmResult
- type ToolsUse
- type UpdateSettings
- type VerboseSettings
- type WorkflowMetadata
Constants ¶
const ( SkillFile = "SKILL.md" SkillMetaFile = "skill.meta.json" )
const ( DefaultThemeName string = "Dracula" // Formatting Utilities BoldSeq string = "\033[1m" UnderlineSeq string = "\033[4m" ResetSeq string = "\033[0m" )
const (
InstructionFileName = "GLLM.md"
)
const (
// MemoryHeader is the header for the memory file
MemoryHeader = "## gllm Added Memories"
)
const (
PlanModeSystemPrompt = `` /* 331-byte string literal not displayed */
)
const (
WorkflowFileExt = ".md"
)
Variables ¶
var ( // Current Theme Name CurrentThemeName string = DefaultThemeName CurrentTheme goghthemes.Theme // Roles RoleSystemColor string RoleUserColor string RoleAssistantColor string // Tools ToolCallColor string ToolResponseColor string // Status StatusErrorColor string StatusSuccessColor string StatusWarnColor string StatusInfoColor string StatusDebugColor string // Reasoning ReasoningTagColor string ReasoningTextColor string ReasoningOffColor string ReasoningMinColor string ReasoningLowColor string ReasoningMedColor string ReasoningHighColor string // UI & Interactive SwitchOnColor string SwitchOffColor string TaskCompleteColor string // Media MediaColor string // Workflow WorkflowColor string AgentRoleColor string ModelColor string DirectoryColor string PromptColor string BoolTrueColor string BoolFalseColor string // Additional UI Colors (ANSI Sequences) BorderColor string SectionColor string KeyColor string HighlightColor string ForegroundColor string BackgroundColor string LabelColor string DetailColor string ShellOutputColor string // Diff Colors DiffAddedColor string DiffRemovedColor string DiffHeaderColor string DiffSeparatorColor string DiffAddedBgColor string DiffRemovedBgColor string // Hex Codes (for lipgloss or other UI libs) BorderHex string SectionHex string KeyHex string LabelHex string DetailHex string SpinnerHex string BackgroundHex string HighCachedHex string MedCachedHex string LowCachedHex string OffCachedHex string UpdateSuccessHex string UpdateAvailableHex string UpdateModelSuccessHex string UpdateModelFailedHex string PlanModeHex string YoloModeHex string WarnStatusHex string BackgroundStatusHex string )
Functions ¶
func ClearClipboardText ¶ added in v1.14.24
func ClearClipboardText()
func EnablePlanModeInSession ¶ added in v1.14.26
func EnablePlanModeInSession(enable bool)
*
- Enable plan mode in session
func EnsureAgentsDir ¶ added in v1.15.15
func EnsureAgentsDir() error
EnsureAgentsDir creates the agents directory if it doesn't exist.
func EnsureConfigDir ¶
func EnsureConfigDir() error
EnsureConfigDir creates the config directory if it doesn't exist.
func EnsureSkillsDir ¶ added in v1.13.18
func EnsureSkillsDir() error
EnsureSkillsDir creates the skills directory if it doesn't exist.
func EnsureTasksDir ¶ added in v1.13.18
func EnsureTasksDir() error
EnsureTasksDir creates the tasks directory if it doesn't exist.
func EnsureWorkflowsDir ¶ added in v1.14.11
func EnsureWorkflowsDir() error
EnsureWorkflowsDir creates the workflows directory if it doesn't exist.
func ExportAgent ¶ added in v1.15.15
ExportAgent exports an agent's .md file to the specified destination path. It validates the agent exists and is well-formed before exporting.
func GenerateTaskFilePath ¶ added in v1.13.18
GenerateTaskFilePath generates a persistent file path for sub-agent tasks.
func GetAgentsDirPath ¶ added in v1.15.15
func GetAgentsDirPath() string
GetAgentsDirPath returns the path to the agents directory.
func GetClipboardText ¶ added in v1.14.24
func GetClipboardText() string
GetClipboardText retrieves the latest formatted markdown response
func GetConfigDir ¶
func GetConfigDir() string
GetConfigDir returns the application configuration directory. Uses os.UserConfigDir() for cross-platform support. Example: ~/.config/gllm on Linux, ~/Library/Application Support/gllm on macOS
func GetConfigFilePath ¶
func GetConfigFilePath() string
GetConfigFilePath returns the path to the configuration file.
func GetCurrentTaskDirPath ¶ added in v1.14.2
func GetCurrentTaskDirPath() string
get current task dir, it should append a date under tasks
func GetGlobalInstructionFilePath ¶ added in v1.16.2
func GetGlobalInstructionFilePath() string
GetGlobalInstructionFilePath returns the path to the global instruction file.
func GetInstructionContent ¶ added in v1.16.2
func GetInstructionContent() string
GetInstructionContent discovers and loads static instruction files (global and local). It formats them into an XML structure suitable for injection into the system prompt.
func GetLocalInstructionFilePath ¶ added in v1.16.2
func GetLocalInstructionFilePath() string
GetLocalInstructionFilePath returns the path to the local instruction file in the current working directory.
func GetMemoryFilePath ¶
func GetMemoryFilePath() string
GetMemoryFilePath returns the path to the memory file.
func GetNotification ¶ added in v1.14.24
GetNotification populates a notification string if a newer notification is waiting. Returns (text, true) if the background check finished. Returns ("", false) if the check result is not yet available.
func GetPlanModeInSession ¶ added in v1.14.26
func GetPlanModeInSession() bool
*
- Get plan mode in session
func GetPlansDirPath ¶ added in v1.14.26
func GetPlansDirPath() string
GetPlansDirPath returns the path to the plan directory.
func GetSessionMode ¶ added in v1.14.28
*
- Get session mode *
- @return planModeInSession, yoloModeInSession
func GetSessionsDirPath ¶ added in v1.14.26
func GetSessionsDirPath() string
GetSessionsDirPath returns the path to the session directory.
func GetSettingsFilePath ¶ added in v1.13.18
func GetSettingsFilePath() string
GetSettingsFilePath returns the path to the settings file.
func GetSkillsDirPath ¶ added in v1.13.18
func GetSkillsDirPath() string
GetSkillsDirPath returns the path to the skills directory.
func GetTasksDirPath ¶ added in v1.13.18
func GetTasksDirPath() string
GetTasksDirPath returns the path to the subagent tasks directory.
func GetThemeFromConfig ¶ added in v1.14.1
func GetThemeFromConfig() string
GetThemeFromConfig retrieves the configured theme name.
func GetWorkflowContent ¶ added in v1.14.11
GetWorkflowContent returns the content of the workflow file after frontmatter.
func GetWorkflowsDirPath ¶ added in v1.14.11
func GetWorkflowsDirPath() string
GetWorkflowsDirPath returns the path to the workflows directory.
func GetYoloModeInSession ¶ added in v1.14.28
func GetYoloModeInSession() bool
*
- Get YOLO mode in session
func GlobalInstructionFileExists ¶ added in v1.16.9
func GlobalInstructionFileExists() bool
GlobalInstructionFileExists reports whether the global GLLM.md exists in the config directory.
func ImportAgent ¶ added in v1.15.15
ImportAgent imports an agent from a .md file into the agents directory. It validates the file format and checks for name conflicts.
func IsPlanModeInSessionEnabled ¶ added in v1.14.26
func IsPlanModeInSessionEnabled() bool
*
- Check if plan mode is enabled in session
func ListThemes ¶ added in v1.14.1
func ListThemes() []string
ListThemes returns a sorted list of all available theme names.
func LoadTheme ¶ added in v1.14.1
LoadTheme loads a theme by name from gogh-themes and updates all color variables.
func LocalInstructionFileExists ¶ added in v1.16.9
func LocalInstructionFileExists() bool
LocalInstructionFileExists reports whether ./GLLM.md exists in the current working directory.
func MostSimilarGlamourStyle ¶ added in v1.14.18
func MostSimilarGlamourStyle() string
MostSimilarGlamourStyle returns the name of the glamour built-in style that most closely matches the active gogh theme. It uses two heuristics:
- Background luminance → decides dark vs. light family.
- For dark themes, the circular HSL hue-distance between the theme's accent color and each dark style's known dominant hue determines the winner among dracula (~264°), tokyo-night (~220°), pink (~330°), and dark (~195° neutral teal).
This preserves glamour's hand-crafted, vibrant colour palettes and rich Chroma syntax highlighting instead of a flat programmatic approximation.
func ReadClipboardText ¶ added in v1.16.6
Read from clipboard using atotto/clipboard
func ResolveNotification ¶ added in v1.14.24
func ResolveNotification()
ResolveNotification marks the notification as resolved.
func SaveClipboardText ¶ added in v1.14.24
func SaveClipboardText(text string)
SaveClipboardText securely saves the latest formatted markdown response
func SaveSkillSourceMeta ¶ added in v1.15.6
func SaveSkillSourceMeta(skillDir string, meta *SkillSourceMeta) error
SaveSkillSourceMeta writes the source metadata to the skill's directory.
func SaveThemeConfig ¶ added in v1.14.1
SaveThemeConfig persists the theme selection to the configuration file.
func SetPlanModeInSession ¶ added in v1.14.26
func SetPlanModeInSession(value bool)
*
- Set plan mode in session
func SetYoloModeInSession ¶ added in v1.14.28
func SetYoloModeInSession(value bool)
*
- Set YOLO mode(tool calls auto approve) in session
func StoreNotification ¶ added in v1.14.24
func StoreNotification(text string)
StoreNotification safely queues a new notification string.
func WriteAgentFile ¶ added in v1.15.15
func WriteAgentFile(agent *AgentConfig) error
WriteAgentFile writes an AgentConfig to a .md file in the agents directory.
func WriteClipboardText ¶ added in v1.14.24
Actually copy to clipboard using atotto/clipboard
Types ¶
type AgentConfig ¶
type AgentConfig struct {
Name string // Name
Description string // Description
Model Model // Model name reference
Tools []string // List of enabled tools
Capabilities []string // List of enabled capabilities (mcp, skills, usage, markdown, subagents)
Think string // Thinking level: off, low, medium, high
SystemPrompt string // System prompt reference
MaxRecursions int // Maximum tool call recursions
}
AgentConfig represents a fully-typed agent configuration. All fields are strongly typed - no interface{} leaks to other layers. Named AgentConfig to avoid conflict with the runtime Agent struct in service/agent.go.
func ParseAgentFile ¶ added in v1.15.15
func ParseAgentFile(path string) (*AgentConfig, error)
ParseAgentFile reads and parses an agent .md file, returning the raw AgentConfig.
type AgentFrontmatter ¶ added in v1.15.15
type AgentFrontmatter struct {
Name string `yaml:"name"`
Description string `yaml:"description,omitempty"`
Model string `yaml:"model"`
Tools []string `yaml:"tools,omitempty"`
Capabilities []string `yaml:"capabilities,omitempty"`
Think string `yaml:"think,omitempty"`
MaxRecursions int `yaml:"max_recursions,omitempty"`
}
type ClipboardImage ¶ added in v1.16.6
ClipboardImage encapsulates raw image data extracted from the system clipboard.
func ReadClipboardImage ¶ added in v1.16.6
func ReadClipboardImage() (*ClipboardImage, error)
ReadClipboardImage attempts to extract an image from the system clipboard. Returns a ClipboardImage if successful, or an error if no image is present or extraction fails.
type ConfigStore ¶
type ConfigStore struct {
// contains filtered or unexported fields
}
ConfigStore provides typed access to gllm.yaml configuration. It wraps viper internally and exposes only typed interfaces.
func NewConfigStore ¶
func NewConfigStore() *ConfigStore
NewConfigStore creates a new ConfigStore using the existing viper configuration. This reuses whatever config file viper has already loaded.
func (*ConfigStore) ConfigExists ¶ added in v1.16.11
func (c *ConfigStore) ConfigExists() bool
ConfigExists returns true if the configuration file actually exists on disk.
func (*ConfigStore) ConfigFileUsed ¶
func (c *ConfigStore) ConfigFileUsed() string
ConfigFileUsed returns the path to the config file being used.
func (*ConfigStore) DeleteAgent ¶
func (c *ConfigStore) DeleteAgent(name string) error
DeleteAgent removes an agent configuration.
func (*ConfigStore) DeleteModel ¶
func (c *ConfigStore) DeleteModel(name string) error
DeleteModel removes a model.
func (*ConfigStore) DeleteSearchEngine ¶
func (c *ConfigStore) DeleteSearchEngine(name string) error
DeleteSearchEngine removes a search engine.
func (*ConfigStore) Export ¶
func (c *ConfigStore) Export(path string) error
Export saves the current configuration to the specified path.
func (*ConfigStore) GetActiveAgent ¶
func (c *ConfigStore) GetActiveAgent() *AgentConfig
GetActiveAgent returns the currently active agent configuration.
func (*ConfigStore) GetActiveAgentName ¶
func (c *ConfigStore) GetActiveAgentName() string
GetActiveAgentName returns the name of the currently active agent.
func (*ConfigStore) GetAgent ¶
func (c *ConfigStore) GetAgent(name string) *AgentConfig
GetAgent returns a specific agent configuration by name. Returns nil if agent doesn't exist.
func (*ConfigStore) GetAgentNames ¶
func (c *ConfigStore) GetAgentNames() []string
GetAgentNames returns a sorted list of agent names.
func (*ConfigStore) GetAllAgents ¶
func (c *ConfigStore) GetAllAgents() map[string]*AgentConfig
GetAllAgents returns all configured agents as a map.
func (*ConfigStore) GetInt ¶
func (c *ConfigStore) GetInt(key string) int
GetInt returns an int value from config.
func (*ConfigStore) GetModel ¶
func (c *ConfigStore) GetModel(name string) *Model
func (*ConfigStore) GetModels ¶
func (c *ConfigStore) GetModels() map[string]*Model
GetModels returns all configured models.
func (*ConfigStore) GetSearchEngine ¶
func (c *ConfigStore) GetSearchEngine(name string) *SearchEngine
GetSearchEngine returns a specific search engine by name.
func (*ConfigStore) GetSearchEngines ¶
func (c *ConfigStore) GetSearchEngines() map[string]*SearchEngine
GetSearchEngines returns all configured search engines.
func (*ConfigStore) GetString ¶
func (c *ConfigStore) GetString(key string) string
GetString returns a string value from config.
func (*ConfigStore) GetStringMap ¶
func (c *ConfigStore) GetStringMap(key string) map[string]interface{}
GetStringMap returns a string map from config.
func (*ConfigStore) GetStringMapString ¶
func (c *ConfigStore) GetStringMapString(key string) map[string]string
GetStringMapString returns a string-to-string map from config.
func (*ConfigStore) Import ¶
func (c *ConfigStore) Import(path string) error
Import loads configuration from the specified path and merges it into the current configuration.
func (*ConfigStore) RenameAgent ¶ added in v1.14.11
func (c *ConfigStore) RenameAgent(oldName, newName string) error
RenameAgent renames an existing agent
func (*ConfigStore) RenameModel ¶ added in v1.14.11
func (c *ConfigStore) RenameModel(oldName, newName string) error
Bugfix: The bug where renaming a model or agent would leave the old entry behind in the configuration. The issue was caused by a non-atomic rename process. Use atomic map operations, ensuring that the old key is correctly removed from gllm.yaml in a single save operation. RenameModel renames an existing model
func (*ConfigStore) Save ¶
func (c *ConfigStore) Save() error
Save persists the configuration to disk.
func (*ConfigStore) SetActiveAgent ¶
func (c *ConfigStore) SetActiveAgent(name string) error
SetActiveAgent sets the active agent name.
func (*ConfigStore) SetAgent ¶
func (c *ConfigStore) SetAgent(name string, agent *AgentConfig) error
SetAgent saves or updates an agent configuration.
func (*ConfigStore) SetConfigFile ¶
func (c *ConfigStore) SetConfigFile(path string) error
SetConfigFile sets the configuration file path.
func (*ConfigStore) SetModel ¶
func (c *ConfigStore) SetModel(name string, model *Model) error
SetModel adds or updates a model.
func (*ConfigStore) SetModelLimits ¶ added in v1.15.1
func (c *ConfigStore) SetModelLimits(name string, contextLength, maxOutput int) error
SetModelLimits updates the context window and output token limits for a given model. This allows the system to background-fetch limits and cache them in the config.
func (*ConfigStore) SetSearchEngine ¶
func (c *ConfigStore) SetSearchEngine(name string, se *SearchEngine) error
SetSearchEngine adds or updates a search engine.
type MCPServer ¶
type MCPServer struct {
Name string // Name is the key, derived from JSON map key
Command string // Command to execute (for local/stdio servers)
Args []string // Arguments to pass to the command
Type string // Server type: "sse", "http", "stdio", etc.
URL string // URL for SSE/HTTP servers
HTTPUrl string // HTTP URL for streamable servers
BaseURL string // Base URL for SSE
Headers map[string]string // HTTP headers
Env map[string]string // Environment variables
WorkDir string // Working directory
Cwd string // Alternative working directory field
Description string // Human-readable description
Allowed bool // Whether this server is allowed (derived from allowMCPServers)
}
MCPServer represents an MCP server configuration with strong typing.
type MCPSettings ¶ added in v1.13.18
type MCPSettings struct {
Allowed []string `json:"allowed"`
}
MCPSettings holds MCP-related settings.
type MCPStore ¶
type MCPStore struct {
// contains filtered or unexported fields
}
MCPStore provides typed access to mcp.json configuration.
func NewMCPStore ¶
func NewMCPStore() *MCPStore
NewMCPStore creates a new MCPStore with the default path.
func (*MCPStore) CreateTemplate ¶
CreateEmptyConfigFile creates an empty MCP config file.
func (*MCPStore) Load ¶
Load reads all MCP server configurations. Returns servers with Allowed status from settings.json.
func (*MCPStore) LoadFromPath ¶
LoadFromPath reads MCP configuration from a specific path (for import).
func (*MCPStore) RemoveServer ¶
RemoveServer removes an MCP server.
func (*MCPStore) SaveToPath ¶
SaveToPath writes MCP configuration to a specific path (for export).
func (*MCPStore) UpdateServer ¶
UpdateServer updates an existing MCP server.
type MemoryStore ¶
type MemoryStore struct {
// contains filtered or unexported fields
}
MemoryStore provides typed access to the memory/context file.
func NewMemoryStore ¶
func NewMemoryStore() *MemoryStore
NewMemoryStore creates a new MemoryStore with the default path.
func (*MemoryStore) Add ¶
func (m *MemoryStore) Add(memory string) error
Add appends a memory item. Returns error if duplicate.
func (*MemoryStore) GetAll ¶ added in v1.13.18
func (m *MemoryStore) GetAll() string
GetAll returns memory content formatted for system prompt injection in XML format. This is useful for injecting memory into a system prompt. Bugfix: Using xml to replace markdown XML supports nested structures naturally, making it more suitable for system prompts and memory injection. Markdown: General content, documentation, when token efficiency matters more than parsing precision
func (*MemoryStore) GetPath ¶
func (m *MemoryStore) GetPath() string
GetPath returns the path to the memory file.
func (*MemoryStore) Load ¶
func (m *MemoryStore) Load() ([]string, error)
Load reads and returns all memory items from the file. Returns empty slice if file doesn't exist.
func (*MemoryStore) Remove ¶
func (m *MemoryStore) Remove(memory string) error
Remove removes a specific memory item.
func (*MemoryStore) Save ¶
func (m *MemoryStore) Save(memories []string) error
Save writes memory items to the file.
type Model ¶
type Model struct {
Name string // Name is the key, not stored in YAML
Provider string // Provider name (e.g., "openai", "gemini")
Endpoint string // Model endpoint
Key string // Model key
Model string // Model name
Temp float32 // Model temperature
TopP float32 // Model top_p
Seed *int32 // Model seed
ContextLength int32 // Model context length
MaxOutputTokens int32 // Model max output tokens
}
Model represents a model definition.
type PluginSettings ¶ added in v1.15.25
type PluginSettings struct {
Enabled []string `json:"enabled"` // List of enabled plugin IDs
}
PluginSettings holds global plugin on/off toggles.
type SearchEngine ¶
type SearchEngine struct {
Name string // Name is the key
DeepDive int // Number of deep dive search results
Reference int // Number of reference search results
Config map[string]string // Additional configuration
}
SearchEngine represents search engine configuration.
type SearchSettings ¶ added in v1.14.1
type SearchSettings struct {
Allowed string `json:"allowed"` // The allowed search engine name (e.g., "google", "bing", "tavily")
}
SearchSettings holds search-related settings.
type Settings ¶ added in v1.13.18
type Settings struct {
MCP MCPSettings `json:"mcp"`
Skills SkillsSettings `json:"skills"`
Search SearchSettings `json:"search"`
Verbose VerboseSettings `json:"verbose"`
Plugin PluginSettings `json:"plugin"`
Theme string `json:"theme"`
Editor string `json:"editor"`
Update UpdateSettings `json:"update"`
}
Settings represents the structure of settings.json.
type SettingsStore ¶ added in v1.13.18
type SettingsStore struct {
// contains filtered or unexported fields
}
SettingsStore provides access to settings.json.
func GetSettingsStore ¶ added in v1.13.18
func GetSettingsStore() *SettingsStore
GetSettingsStore returns the singleton instance of SettingsStore.
func NewSettingsStore ¶ added in v1.13.18
func NewSettingsStore() *SettingsStore
NewSettingsStore creates a new SettingsStore.
func (*SettingsStore) AllowMCPServer ¶ added in v1.13.18
func (s *SettingsStore) AllowMCPServer(name string) error
AllowMCPServer adds an MCP server to the allowed list.
func (*SettingsStore) BlockMCPServer ¶ added in v1.13.18
func (s *SettingsStore) BlockMCPServer(name string) error
BlockMCPServer removes an MCP server from the allowed list.
func (*SettingsStore) DisablePlugin ¶ added in v1.15.25
func (s *SettingsStore) DisablePlugin(id string) error
DisablePlugin removes the plugin ID from the enabled list.
func (*SettingsStore) DisableSkill ¶ added in v1.13.18
func (s *SettingsStore) DisableSkill(name string) error
DisableSkill adds a skill to the disabled list.
func (*SettingsStore) EnablePlugin ¶ added in v1.15.25
func (s *SettingsStore) EnablePlugin(id string) error
EnablePlugin adds the plugin ID to the enabled list.
func (*SettingsStore) EnableSkill ¶ added in v1.13.18
func (s *SettingsStore) EnableSkill(name string) error
EnableSkill removes a skill from the disabled list.
func (*SettingsStore) GetAllowedMCPServers ¶ added in v1.13.18
func (s *SettingsStore) GetAllowedMCPServers() []string
GetAllowedMCPServers returns the list of allowed MCP server names.
func (*SettingsStore) GetAllowedSearchEngine ¶ added in v1.14.1
func (s *SettingsStore) GetAllowedSearchEngine() string
GetAllowedSearchEngine returns the allowed search engine name.
func (*SettingsStore) GetDisabledSkills ¶ added in v1.13.18
func (s *SettingsStore) GetDisabledSkills() []string
GetDisabledSkills returns the list of disabled skill names.
func (*SettingsStore) GetEditor ¶ added in v1.14.7
func (s *SettingsStore) GetEditor() string
GetEditor returns the configured editor.
func (*SettingsStore) GetEnabledPlugins ¶ added in v1.15.25
func (s *SettingsStore) GetEnabledPlugins() []string
GetEnabledPlugins returns the list of enabled plugin IDs.
func (*SettingsStore) GetLastUpdateCheck ¶ added in v1.14.24
func (s *SettingsStore) GetLastUpdateCheck() time.Time
GetLastUpdateCheck returns the timestamp of the last update check.
func (*SettingsStore) GetTheme ¶ added in v1.14.7
func (s *SettingsStore) GetTheme() string
GetTheme returns the configured theme name.
func (*SettingsStore) GetVerboseEnabled ¶ added in v1.14.7
func (s *SettingsStore) GetVerboseEnabled() bool
GetVerboseEnabled returns whether verbose mode is enabled.
func (*SettingsStore) IsMCPServerAllowed ¶ added in v1.13.18
func (s *SettingsStore) IsMCPServerAllowed(name string) bool
IsMCPServerAllowed checks if an MCP server is in the allowed list.
func (*SettingsStore) IsPluginEnabled ¶ added in v1.15.25
func (s *SettingsStore) IsPluginEnabled(id string) bool
IsPluginEnabled checks if the given plugin ID is enabled.
func (*SettingsStore) IsSkillDisabled ¶ added in v1.13.18
func (s *SettingsStore) IsSkillDisabled(name string) bool
IsSkillDisabled checks if a skill is in the disabled list.
func (*SettingsStore) Load ¶ added in v1.13.18
func (s *SettingsStore) Load() error
Load reads settings from disk.
func (*SettingsStore) Save ¶ added in v1.13.18
func (s *SettingsStore) Save() error
Save writes settings to disk.
func (*SettingsStore) SetAllowedMCPServers ¶ added in v1.13.18
func (s *SettingsStore) SetAllowedMCPServers(allowed []string) error
SetAllowedMCPServers sets the entire list of allowed MCP servers.
func (*SettingsStore) SetAllowedSearchEngine ¶ added in v1.14.1
func (s *SettingsStore) SetAllowedSearchEngine(name string) error
SetAllowedSearchEngine sets the allowed search engine name.
func (*SettingsStore) SetEditor ¶ added in v1.14.7
func (s *SettingsStore) SetEditor(editor string) error
SetEditor sets the configured editor.
func (*SettingsStore) SetEnabledPlugins ¶ added in v1.15.25
func (s *SettingsStore) SetEnabledPlugins(ids []string) error
SetEnabledPlugins replaces the entire list of enabled plugins.
func (*SettingsStore) SetLastUpdateCheck ¶ added in v1.14.24
func (s *SettingsStore) SetLastUpdateCheck(t time.Time) error
SetLastUpdateCheck persists the timestamp of the most recent update check.
func (*SettingsStore) SetTheme ¶ added in v1.14.7
func (s *SettingsStore) SetTheme(name string) error
SetTheme sets the configured theme name.
func (*SettingsStore) SetVerboseEnabled ¶ added in v1.14.7
func (s *SettingsStore) SetVerboseEnabled(enabled bool) error
SetVerboseEnabled sets the verbose mode.
type SharedState ¶ added in v1.13.14
type SharedState struct {
// contains filtered or unexported fields
}
SharedState provides a concurrent-safe memory space for agents to communicate. It acts as a key-value store with metadata tracking for provenance.
func NewSharedState ¶ added in v1.13.14
func NewSharedState() *SharedState
NewSharedState creates a new SharedState instance
func (*SharedState) Clear ¶ added in v1.13.14
func (s *SharedState) Clear()
Clear removes all entries from the SharedState.
func (*SharedState) Delete ¶ added in v1.13.14
func (s *SharedState) Delete(key string) bool
Delete removes a key from the SharedState. Returns true if the key was deleted, false if it didn't exist.
func (*SharedState) FormatList ¶ added in v1.13.14
func (s *SharedState) FormatList() string
FormatList returns a formatted string representation of all entries for display
func (*SharedState) Get ¶ added in v1.13.14
func (s *SharedState) Get(key string) (interface{}, bool)
Get retrieves a value from the SharedState by key. Returns the value and true if found, nil and false otherwise.
func (*SharedState) GetAgentKeys ¶ added in v1.13.14
func (s *SharedState) GetAgentKeys(agentName string) []string
GetAgentKeys returns all keys created by a specific agent.
func (*SharedState) GetAgentScope ¶ added in v1.13.14
func (s *SharedState) GetAgentScope(agentName string) map[string]interface{}
GetAgentScope returns all entries created by a specific agent.
func (*SharedState) GetMetadata ¶ added in v1.13.14
func (s *SharedState) GetMetadata(key string) *StateMetadata
GetMetadata retrieves the metadata for a key. Returns nil if the key doesn't exist.
func (*SharedState) GetScoped ¶ added in v1.13.14
func (s *SharedState) GetScoped(agentName, key string) (interface{}, bool)
GetScoped retrieves a value with an agent-scoped key (agentName:key)
func (*SharedState) GetString ¶ added in v1.13.14
func (s *SharedState) GetString(key string) string
GetString retrieves a string value from the SharedState. Returns empty string if key doesn't exist or value is not a string.
func (*SharedState) Has ¶ added in v1.13.14
func (s *SharedState) Has(key string) bool
Has checks if a key exists in the SharedState.
func (*SharedState) Keys ¶ added in v1.13.14
func (s *SharedState) Keys() []string
Keys returns all keys in the SharedState.
func (*SharedState) Len ¶ added in v1.13.14
func (s *SharedState) Len() int
Len returns the number of entries in the SharedState.
func (*SharedState) List ¶ added in v1.13.14
func (s *SharedState) List() map[string]*StateMetadata
List returns metadata for all keys in the SharedState.
func (*SharedState) Set ¶ added in v1.13.14
func (s *SharedState) Set(key string, value interface{}, agentName string) error
Set stores a value in the SharedState with the given key. If the key already exists, it updates the value and UpdatedAt timestamp.
func (*SharedState) SetScoped ¶ added in v1.13.14
func (s *SharedState) SetScoped(agentName, key string, value interface{}) error
SetScoped stores a value with an agent-scoped key (agentName:key)
type SkillMetadata ¶ added in v1.13.18
type SkillMetadata struct {
Name string `yaml:"name"`
Description string `yaml:"description"`
Location string `yaml:"-"` // Full path to SKILL.md, not in YAML
SourceMeta *SkillSourceMeta `yaml:"-"` // Loaded from skill.meta.json, not in YAML
}
SkillMetadata represents the metadata for a single skill.
func ParseSkillFrontmatter ¶ added in v1.13.18
func ParseSkillFrontmatter(path string) (*SkillMetadata, error)
ParseSkillFrontmatter reads a SKILL.md file and extracts its metadata.
func ScanSkills ¶ added in v1.13.18
func ScanSkills() ([]SkillMetadata, error)
ScanSkills scans the skills directory for valid skills. A valid skill is a directory containing a SKILL.md file with valid frontmatter.
type SkillSourceMeta ¶ added in v1.15.6
type SkillSourceMeta struct {
SourceURL string `json:"source_url"` // Essential for remote skills
SubPath string `json:"sub_path,omitempty"` // Essential for nested skill installs
InstallDate string `json:"install_date"` // Essential for update tracking
}
SkillSourceMeta tracks the origin of an installed skill for update purposes.
func LoadSkillSourceMeta ¶ added in v1.15.6
func LoadSkillSourceMeta(skillDir string) (*SkillSourceMeta, error)
LoadSkillSourceMeta reads the source metadata for a skill from its directory. It returns nil, nil if the file does not exist.
type SkillsSettings ¶ added in v1.13.18
type SkillsSettings struct {
Disabled []string `json:"disabled"`
}
SkillsSettings holds skill-related settings.
type StateContentType ¶ added in v1.13.14
type StateContentType string
StateContentType represents the type of content stored in SharedState
const ( ContentTypeText StateContentType = "text" ContentTypeJSON StateContentType = "json" ContentTypeFileRef StateContentType = "file_ref" ContentTypeBinary StateContentType = "binary" )
type StateMetadata ¶ added in v1.13.14
type StateMetadata struct {
CreatedBy string `json:"created_by"` // Agent name that wrote this
CreatedAt time.Time `json:"created_at"` // When the entry was created
UpdatedAt time.Time `json:"updated_at"` // When the entry was last updated
ContentType StateContentType `json:"content_type"` // Type of content
Size int `json:"size"` // Size in bytes (approximate)
}
StateMetadata contains provenance information for a SharedState entry
type ToolConfirmResult ¶ added in v1.14.13
type ToolConfirmResult int
const ( ToolConfirmYes ToolConfirmResult = iota // Approve this tool call ToolConfirmCancel // Cancel entire operation immediately )
type ToolsUse ¶ added in v1.14.12
type ToolsUse struct {
AutoApprove bool // Whether tools can be used without user confirmation
Confirm ToolConfirmResult // User confirmation result
FilePath string // File path relevant to the tool use, if any
}
func (*ToolsUse) ConfirmAlways ¶ added in v1.14.13
func (tu *ToolsUse) ConfirmAlways()
func (*ToolsUse) ConfirmCancel ¶ added in v1.14.13
func (tu *ToolsUse) ConfirmCancel()
func (*ToolsUse) ConfirmOnce ¶ added in v1.14.13
func (tu *ToolsUse) ConfirmOnce()
type UpdateSettings ¶ added in v1.14.24
UpdateSettings holds update-check-related settings.
type VerboseSettings ¶ added in v1.14.7
type VerboseSettings struct {
Enabled bool `json:"enabled"` // Whether verbose output is enabled
}
VerboseSettings holds verbosity-related settings.
type WorkflowMetadata ¶ added in v1.14.11
type WorkflowMetadata struct {
Name string `yaml:"name"` // Display name
Description string `yaml:"description"` // Brief description for /help
Location string // Full path to workflow file
}
WorkflowMetadata represents a workflow command definition
func ParseWorkflowFrontmatter ¶ added in v1.14.11
func ParseWorkflowFrontmatter(path string) (*WorkflowMetadata, error)
ParseWorkflowFrontmatter reads a workflow md file and extracts its metadata.
func ScanWorkflows ¶ added in v1.14.11
func ScanWorkflows() ([]WorkflowMetadata, error)
ScanWorkflows scans the default workflows directory for valid workflow files.
func ScanWorkflowsInDir ¶ added in v1.14.11
func ScanWorkflowsInDir(dir string) ([]WorkflowMetadata, error)
ScanWorkflowsInDir scans the specified directory for valid workflow files.