config

package
v0.93.0 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2026 License: GPL-3.0 Imports: 24 Imported by: 0

Documentation

Overview

Package config provides runtime configuration loading and management.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChatAgentChatModel added in v0.93.0

func ChatAgentChatModel() string

ChatAgentChatModel returns the configured chat model for the chat agent.

func ChatAgentContextWindow added in v0.93.0

func ChatAgentContextWindow() int

ChatAgentContextWindow returns the effective input budget for the configured chat agent models.

func ChatAgentEnabled added in v0.93.0

func ChatAgentEnabled() bool

ChatAgentEnabled reports whether the chat agent is enabled with a configured chat model.

func ContextWindowForModel added in v0.93.0

func ContextWindowForModel(modelName string) int

ContextWindowForModel returns the catalog context window for a model name.

func ContextWindowForModels deprecated added in v0.93.0

func ContextWindowForModels(_ []Model, modelName string) int

ContextWindowForModels returns the catalog context window for modelName.

Deprecated: models is ignored. Call ContextWindowForModel or ChatAgentContextWindow instead.

func Load

func Load(path ...string) error

func MaxContextWindow added in v0.93.0

func MaxContextWindow(modelNames ...string) int

MaxContextWindow returns the largest catalog context window among the given model names.

func ModelProviderFor added in v0.93.0

func ModelProviderFor(modelName string) string

ModelProviderFor returns the provider for a registered model name, or "" if unknown.

func ModelRegistered added in v0.93.0

func ModelRegistered(modelName string) bool

ModelRegistered reports whether modelName appears in the configured models list.

func ResolveChatAgentModels added in v0.93.0

func ResolveChatAgentModels() (chat, tool string, dual bool, err error)

ResolveChatAgentModels resolves chat and tool model names and whether dual routing applies. Dual mode is enabled when tool_model is non-empty.

Types

type AbilityConfig added in v0.92.0

type AbilityConfig struct {
	// EventPool configures the goroutine pool for event emission.
	EventPool AbilityEventPool `json:"event_pool" yaml:"event_pool" mapstructure:"event_pool"`
}

AbilityConfig holds ability invocation configuration.

type AbilityEventPool added in v0.92.0

type AbilityEventPool struct {
	// Size is the max number of goroutines in the pool (0 = ants default).
	Size int `json:"size" yaml:"size" mapstructure:"size"`
	// ExpiryDuration is the idle worker eviction interval (e.g. "30s").
	ExpiryDuration string `json:"expiry_duration" yaml:"expiry_duration" mapstructure:"expiry_duration"`
}

AbilityEventPool configures the goroutine pool for event emission.

type ChatAgentConfig added in v0.93.0

type ChatAgentConfig struct {
	// Workspace root for file and shell tools; required when the chat agent is enabled.
	Workspace string `json:"workspace" yaml:"workspace" mapstructure:"workspace"`
	// ShellTimeout limits terminal and code execution duration.
	ShellTimeout time.Duration `json:"shell_timeout" yaml:"shell_timeout" mapstructure:"shell_timeout"`
	// MaxToolOutput truncates tool stdout beyond this size in bytes.
	MaxToolOutput int `json:"max_tool_output" yaml:"max_tool_output" mapstructure:"max_tool_output"`
	// MaxSteps limits agent Observe-Think-Act iterations per user turn.
	MaxSteps int `json:"max_steps" yaml:"max_steps" mapstructure:"max_steps"`
	// RunTimeout limits total duration for one assistant turn in direct chat.
	RunTimeout time.Duration `json:"run_timeout" yaml:"run_timeout" mapstructure:"run_timeout"`
	// SystemPrompt replaces the default system prompt when non-empty.
	SystemPrompt string `json:"system_prompt" yaml:"system_prompt" mapstructure:"system_prompt"`
	// AppendSystemPrompt is appended to the system prompt body.
	AppendSystemPrompt string `json:"append_system_prompt" yaml:"append_system_prompt" mapstructure:"append_system_prompt"`
	// PromptGuidelines adds extra guideline bullets to the default system prompt.
	PromptGuidelines []string `json:"prompt_guidelines" yaml:"prompt_guidelines" mapstructure:"prompt_guidelines"`
	// ContextFiles lists project instruction files relative to workspace; defaults to AGENTS.md and README.md.
	ContextFiles []string `json:"context_files" yaml:"context_files" mapstructure:"context_files"`
	// Compaction configures automatic history compaction for long chat sessions.
	Compaction CompactionConfig `json:"compaction" yaml:"compaction" mapstructure:"compaction"`
	// ChatModel selects the chat agent model; non-empty enables the chat agent.
	ChatModel string `json:"chat_model" yaml:"chat_model" mapstructure:"chat_model"`
	// ToolModel enables dual-model routing when set; used after tool execution.
	ToolModel string `json:"tool_model" yaml:"tool_model" mapstructure:"tool_model"`
	// SubagentMaxDepth caps nested task-tool delegation; defaults to 1 (no nested subagents).
	SubagentMaxDepth int `json:"subagent_max_depth" yaml:"subagent_max_depth" mapstructure:"subagent_max_depth"`
	// SubagentDefaultModel overrides the model used by subagents without an explicit model; defaults to ChatModel.
	SubagentDefaultModel string `json:"subagent_default_model" yaml:"subagent_default_model" mapstructure:"subagent_default_model"`
	// SubagentMaxSteps limits Observe-Think-Act iterations within one subagent run; defaults to MaxSteps.
	SubagentMaxSteps int `json:"subagent_max_steps" yaml:"subagent_max_steps" mapstructure:"subagent_max_steps"`
}

