config

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigDir

func ConfigDir() string

ConfigDir returns the golem config directory

func ConfigPath

func ConfigPath() string

ConfigPath returns the config file path

func IsMCPServerEnabled added in v0.4.3

func IsMCPServerEnabled(server MCPServerConfig) bool

IsMCPServerEnabled returns true unless the server is explicitly disabled.

func Save

func Save(cfg *Config) error

Save saves config to file

Types

type AgentDefaults

type AgentDefaults struct {
	Workspace         string  `mapstructure:"workspace"`
	WorkspaceMode     string  `mapstructure:"workspace_mode"`
	Model             string  `mapstructure:"model"`
	MaxTokens         int     `mapstructure:"max_tokens"`
	Temperature       float64 `mapstructure:"temperature"`
	MaxToolIterations int     `mapstructure:"max_tool_iterations"`
}

AgentDefaults default agent parameters

type AgentsConfig

type AgentsConfig struct {
	Defaults AgentDefaults         `mapstructure:"defaults"`
	Subagent SubagentRuntimeConfig `mapstructure:"subagent"`
}

AgentsConfig agent settings

type ChannelOutboundConfig added in v0.5.1

type ChannelOutboundConfig struct {
	MaxConcurrentSends int `mapstructure:"max_concurrent_sends"`
	RetryMaxAttempts   int `mapstructure:"retry_max_attempts"`
	RetryBaseBackoffMs int `mapstructure:"retry_base_backoff_ms"`
	RetryMaxBackoffMs  int `mapstructure:"retry_max_backoff_ms"`
	RateLimitPerSecond int `mapstructure:"rate_limit_per_second"`
	DedupWindowSeconds int `mapstructure:"dedup_window_seconds"`
}

ChannelOutboundConfig controls outbound reliability behavior.

type ChannelsConfig

type ChannelsConfig struct {
	Telegram TelegramConfig        `mapstructure:"telegram"`
	WhatsApp WhatsAppConfig        `mapstructure:"whatsapp"`
	Feishu   FeishuConfig          `mapstructure:"feishu"`
	Discord  DiscordConfig         `mapstructure:"discord"`
	Slack    SlackConfig           `mapstructure:"slack"`
	QQ       QQConfig              `mapstructure:"qq"`
	DingTalk DingTalkConfig        `mapstructure:"dingtalk"`
	MaixCam  MaixCamConfig         `mapstructure:"maixcam"`
	Outbound ChannelOutboundConfig `mapstructure:"outbound"`
}

ChannelsConfig channel settings

type Config

type Config struct {
	Agents    AgentsConfig    `mapstructure:"agents"`
	Channels  ChannelsConfig  `mapstructure:"channels"`
	Providers ProvidersConfig `mapstructure:"providers"`
	Gateway   GatewayConfig   `mapstructure:"gateway"`
	Log       LogConfig       `mapstructure:"log"`
	Policy    PolicyConfig    `mapstructure:"policy"`
	MCP       MCPConfig       `mapstructure:"mcp"`
	Tools     ToolsConfig     `mapstructure:"tools"`
	Heartbeat HeartbeatConfig `mapstructure:"heartbeat"`
}

Config root configuration

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns config with sensible defaults

func Load

func Load() (*Config, error)

Load loads config from file or returns defaults

func (*Config) Validate added in v0.1.4

func (c *Config) Validate() error

Validate checks that the configuration values are within acceptable ranges.

func (*Config) WorkspacePath

func (c *Config) WorkspacePath() string

WorkspacePath returns the expanded workspace path

func (*Config) WorkspacePathChecked

func (c *Config) WorkspacePathChecked() (string, error)

WorkspacePathChecked returns the expanded workspace path or an error if invalid.

type DingTalkConfig added in v0.2.2

type DingTalkConfig struct {
	Enabled      bool     `mapstructure:"enabled"`
	ClientID     string   `mapstructure:"client_id"`
	ClientSecret string   `mapstructure:"client_secret"`
	AllowFrom    []string `mapstructure:"allow_from"`
}

DingTalkConfig DingTalk stream mode settings

type DiscordConfig added in v0.2.2

type DiscordConfig struct {
	Enabled   bool     `mapstructure:"enabled"`
	Token     string   `mapstructure:"token"`
	AllowFrom []string `mapstructure:"allow_from"`
}

DiscordConfig Discord bot settings

type ExecToolConfig

type ExecToolConfig struct {
	Timeout             int  `mapstructure:"timeout"`
	RestrictToWorkspace bool `mapstructure:"restrict_to_workspace"`
}

ExecToolConfig shell exec settings

type FeishuConfig added in v0.2.2

type FeishuConfig struct {
	Enabled           bool     `mapstructure:"enabled"`
	AppID             string   `mapstructure:"app_id"`
	AppSecret         string   `mapstructure:"app_secret"`
	EncryptKey        string   `mapstructure:"encrypt_key"`
	VerificationToken string   `mapstructure:"verification_token"`
	AllowFrom         []string `mapstructure:"allow_from"`
}

FeishuConfig Feishu bot settings

type GatewayConfig

type GatewayConfig struct {
	Host  string `mapstructure:"host"`
	Port  int    `mapstructure:"port"`
	Token string `mapstructure:"token"`
}

GatewayConfig server settings

type HeartbeatConfig added in v0.3.0

