config

package
v0.2.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	DefaultAgentMaxTokens    = 8192
	DefaultAgentTemperature  = 0.7
	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"`
}

func (AgentDefaultsConfig) MaxTokensValue

func (c AgentDefaultsConfig) MaxTokensValue() 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"`
}

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 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 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"`
}

Jump to

Keyboard shortcuts

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