ChatAgentConfig configures the direct-message chat assistant agent runtime.

type CompactionConfig added in v0.93.0

type CompactionConfig struct {
	// Auto turns on threshold-based compaction before agent runs.
	Auto *bool `json:"auto" yaml:"auto" mapstructure:"auto"`
	// Prune removes older tool outputs from the compaction prompt before summarization.
	Prune *bool `json:"prune" yaml:"prune" mapstructure:"prune"`
	// Reserved is headroom reserved below the model context window.
	Reserved int `json:"reserved" yaml:"reserved" mapstructure:"reserved"`
	// Enabled preserves compatibility with older configs that used the enabled key.
	Enabled *bool `json:"enabled,omitempty" yaml:"enabled,omitempty" mapstructure:"enabled"`
	// ReserveTokens preserves compatibility with older configs that used reserve_tokens.
	ReserveTokens int `json:"reserve_tokens,omitempty" yaml:"reserve_tokens,omitempty" mapstructure:"reserve_tokens"`
	// KeepRecentTokens controls the approximate token budget kept verbatim after compaction.
	KeepRecentTokens int `json:"keep_recent_tokens,omitempty" yaml:"keep_recent_tokens,omitempty" mapstructure:"keep_recent_tokens"`
}

CompactionConfig controls session history compaction for the chat agent.

func (CompactionConfig) AutoEnabled added in v0.93.0

func (c CompactionConfig) AutoEnabled() bool

AutoEnabled reports whether automatic pre-run compaction is enabled.

func (CompactionConfig) KeepRecentBudget added in v0.93.0

func (c CompactionConfig) KeepRecentBudget() int

KeepRecentBudget returns the configured recent-history budget that remains verbatim.

func (CompactionConfig) PruneEnabled added in v0.93.0

func (c CompactionConfig) PruneEnabled() bool

PruneEnabled reports whether older tool results should be pruned during compaction.

func (CompactionConfig) ReservedTokens added in v0.93.0

func (c CompactionConfig) ReservedTokens() int

ReservedTokens returns the configured compaction headroom.

func (CompactionConfig) WithDefaults added in v0.93.0

func (c CompactionConfig) WithDefaults() CompactionConfig

WithDefaults fills zero compaction settings with package defaults.

type Discord

type Discord struct {
	// Discord platform configuration
	Enabled bool `json:"enabled" yaml:"enabled" mapstructure:"enabled"`
	// Discord app ID
	AppID string `json:"app_id" yaml:"app_id" mapstructure:"app_id" validate:"required_if=Enabled true"`
	// Discord public key
	PublicKey string `json:"public_key" yaml:"public_key" mapstructure:"public_key" validate:"required_if=Enabled true"`
	// Discord client ID
	ClientID string `json:"client_id" yaml:"client_id" mapstructure:"client_id" validate:"required_if=Enabled true"`
	// Discord client secret
	ClientSecret string `json:"client_secret" yaml:"client_secret" mapstructure:"client_secret" validate:"required_if=Enabled true"`
	// Discord bot token
	BotToken string `json:"bot_token" yaml:"bot_token" mapstructure:"bot_token" validate:"required_if=Enabled true"`
}

type Executor added in v0.32.1

type Executor struct {
	// Executor type: docker
	Type string `json:"type" yaml:"type" mapstructure:"type"`
	// Resource limits
	Limits  ExecutorLimits        `json:"limits" yaml:"limits" mapstructure:"limits"`
	Mounts  ExecutorMounts        `json:"mounts" yaml:"mounts" mapstructure:"mounts"`
	Docker  ExecutorDockerConfig  `json:"docker" yaml:"docker" mapstructure:"docker"`
	Shell   ExecutorShellConfig   `json:"shell" yaml:"shell" mapstructure:"shell"`
	Machine ExecutorMachineConfig `json:"machine" yaml:"machine" mapstructure:"machine"`
}