type HeartbeatConfig struct {
	Enabled        bool `mapstructure:"enabled"`
	Interval       int  `mapstructure:"interval"`         // minutes
	MaxIdleMinutes int  `mapstructure:"max_idle_minutes"` // minutes
}

HeartbeatConfig heartbeat service settings.

type LogConfig added in v0.1.5

type LogConfig struct {
	Level string `mapstructure:"level"`
	File  string `mapstructure:"file"`
}

LogConfig application logging settings

type MCPConfig added in v0.4.0

type MCPConfig struct {
	Servers map[string]MCPServerConfig `mapstructure:"servers"`
}

MCPConfig MCP server settings.

type MCPServerConfig added in v0.4.0

type MCPServerConfig struct {
	Enabled   *bool             `mapstructure:"enabled"`
	Transport string            `mapstructure:"transport"`
	Command   string            `mapstructure:"command"`
	Args      []string          `mapstructure:"args"`
	Env       map[string]string `mapstructure:"env"`
	URL       string            `mapstructure:"url"`
	Headers   map[string]string `mapstructure:"headers"`
}

MCPServerConfig MCP server transport settings.

type MaixCamConfig added in v0.2.2

type MaixCamConfig struct {
	Enabled   bool     `mapstructure:"enabled"`
	Host      string   `mapstructure:"host"`
	Port      int      `mapstructure:"port"`
	AllowFrom []string `mapstructure:"allow_from"`
}

MaixCamConfig MaixCam bridge settings

type PolicyConfig added in v0.4.0

type PolicyConfig struct {
	Mode               string   `mapstructure:"mode"`
	OffTTL             string   `mapstructure:"off_ttl"`
	AllowPersistentOff bool     `mapstructure:"allow_persistent_off"`
	RequireApproval    []string `mapstructure:"require_approval"`
}

PolicyConfig runtime policy settings.

type ProviderConfig

type ProviderConfig struct {
	APIKey    string `mapstructure:"api_key"`
	SecretKey string `mapstructure:"secret_key"`
	BaseURL   string `mapstructure:"base_url"`
}

ProviderConfig single provider settings

type ProvidersConfig

type ProvidersConfig struct {
	OpenRouter ProviderConfig `mapstructure:"openrouter"`
	Claude     ProviderConfig `mapstructure:"claude"`
	OpenAI     ProviderConfig `mapstructure:"openai"`
	DeepSeek   ProviderConfig `mapstructure:"deepseek"`
	Gemini     ProviderConfig `mapstructure:"gemini"`
	Ark        ProviderConfig `mapstructure:"ark"`
	Qianfan    ProviderConfig `mapstructure:"qianfan"`
	Qwen       ProviderConfig `mapstructure:"qwen"`
	Ollama     ProviderConfig `mapstructure:"ollama"`
}

ProvidersConfig LLM provider settings

type QQConfig added in v0.2.2

type QQConfig struct {
	Enabled   bool     `mapstructure:"enabled"`
	AppID     string   `mapstructure:"app_id"`
	AppSecret string   `mapstructure:"app_secret"`
	AllowFrom []string `mapstructure:"allow_from"`
}

QQConfig QQ bot settings

type SlackConfig added in v0.2.2

type SlackConfig struct {
	Enabled   bool     `mapstructure:"enabled"`
	BotToken  string   `mapstructure:"bot_token"`
	AppToken  string   `mapstructure:"app_token"`
	AllowFrom []string `mapstructure:"allow_from"`
}

SlackConfig Slack bot settings

type SubagentRuntimeConfig added in v0.5.0

type SubagentRuntimeConfig struct {
	TimeoutSeconds int `mapstructure:"timeout_seconds"`
	Retry          int `mapstructure:"retry"`
	MaxConcurrency int `mapstructure:"max_concurrency"`
}

SubagentRuntimeConfig controls delegated subagent execution policy.

type TelegramConfig

type TelegramConfig struct {
	Enabled   bool     `mapstructure:"enabled"`
	Token     string   `mapstructure:"token"`
	AllowFrom []string `mapstructure:"allow_from"`
}

TelegramConfig telegram bot settings

type ToolsConfig

type ToolsConfig struct {
	Web   WebToolsConfig  `mapstructure:"web"`
	Exec  ExecToolConfig  `mapstructure:"exec"`
	Voice VoiceToolConfig `mapstructure:"voice"`
}

ToolsConfig tool settings

type VoiceToolConfig added in v0.3.1

type VoiceToolConfig struct {
	Enabled        bool   `mapstructure:"enabled"`
	Provider       string `mapstructure:"provider"`
	Model          string `mapstructure:"model"`
	TimeoutSeconds int    `mapstructure:"timeout_seconds"`
}

VoiceToolConfig speech-to-text settings for inbound audio.

type WebSearchConfig

type WebSearchConfig struct {
	APIKey     string `mapstructure:"api_key"`
	MaxResults int    `mapstructure:"max_results"`
}

WebSearchConfig brave search settings

type WebToolsConfig

type WebToolsConfig struct {
	Search WebSearchConfig `mapstructure:"search"`
}

WebToolsConfig web tool settings

type WhatsAppConfig added in v0.2.2

type WhatsAppConfig struct {
	Enabled   bool     `mapstructure:"enabled"`
	BridgeURL string   `mapstructure:"bridge_url"`
	AllowFrom []string `mapstructure:"allow_from"`
}

WhatsAppConfig WhatsApp bridge settings

Jump to

Keyboard shortcuts

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