config

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultAgentMaxTokens                  = 8192
	DefaultAgentTemperature                = 0.7
	DefaultAgentMemoryWindow               = 50
	DefaultMemorySearchChunkTokens         = 400
	DefaultMemorySearchChunkOverlap        = 80
	DefaultMemorySearchMaxResults          = 6
	DefaultMemorySearchMinScore            = 0.35
	DefaultMemorySearchHybridVectorWeight  = 0.7
	DefaultMemorySearchHybridTextWeight    = 0.3
	DefaultMemorySearchCandidateMultiplier = 4
	DefaultOpenAIBaseURL                   = "https://api.openai.com/v1"
	DefaultOpenRouterBaseURL               = "https://openrouter.ai/api/v1"
	DefaultAnthropicBaseURL                = "https://api.anthropic.com"
	DefaultGeminiBaseURL                   = "https://generativelanguage.googleapis.com/v1beta"
	DefaultOllamaBaseURL                   = "http://localhost:11434/v1"
)

Variables

This section is empty.

Functions

func Save

func Save(path string, cfg *Config) error

Types

type AgentDefaultsConfig

type AgentDefaultsConfig struct {
	Model        string             `json:"model"`
	MaxTokens    int                `json:"maxTokens,omitempty"`
	Temperature  *float64           `json:"temperature,omitempty"`
	MemoryWindow int                `json:"memoryWindow,omitempty"`
	MemorySearch MemorySearchConfig `json:"memorySearch"`
}

func (AgentDefaultsConfig) MaxTokensValue

func (c AgentDefaultsConfig) MaxTokensValue() int

func (AgentDefaultsConfig) MemoryWindowValue added in v0.2.3

func (c AgentDefaultsConfig) MemoryWindowValue() int

func (AgentDefaultsConfig) TemperatureValue

func (c AgentDefaultsConfig) TemperatureValue() float64

type AgentsConfig

type AgentsConfig struct {
	Defaults AgentDefaultsConfig `json:"defaults"`
}

type ChannelsConfig

type ChannelsConfig struct {
	Discord  DiscordConfig  `json:"discord"`
	Slack    SlackConfig    `json:"slack"`
	Telegram TelegramConfig `json:"telegram"`
	WhatsApp WhatsAppConfig `json:"whatsapp"`
}

type Config

type Config struct {
	Env map[string]string `json:"env"`
	// Agent configuration (model, iterations, etc.). Kept small on purpose.
	Agents AgentsConfig `json:"agents"`

	LLM       LLMConfig       `json:"llm"`
	Tools     ToolsConfig     `json:"tools"`
	Cron      CronConfig      `json:"cron"`
	Heartbeat HeartbeatConfig `json:"heartbeat"`
	Gateway   GatewayConfig   `json:"gateway"`
	// Channels are optional; enable what you need.
	Channels ChannelsConfig `json:"channels"`
}

func Default

func Default() *Config

func Load

func Load(path string) (*Config, error)

func (*Config) ApplyLLMRouting

func (cfg *Config) ApplyLLMRouting() (provider string, configuredModel string)

ApplyLLMRouting resolves the effective LLM endpoint and API key from: - agents.defaults.model (preferred) or llm.model - env keys OPENAI_API_KEY / OPENROUTER_API_KEY / ANTHROPIC_API_KEY / GEMINI_API_KEY / GOOGLE_API_KEY It mutates cfg.LLM to the effective values used at runtime.

type CronConfig

type CronConfig struct {
	Enabled *bool `json:"enabled"`
}

func (CronConfig) EnabledValue

func (c CronConfig) EnabledValue() bool

type DiscordConfig

type DiscordConfig struct {
	Enabled    bool     `json:"enabled"`
	Token      string   `json:"token"`
	AllowFrom  []string `json:"allowFrom"`
	GatewayURL string   `json:"gatewayURL,omitempty"`
	Intents    int      `json:"intents,omitempty"`
}

type ExecToolConfig

type ExecToolConfig struct {
	TimeoutSec int `json:"timeoutSec"`
}

type GatewayConfig

type GatewayConfig struct {
	// Listen address for HTTP endpoints needed by channels (reserved for future use).
	// Example: "0.0.0.0:18790"
	Listen string `json:"listen"`
}

type HeartbeatConfig

type HeartbeatConfig struct {
	Enabled     *bool `json:"enabled"`
	IntervalSec int   `json:"intervalSec"`
}

func (HeartbeatConfig) EnabledValue

func (c HeartbeatConfig) EnabledValue() bool

type LLMConfig

type LLMConfig struct {
	Provider string            `json:"provider,omitempty"`
	APIKey   string            `json:"apiKey"`
	BaseURL  string            `json:"baseURL"`
	Model    string            `json:"model"`
	Headers  map[string]string `json:"headers,omitempty"`
}

type MemorySearchCacheConfig added in v0.2.4

type MemorySearchCacheConfig struct {
	Enabled    *bool `json:"enabled,omitempty"`
	MaxEntries int   `json:"maxEntries,omitempty"`
}

func (MemorySearchCacheConfig) EnabledValue added in v0.2.4