type ExecutorDockerConfig added in v0.92.0

type ExecutorDockerConfig struct {
	// Docker config
	Config string `json:"config" yaml:"config" mapstructure:"config"`
}

type ExecutorLimits added in v0.92.0

type ExecutorLimits struct {
	// CPU limit
	Cpus string `json:"cpus" yaml:"cpus" mapstructure:"cpus"`
	// Memory limit
	Memory string `json:"memory" yaml:"memory" mapstructure:"memory"`
}

type ExecutorMachineConfig added in v0.92.0

type ExecutorMachineConfig struct {
	// Host
	Host string `json:"host" yaml:"host" mapstructure:"host"`
	// Port
	Port int `json:"port" yaml:"port" mapstructure:"port"`
	// Username
	Username string `json:"username" yaml:"username" mapstructure:"username"`
	// Password
	Password string `json:"password" yaml:"password" mapstructure:"password"`
	// HostKey is the base64-encoded SSH host public key
	HostKey string `json:"host_key" yaml:"host_key" mapstructure:"host_key"`
}

type ExecutorMountBind added in v0.92.0

type ExecutorMountBind struct {
	// Allowed
	Allowed bool `json:"allowed" yaml:"allowed" mapstructure:"allowed"`
}

type ExecutorMounts added in v0.92.0

type ExecutorMounts struct {
	// Bind mount
	Bind ExecutorMountBind `json:"bind" yaml:"bind" mapstructure:"bind"`
}

type ExecutorShellConfig added in v0.92.0

type ExecutorShellConfig struct {
	// Command
	CMD []string `json:"cmd" yaml:"cmd" mapstructure:"cmd"`
	// User ID
	UID string `json:"uid" yaml:"uid" mapstructure:"uid"`
	// Group ID
	GID string `json:"gid" yaml:"gid" mapstructure:"gid"`
}

type Flowbot

type Flowbot struct {
	// Flowbot URL
	URL string `json:"url" yaml:"url" mapstructure:"url" validate:"omitempty,url"`
	// Flowbot channel path
	ChannelPath string `json:"channel_path" yaml:"channel_path" mapstructure:"channel_path"`
	// language
	Language string `json:"language" yaml:"language" mapstructure:"language"`
}

type Homelab added in v0.92.0

type Homelab struct {
	Root        string             `json:"root" yaml:"root" mapstructure:"root"`
	AppsDir     string             `json:"apps_dir" yaml:"apps_dir" mapstructure:"apps_dir"`
	ComposeFile string             `json:"compose_file" yaml:"compose_file" mapstructure:"compose_file"`
	Runtime     HomelabRuntime     `json:"runtime" yaml:"runtime" mapstructure:"runtime"`
	Allowlist   []string           `json:"allowlist" yaml:"allowlist" mapstructure:"allowlist"`
	Permissions HomelabPermissions `json:"permissions" yaml:"permissions" mapstructure:"permissions"`
	Discovery   HomelabDiscovery   `json:"discovery" yaml:"discovery" mapstructure:"discovery"`
}

type HomelabDiscovery added in v0.92.0

type HomelabDiscovery struct {
	ProbeEnabled       bool     `json:"probe_enabled" yaml:"probe_enabled" mapstructure:"probe_enabled"`
	ProbeTimeout       string   `json:"probe_timeout" yaml:"probe_timeout" mapstructure:"probe_timeout"`
	ProbeConcurrency   int      `json:"probe_concurrency" yaml:"probe_concurrency" mapstructure:"probe_concurrency"`
	ProbeNetworks      []string `json:"probe_networks" yaml:"probe_networks" mapstructure:"probe_networks"`
	ProbePortStrategy  string   `json:"probe_port_strategy" yaml:"probe_port_strategy" mapstructure:"probe_port_strategy"`
	FingerprintEnabled bool     `json:"fingerprint_enabled" yaml:"fingerprint_enabled" mapstructure:"fingerprint_enabled"`
	LabelPriority      bool     `json:"label_priority" yaml:"label_priority" mapstructure:"label_priority"`
}

type HomelabPermissions added in v0.92.0

type HomelabPermissions struct {
	Status  bool `json:"status" yaml:"status" mapstructure:"status"`
	Logs    bool `json:"logs" yaml:"logs" mapstructure:"logs"`
	Start   bool `json:"start" yaml:"start" mapstructure:"start"`
	Stop    bool `json:"stop" yaml:"stop" mapstructure:"stop"`
	Restart bool `json:"restart" yaml:"restart" mapstructure:"restart"`
	Pull    bool `json:"pull" yaml:"pull" mapstructure:"pull"`
	Update  bool `json:"update" yaml:"update" mapstructure:"update"`
	Exec    bool `json:"exec" yaml:"exec" mapstructure:"exec"`
}

type HomelabRuntime added in v0.92.0

type HomelabRuntime struct {
	Mode         string `json:"mode" yaml:"mode" mapstructure:"mode"`
	DockerSocket string `json:"docker_socket" yaml:"docker_socket" mapstructure:"docker_socket"`
	SSHHost      string `json:"ssh_host" yaml:"ssh_host" mapstructure:"ssh_host"`
	SSHPort      int    `json:"ssh_port" yaml:"ssh_port" mapstructure:"ssh_port"`
	SSHUser      string `json:"ssh_user" yaml:"ssh_user" mapstructure:"ssh_user"`
	SSHPassword  string `json:"ssh_password" yaml:"ssh_password" mapstructure:"ssh_password"`
	SSHKey       string `json:"ssh_key" yaml:"ssh_key" mapstructure:"ssh_key"`
	SSHHostKey   string `json:"ssh_host_key" yaml:"ssh_host_key" mapstructure:"ssh_host_key"`
}

type Log

type Log struct {
	// Log level: debug, info, warn, error, fatal, panic
	Level string `json:"level" yaml:"level" mapstructure:"level" validate:"omitempty,oneof=debug info warn error fatal panic"`
	// Caller enables caller (file:line) info in all log levels
	Caller bool `json:"caller" yaml:"caller" mapstructure:"caller"`
	// StackTrace enables full stack traces on errors
	StackTrace bool `json:"stackTrace" yaml:"stackTrace" mapstructure:"stackTrace"`
	// JSONOutput writes JSON to stdout instead of human-readable console format
	JSONOutput bool `json:"jsonOutput" yaml:"jsonOutput" mapstructure:"jsonOutput"`
	// FileLog enables file logging (defaults to XDG config dir)
	FileLog bool `json:"fileLog" yaml:"fileLog" mapstructure:"fileLog"`
	// FileLogPath overrides the default log file path
	FileLogPath string `json:"fileLogPath" yaml:"fileLogPath" mapstructure:"fileLogPath"`
	// ModuleLevel sets per-module log levels, e.g. {"pipeline": "debug"}
	ModuleLevel map[string]string `json:"moduleLevel" yaml:"moduleLevel" mapstructure:"moduleLevel"`
	// Sampling configures burst sampling for high-frequency log points
	Sampling *LogSampling `json:"sampling" yaml:"sampling" mapstructure:"sampling"`
	// Rotation configures log file rotation
	Rotation *LogRotation `json:"rotation" yaml:"rotation" mapstructure:"rotation"`
}

type LogRotation added in v0.92.0

type LogRotation struct {
	// MaxSize is the maximum size in megabytes before rotation
	MaxSize int `json:"maxSize" yaml:"maxSize" mapstructure:"maxSize"`
	// MaxAge is the maximum number of days to retain old log files
	MaxAge int `json:"maxAge" yaml:"maxAge" mapstructure:"maxAge"`
	// MaxBackups is the maximum number of old log files to retain
	MaxBackups int `json:"maxBackups" yaml:"maxBackups" mapstructure:"maxBackups"`
	// Compress determines if rotated log files are gzipped
	Compress bool `json:"compress" yaml:"compress" mapstructure:"compress"`
}

LogRotation configures log file rotation using lumberjack.

type LogSampling added in v0.92.0

type LogSampling struct {
	// Burst allows this many events in the period before sampling kicks in
	Burst int `json:"burst" yaml:"burst" mapstructure:"burst"`
	// Period is the sampling window in seconds
	Period int `json:"period" yaml:"period" mapstructure:"period"`
}

LogSampling configures burst sampling to reduce noise from high-frequency log points.

type Metrics added in v0.18.1

type Metrics struct {
	// Enabled
	Enabled bool `json:"enabled" yaml:"enabled" mapstructure:"enabled"`
	// Metrics endpoint
	Endpoint string `json:"endpoint" yaml:"endpoint" mapstructure:"endpoint"`
}

type Model added in v0.31.1

type Model struct {
	// Provider
	Provider string `json:"provider" yaml:"provider" mapstructure:"provider"`
	// Base URL
	BaseUrl string `json:"base_url" yaml:"base_url" mapstructure:"base_url"`
	// API key
	ApiKey string `json:"api_key" yaml:"api_key" mapstructure:"api_key"`
	// Useful model names
	ModelNames []string `json:"model_names" yaml:"model_names" mapstructure:"model_names"`
}