func (c MemorySearchCacheConfig) EnabledValue() bool

type MemorySearchChunkingConfig added in v0.2.4

type MemorySearchChunkingConfig struct {
	Tokens  int `json:"tokens,omitempty"`
	Overlap int `json:"overlap,omitempty"`
}

type MemorySearchConfig added in v0.2.4

type MemorySearchConfig struct {
	Enabled *bool `json:"enabled,omitempty"`

	Provider string `json:"provider,omitempty"` // currently openai-compatible
	Model    string `json:"model,omitempty"`

	Remote MemorySearchRemoteConfig `json:"remote"`
	Store  MemorySearchStoreConfig  `json:"store"`

	Chunking MemorySearchChunkingConfig `json:"chunking"`
	Query    MemorySearchQueryConfig    `json:"query"`
	Cache    MemorySearchCacheConfig    `json:"cache"`
	Sync     MemorySearchSyncConfig     `json:"sync"`
}

func (MemorySearchConfig) EnabledValue added in v0.2.4

func (c MemorySearchConfig) EnabledValue() bool

type MemorySearchHybridConfig added in v0.2.4

type MemorySearchHybridConfig struct {
	VectorWeight        *float64 `json:"vectorWeight,omitempty"`
	TextWeight          *float64 `json:"textWeight,omitempty"`
	CandidateMultiplier int      `json:"candidateMultiplier,omitempty"`
}

type MemorySearchQueryConfig added in v0.2.4

type MemorySearchQueryConfig struct {
	MaxResults int                      `json:"maxResults,omitempty"`
	MinScore   *float64                 `json:"minScore,omitempty"`
	Hybrid     MemorySearchHybridConfig `json:"hybrid"`
}

type MemorySearchRemoteConfig added in v0.2.4

type MemorySearchRemoteConfig struct {
	BaseURL string            `json:"baseURL,omitempty"`
	APIKey  string            `json:"apiKey,omitempty"`
	Headers map[string]string `json:"headers,omitempty"`
}

type MemorySearchStoreConfig added in v0.2.4

type MemorySearchStoreConfig struct {
	Path   string                        `json:"path,omitempty"`
	Vector MemorySearchVectorStoreConfig `json:"vector"`
}

type MemorySearchSyncConfig added in v0.2.4

type MemorySearchSyncConfig struct {
	OnSearch *bool `json:"onSearch,omitempty"`
}

func (MemorySearchSyncConfig) OnSearchValue added in v0.2.4

func (c MemorySearchSyncConfig) OnSearchValue() bool

type MemorySearchVectorStoreConfig added in v0.2.4

type MemorySearchVectorStoreConfig struct {
	Enabled *bool `json:"enabled,omitempty"`
}

func (MemorySearchVectorStoreConfig) EnabledValue added in v0.2.4

func (c MemorySearchVectorStoreConfig) EnabledValue() bool

type SlackConfig

type SlackConfig struct {
	Enabled   bool     `json:"enabled"`
	AllowFrom []string `json:"allowFrom"`
	BotToken  string   `json:"botToken"` // xoxb-...
	AppToken  string   `json:"appToken"` // xapp-... (Socket Mode)
	// GroupPolicy controls whether the bot responds to non-DM messages.
	// Supported: "mention" (default), "open", "allowlist".
	GroupPolicy    string         `json:"groupPolicy,omitempty"`
	GroupAllowFrom []string       `json:"groupAllowFrom,omitempty"` // channel IDs allowed when groupPolicy="allowlist"
	DM             *SlackDMConfig `json:"dm,omitempty"`
}

Slack (Socket Mode). Inbound via Socket Mode, outbound via Web API (chat.postMessage).

type SlackDMConfig

type SlackDMConfig struct {
	Enabled bool `json:"enabled"`
}

type TelegramConfig added in v0.2.2

type TelegramConfig struct {
	Enabled        bool     `json:"enabled"`
	Token          string   `json:"token"`
	AllowFrom      []string `json:"allowFrom"`
	BaseURL        string   `json:"baseURL,omitempty"` // optional: custom Bot API server URL
	PollTimeoutSec int      `json:"pollTimeoutSec,omitempty"`
	Workers        int      `json:"workers,omitempty"`
}

Telegram (Bot API via long polling).

type ToolsConfig

type ToolsConfig struct {
	RestrictToWorkspace *bool          `json:"restrictToWorkspace"`
	Exec                ExecToolConfig `json:"exec"`
	Web                 WebToolsConfig `json:"web"`
}

func (ToolsConfig) RestrictToWorkspaceValue

func (c ToolsConfig) RestrictToWorkspaceValue() bool

type WebToolsConfig

type WebToolsConfig struct {
	BraveAPIKey string `json:"braveApiKey"`
}

type WhatsAppConfig added in v0.2.2

type WhatsAppConfig struct {
	Enabled          bool     `json:"enabled"`
	AllowFrom        []string `json:"allowFrom"`
	SessionStorePath string   `json:"sessionStorePath,omitempty"` // optional: sqlite store path for persistent login
}

WhatsApp (whatsmeow / WhatsApp Web Multi-Device).

Jump to

Keyboard shortcuts

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