type Notify added in v0.92.0

type Notify struct {
	// Templates defines notification message templates indexed by ID.
	Templates []NotifyTemplate `json:"templates" yaml:"templates" mapstructure:"templates"`
	// Rules defines notification filtering and aggregation rules.
	Rules []NotifyRule `json:"rules" yaml:"rules" mapstructure:"rules"`
}

Notify holds notification gateway configuration including templates and rules.

type NotifyOverride added in v0.92.0

type NotifyOverride struct {
	Channel  string `json:"channel" yaml:"channel" mapstructure:"channel"`
	Format   string `json:"format" yaml:"format" mapstructure:"format"`
	Template string `json:"template" yaml:"template" mapstructure:"template"`
}

NotifyOverride defines a channel-specific template override.

type NotifyRule added in v0.92.0

type NotifyRule struct {
	ID        string           `json:"id" yaml:"id" mapstructure:"id"`
	Action    NotifyRuleAction `json:"action" yaml:"action" mapstructure:"action"`
	Match     NotifyRuleMatch  `json:"match" yaml:"match" mapstructure:"match"`
	Condition string           `json:"condition" yaml:"condition" mapstructure:"condition"`
	Priority  int              `json:"priority" yaml:"priority" mapstructure:"priority"`
	Params    NotifyRuleParams `json:"params" yaml:"params" mapstructure:"params"`
}

NotifyRule defines a notification filtering or aggregation rule.

type NotifyRuleAction added in v0.92.0

type NotifyRuleAction string

NotifyRuleAction defines the action to take when a rule matches.

const (
	NotifyRuleActionThrottle  NotifyRuleAction = "throttle"
	NotifyRuleActionAggregate NotifyRuleAction = "aggregate"
	NotifyRuleActionMute      NotifyRuleAction = "mute"
	NotifyRuleActionDrop      NotifyRuleAction = "drop"
)

Rule action constants.

type NotifyRuleMatch added in v0.92.0

type NotifyRuleMatch struct {
	Event   string `json:"event" yaml:"event" mapstructure:"event"`
	Channel string `json:"channel" yaml:"channel" mapstructure:"channel"`
}

NotifyRuleMatch defines the event and channel matching criteria.

type NotifyRuleParams added in v0.92.0

type NotifyRuleParams struct {
	Window      string `json:"window" yaml:"window" mapstructure:"window"`
	Limit       int    `json:"limit" yaml:"limit" mapstructure:"limit"`
	DigestTplID string `json:"digest_template_id" yaml:"digest_template_id" mapstructure:"digest_template_id"`
	DelayedSend bool   `json:"delayed_send" yaml:"delayed_send" mapstructure:"delayed_send"`
}

NotifyRuleParams holds action-specific parameters.

type NotifyTemplate added in v0.92.0

type NotifyTemplate struct {
	ID              string           `json:"id" yaml:"id" mapstructure:"id"`
	Name            string           `json:"name" yaml:"name" mapstructure:"name"`
	Description     string           `json:"description" yaml:"description" mapstructure:"description"`
	DefaultFormat   string           `json:"default_format" yaml:"default_format" mapstructure:"default_format"`
	DefaultTemplate string           `json:"default_template" yaml:"default_template" mapstructure:"default_template"`
	Overrides       []NotifyOverride `json:"overrides" yaml:"overrides" mapstructure:"overrides"`
}

NotifyTemplate defines a notification message template with optional per-channel overrides.

type Pipeline added in v0.92.0

type Pipeline struct {
	Name        string          `json:"name" yaml:"name" mapstructure:"name"`
	Description string          `json:"description" yaml:"description" mapstructure:"description"`
	Enabled     bool            `json:"enabled" yaml:"enabled" mapstructure:"enabled"`
	Resumable   bool            `json:"resumable" yaml:"resumable" mapstructure:"resumable"`
	Trigger     PipelineTrigger `json:"trigger" yaml:"trigger" mapstructure:"trigger"`
	Steps       []PipelineStep  `json:"steps" yaml:"steps" mapstructure:"steps"`
}

type PipelineStep added in v0.92.0

type PipelineStep struct {
	Name       string             `json:"name" yaml:"name" mapstructure:"name"`
	Capability string             `json:"capability" yaml:"capability" mapstructure:"capability"`
	Operation  string             `json:"operation" yaml:"operation" mapstructure:"operation"`
	Params     map[string]any     `json:"params" yaml:"params" mapstructure:"params"`
	Retry      *PipelineStepRetry `json:"retry" yaml:"retry" mapstructure:"retry"`
}

type PipelineStepRetry added in v0.92.0

type PipelineStepRetry struct {
	MaxAttempts int      `json:"max_attempts" yaml:"max_attempts" mapstructure:"max_attempts"`
	Delay       string   `json:"delay" yaml:"delay" mapstructure:"delay"`
	Backoff     string   `json:"backoff" yaml:"backoff" mapstructure:"backoff"`
	MaxDelay    string   `json:"max_delay" yaml:"max_delay" mapstructure:"max_delay"`
	Jitter      bool     `json:"jitter" yaml:"jitter" mapstructure:"jitter"`
	RetryOn     []string `json:"retry_on" yaml:"retry_on" mapstructure:"retry_on"`
}

PipelineStepRetry mirrors types.RetryConfig for config parsing.

type PipelineTrigger added in v0.92.0

type PipelineTrigger struct {
	Event       string          `json:"event" yaml:"event" mapstructure:"event"`
	Cron        string          `json:"cron" yaml:"cron" mapstructure:"cron"`
	CronTimeout string          `json:"cron_timeout" yaml:"cron_timeout" mapstructure:"cron_timeout"`
	Webhook     *WebhookTrigger `json:"webhook" yaml:"webhook" mapstructure:"webhook"`
}

type Profiling added in v0.92.0

type Profiling struct {
	// Enabled toggles continuous profiling
	Enabled bool `json:"enabled" yaml:"enabled" mapstructure:"enabled"`
	// ServerAddress is the Pyroscope server URL (e.g. http://localhost:4040)
	ServerAddress string `json:"server_address" yaml:"server_address" mapstructure:"server_address" validate:"required_if=Enabled true,omitempty,url"`
	// ServiceName identifies this service in profiles
	ServiceName string `json:"service_name" yaml:"service_name" mapstructure:"service_name"`
	// Environment tag (development, staging, production)
	Environment string `json:"environment" yaml:"environment" mapstructure:"environment"`
	// ProfileTypes lists the profile types to enable (cpu, alloc_objects, etc.)
	ProfileTypes []string `json:"profile_types" yaml:"profile_types" mapstructure:"profile_types"`
}

Profiling configures Pyroscope continuous profiling.

type Redis

type Redis struct {
	// Redis host
	Host string `json:"host" yaml:"host" mapstructure:"host" validate:"required,min=1"`
	// Redis port
	Port int `json:"port" yaml:"port" mapstructure:"port" validate:"required,gte=1,lte=65535"`
	// Redis database
	DB int `json:"db" yaml:"db" mapstructure:"db"`
	// Redis password
	Password string `json:"password" yaml:"pass" mapstructure:"password" validate:"required,min=1"`
	// Maximum number of connections in the pool (0 = go-redis default: 10*GOMAXPROCS)
	PoolSize int `json:"pool_size" yaml:"pool_size" mapstructure:"pool_size"`
	// Minimum number of idle connections maintained in the pool (0 = default: none)
	MinIdleConns int `json:"min_idle_conns" yaml:"min_idle_conns" mapstructure:"min_idle_conns"`
	// Maximum number of retries before giving up (0 = default: 3)
	MaxRetries int `json:"max_retries" yaml:"max_retries" mapstructure:"max_retries"`
	// Minimum backoff between retries (0 = default: 8ms)
	MinRetryBackoff time.Duration `json:"min_retry_backoff" yaml:"min_retry_backoff" mapstructure:"min_retry_backoff"`
	// Maximum backoff between retries (0 = default: 512ms)
	MaxRetryBackoff time.Duration `json:"max_retry_backoff" yaml:"max_retry_backoff" mapstructure:"max_retry_backoff"`
	// Dial timeout for establishing new connections (0 = default: 5s)
	DialTimeout time.Duration `json:"dial_timeout" yaml:"dial_timeout" mapstructure:"dial_timeout"`
	// Timeout for socket reads (0 = fallback to 60s for backward compatibility)
	ReadTimeout time.Duration `json:"read_timeout" yaml:"read_timeout" mapstructure:"read_timeout"`
	// Timeout for socket writes (0 = fallback to 60s for backward compatibility)
	WriteTimeout time.Duration `json:"write_timeout" yaml:"write_timeout" mapstructure:"write_timeout"`
	// Timeout for waiting for a connection from the pool (0 = default: ReadTimeout + 1s)
	PoolTimeout time.Duration `json:"pool_timeout" yaml:"pool_timeout" mapstructure:"pool_timeout"`
	// Maximum idle time for a connection before closing (0 = default: 30min)
	ConnMaxIdleTime time.Duration `json:"conn_max_idle_time" yaml:"conn_max_idle_time" mapstructure:"conn_max_idle_time"`
	// Maximum lifetime of a connection (0 = default: no limit)
	ConnMaxLifetime time.Duration `json:"conn_max_lifetime" yaml:"conn_max_lifetime" mapstructure:"conn_max_lifetime"`
	// Use FIFO (first-in-first-out) instead of LIFO for pool connections
	PoolFIFO bool `json:"pool_fifo" yaml:"pool_fifo" mapstructure:"pool_fifo"`
}

Redis stores connection and pool configuration for the Redis client.

type Search struct {
	// Search URL base map
	UrlBaseMap map[string]string `json:"url_base_map" yaml:"url_base_map" mapstructure:"url_base_map"`
}

type Slack

type Slack struct {
	// Slack platform configuration
	Enabled bool `json:"enabled" yaml:"enabled" mapstructure:"enabled"`
	// Slack app ID
	AppID         string `json:"app_id" yaml:"app_id" mapstructure:"app_id"`
	ClientID      string `json:"client_id" yaml:"client_id" mapstructure:"client_id"`
	ClientSecret  string `json:"client_secret" yaml:"client_secret" mapstructure:"client_secret"`
	SigningSecret string `json:"signing_secret" yaml:"signing_secret" mapstructure:"signing_secret"`
	// Slack verification token
	VerificationToken string `json:"verification_token" yaml:"verification_token" mapstructure:"verification_token"`
	// Slack app token
	AppToken string `json:"app_token" yaml:"app_token" mapstructure:"app_token"`
	// Slack bot token
	BotToken string `json:"bot_token" yaml:"bot_token" mapstructure:"bot_token"`
}

type StoreType

type StoreType struct {
	// Maximum number of results to return from adapter.
	MaxResults int `json:"max_results" yaml:"max_results" mapstructure:"max_results"`
	// DB adapter name to use. Should be one of those specified in `Adapters`.
	UseAdapter string `json:"use_adapter" yaml:"use_adapter" mapstructure:"use_adapter"`
	// Configurations for individual adapters.
	Adapters map[string]any `json:"adapters" yaml:"adapters" mapstructure:"adapters"`
}

type Tailchat

type Tailchat struct {
	// Tailchat platform configuration
	Enabled bool `json:"enabled" yaml:"enabled" mapstructure:"enabled"`
	// Tailchat API URL
	ApiURL string `json:"api_url" yaml:"api_url" mapstructure:"api_url" validate:"required_if=Enabled true,omitempty,url"`
	// Tailchat app ID
	AppID string `json:"app_id" yaml:"app_id" mapstructure:"app_id"`
	// Tailchat app secret
	AppSecret string `json:"app_secret" yaml:"app_secret" mapstructure:"app_secret"`
}

type Telegram

type Telegram struct {
	// Telegram platform configuration
	Enabled bool `json:"enabled" yaml:"enabled" mapstructure:"enabled"`
}

type Tracing added in v0.92.0

type Tracing struct {
	// Enabled toggles trace export
	Enabled bool `json:"enabled" yaml:"enabled" mapstructure:"enabled"`
	// Endpoint is the OTLP HTTP endpoint (e.g. http://localhost:4318/v1/traces)
	Endpoint string `json:"endpoint" yaml:"endpoint" mapstructure:"endpoint" validate:"required_if=Enabled true,omitempty,url"`
	// ServiceName identifies this service in traces
	ServiceName string `json:"service_name" yaml:"service_name" mapstructure:"service_name"`
	// Environment tag (development, staging, production)
	Environment string `json:"environment" yaml:"environment" mapstructure:"environment"`
	// SampleRate controls trace sampling (0.0-1.0)
	SampleRate float64 `json:"sample_rate" yaml:"sample_rate" mapstructure:"sample_rate" validate:"omitempty,gte=0,lte=1"`
}

Tracing configures OpenTelemetry distributed tracing.

type Type added in v0.31.1

type Type struct {
	// HTTP(S) address:port to listen on for websocket and long polling clients. Either a
	// numeric or a canonical name, e.g. ":80" or ":https". Could include a host name, e.g.
	// "localhost:80".
	// Could be blank: if TLS is not configured, will use ":80", otherwise ":443".
	// Can be overridden from the command line, see option --listen.
	Listen string `json:"listen" yaml:"listen" mapstructure:"listen"`
	// Base URL path where the streaming and large file API calls are served, default is '/'.
	// Can be overridden from the command line, see option --api_path.
	ApiPath string `json:"api_path" yaml:"api_path" mapstructure:"api_path"`

	// Configs for subsystems
	Store StoreType    `json:"store_config" yaml:"store_config" mapstructure:"store_config"`
	Media *mediaConfig `json:"media" yaml:"media" mapstructure:"media"`

	// Redis
	Redis Redis `json:"redis" yaml:"redis" mapstructure:"redis"`

	// Log
	Log Log `json:"log" yaml:"log" mapstructure:"log"`

	// Config for modules
	Modules any `json:"modules" yaml:"modules" mapstructure:"modules"`

	// Config for vendors
	Vendors any `json:"vendors" yaml:"vendors" mapstructure:"vendors"`

	// Platform
	Platform platform `json:"platform" yaml:"platform" mapstructure:"platform"`

	// Executor
	Executor Executor `json:"executor" yaml:"executor" mapstructure:"executor"`

	// Metrics
	Metrics Metrics `json:"metrics" yaml:"metrics" mapstructure:"metrics"`

	// Search
	Search Search `json:"search" yaml:"search" mapstructure:"search"`

	// Project
	Flowbot Flowbot `json:"flowbot" yaml:"flowbot" mapstructure:"flowbot"`

	// Models
	Models []Model `json:"models" yaml:"models" mapstructure:"models"`

	// ChatAgent configures the direct-message chat assistant agent.
	ChatAgent ChatAgentConfig `json:"chat_agent" yaml:"chat_agent" mapstructure:"chat_agent"`

	// Homelab app registry and lifecycle configuration
	Homelab Homelab `json:"homelab" yaml:"homelab" mapstructure:"homelab"`

	// Pipeline definitions for cross-service event-driven automation.
	// Populated at runtime from pipelines.yaml.
	Pipelines []Pipeline `json:"pipelines" yaml:"-" mapstructure:"-"`

	// Notify configuration for notification gateway
	Notify Notify `json:"notify" yaml:"notify" mapstructure:"notify"`

	// OpenTelemetry tracing configuration
	Tracing Tracing `json:"tracing" yaml:"tracing" mapstructure:"tracing"`

	// Pyroscope continuous profiling configuration
	Profiling Profiling `json:"profiling" yaml:"profiling" mapstructure:"profiling"`

	// Ability invocation configuration
	Ability AbilityConfig `json:"ability" yaml:"ability" mapstructure:"ability"`

	// Plugin system configuration
	Plugins *plugintypes.PluginConfig `json:"plugins" yaml:"plugins" mapstructure:"plugins"`
}

Type of the configuration file

var App Type

func NewConfig added in v0.31.1

func NewConfig(lc fx.Lifecycle) (*Type, error)

func (*Type) ReachabilityCheck added in v0.92.0

func (t *Type) ReachabilityCheck(ctx context.Context) error

ReachabilityCheck attempts PostgreSQL and Redis connections with short timeouts to verify that dependencies are reachable. Only call this after Validate() passes, since it assumes required fields are non-empty.

func (*Type) Validate added in v0.92.0

func (t *Type) Validate() error

Validate performs pure field validation on the config struct. It accumulates all errors before returning so the user can fix everything in one pass. This method does not perform any I/O (no network connections).

type ValidationErrors added in v0.92.0

type ValidationErrors []error

ValidationErrors accumulates multiple validation errors for batch reporting.

func (ValidationErrors) Error added in v0.92.0

func (ve ValidationErrors) Error() string

Error joins all errors with newlines so each failure appears on its own line.

type WebhookAuth added in v0.92.0

type WebhookAuth struct {
	Token       string `json:"token" yaml:"token" mapstructure:"token"`
	HMACSecret  string `json:"hmac_secret" yaml:"hmac_secret" mapstructure:"hmac_secret"`
	HMACHeader  string `json:"hmac_header" yaml:"hmac_header" mapstructure:"hmac_header"`
	TokenHeader string `json:"token_header" yaml:"token_header" mapstructure:"token_header"`
}

WebhookAuth holds webhook authentication configuration.

type WebhookPayloadMode added in v0.92.0

type WebhookPayloadMode string

WebhookPayloadMode specifies how incoming webhook payloads are handled.

const (
	WebhookPayloadRaw    WebhookPayloadMode = "raw"
	WebhookPayloadMapped WebhookPayloadMode = "mapped"
)

type WebhookTrigger added in v0.92.0

type WebhookTrigger struct {
	Path      string             `json:"path" yaml:"path" mapstructure:"path"`
	Method    string             `json:"method" yaml:"method" mapstructure:"method"`
	Auth      *WebhookAuth       `json:"auth" yaml:"auth" mapstructure:"auth"`
	Payload   WebhookPayloadMode `json:"payload" yaml:"payload" mapstructure:"payload"`
	EventType string             `json:"event_type" yaml:"event_type" mapstructure:"event_type"`
}

WebhookTrigger configures a webhook-based pipeline trigger.

Jump to

Keyboard shortcuts

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