Documentation
¶
Overview ¶
Package config loads and validates application configuration.
Index ¶
- func Load(path string) mo.Result[*Config]
- type AppConfig
- type AssistantConfig
- type CacheConfig
- type Config
- type ContextConfig
- type DatabaseConfig
- type ExtensionUse
- type ExtensionsConfig
- type LoadedConfig
- type LoaderUI
- type LoggingConfig
- type ModelDiscoveryConfig
- type ModelsConfig
- type RetryConfig
- type TaskRuntimeConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AppConfig ¶
type AppConfig struct {
Name string `json:"name" mapstructure:"name" yaml:"name"`
Env string `json:"env" mapstructure:"env" yaml:"env"`
WorkingLoader LoaderUI `json:"working_loader" mapstructure:"working_loader" yaml:"working_loader"`
}
AppConfig contains application identity and environment settings.
type AssistantConfig ¶
type AssistantConfig struct {
Provider string `json:"provider" mapstructure:"provider" yaml:"provider"`
Model string `json:"model" mapstructure:"model" yaml:"model"`
ThinkingLevel string `json:"thinking_level" mapstructure:"thinking_level" yaml:"thinking_level"`
Retry RetryConfig `json:"retry" mapstructure:"retry" yaml:"retry"`
}
AssistantConfig controls the assistant runtime defaults.
type CacheConfig ¶
type CacheConfig struct {
Enabled bool `json:"enabled" mapstructure:"enabled" yaml:"enabled"`
Capacity int `json:"capacity" mapstructure:"capacity" yaml:"capacity"`
TTL time.Duration `json:"ttl" mapstructure:"ttl" yaml:"ttl"`
}
CacheConfig controls assistant response caching.
type Config ¶
type Config struct {
App AppConfig `json:"app" mapstructure:"app" yaml:"app"`
Logging LoggingConfig `json:"logging" mapstructure:"logging" yaml:"logging"`
Extensions ExtensionsConfig `json:"extensions" mapstructure:"extensions" yaml:"extensions"`
Models ModelsConfig `json:"models" mapstructure:"models" yaml:"models"`
Assistant AssistantConfig `json:"assistant" mapstructure:"assistant" yaml:"assistant"`
Database DatabaseConfig `json:"database" mapstructure:"database" yaml:"database"`
Context ContextConfig `json:"context" mapstructure:"context" yaml:"context"`
Cache CacheConfig `json:"cache" mapstructure:"cache" yaml:"cache"`
Tasks TaskRuntimeConfig `json:"tasks" mapstructure:"tasks" yaml:"tasks"`
}
Config is the fully resolved application configuration.
type ContextConfig ¶
type ContextConfig struct {
CompactionProvider string `json:"compaction_provider" yaml:"compaction_provider"`
CompactionModel string `json:"compaction_model" yaml:"compaction_model"`
OutputReserveTokens int `json:"output_reserve_tokens" yaml:"output_reserve_tokens"`
ProviderReserveTokens int `json:"provider_reserve_tokens" yaml:"provider_reserve_tokens"`
SafetyMarginTokens int `json:"safety_margin_tokens" yaml:"safety_margin_tokens"`
ExtensionContributionTokens int `json:"extension_contribution_tokens" yaml:"extension_contribution_tokens"`
AutoCompactionThreshold int `json:"auto_compaction_threshold" yaml:"auto_compaction_threshold"`
RetainedTailMaxTokens int `json:"retained_tail_max_tokens" yaml:"retained_tail_max_tokens"`
SummaryOutputTokens int `json:"summary_output_tokens" yaml:"summary_output_tokens"`
PreflightEnabled bool `json:"preflight_enabled" yaml:"preflight_enabled"`
AutoCompactionEnabled bool `json:"auto_compaction_enabled" yaml:"auto_compaction_enabled"`
}
ContextConfig controls local context-window budgeting before provider requests.
type DatabaseConfig ¶
type DatabaseConfig struct {
Path string `json:"path" mapstructure:"path" yaml:"path"`
ApplyMigrations bool `json:"apply_migrations" mapstructure:"apply_migrations" yaml:"apply_migrations"`
MaxOpenConns int `json:"max_open_conns" mapstructure:"max_open_conns" yaml:"max_open_conns"`
MaxIdleConns int `json:"max_idle_conns" mapstructure:"max_idle_conns" yaml:"max_idle_conns"`
ConnMaxLifetime time.Duration `json:"conn_max_lifetime" mapstructure:"conn_max_lifetime" yaml:"conn_max_lifetime"`
BusyTimeout time.Duration `json:"busy_timeout" mapstructure:"busy_timeout" yaml:"busy_timeout"`
}
DatabaseConfig contains session database persistence settings.
type ExtensionUse ¶
type ExtensionUse = extension.ConfiguredSource
ExtensionUse declares one extension source.
type ExtensionsConfig ¶
type ExtensionsConfig struct {
Use []ExtensionUse `json:"use" mapstructure:"use" yaml:"use"`
Enabled bool `json:"enabled" mapstructure:"enabled" yaml:"enabled"`
}
ExtensionsConfig controls workflow extension discovery and execution.
type LoadedConfig ¶
LoadedConfig contains the resolved config and the file path it came from, if any.
func LoadResolved ¶
func LoadResolved(path string) (LoadedConfig, error)
LoadResolved resolves configuration and reports the file path used, if any.
type LoaderUI ¶
type LoaderUI struct {
Text string `json:"text" mapstructure:"text" yaml:"text"`
}
LoaderUI controls text shown while an assistant response is in progress.
type LoggingConfig ¶
type LoggingConfig struct {
Level string `json:"level" mapstructure:"level" yaml:"level"`
Format string `json:"format" mapstructure:"format" yaml:"format"`
}
LoggingConfig contains runtime logging settings.
type ModelDiscoveryConfig ¶
type ModelDiscoveryConfig struct {
SourceURL string `json:"source_url" mapstructure:"source_url" yaml:"source_url"`
CacheTTL time.Duration `json:"cache_ttl" mapstructure:"cache_ttl" yaml:"cache_ttl"`
FetchTimeout time.Duration `json:"fetch_timeout" mapstructure:"fetch_timeout" yaml:"fetch_timeout"`
Enabled bool `json:"enabled" mapstructure:"enabled" yaml:"enabled"`
}
ModelDiscoveryConfig controls remote model catalog discovery.
type ModelsConfig ¶
type ModelsConfig struct {
Discovery ModelDiscoveryConfig `json:"discovery" mapstructure:"discovery" yaml:"discovery"`
}
ModelsConfig controls model catalog discovery.
type RetryConfig ¶
type RetryConfig struct {
BaseDelay time.Duration `json:"base_delay" mapstructure:"base_delay" yaml:"base_delay"`
MaxDelay time.Duration `json:"max_delay" mapstructure:"max_delay" yaml:"max_delay"`
MaxAttempts int `json:"max_attempts" mapstructure:"max_attempts" yaml:"max_attempts"`
Enabled bool `json:"enabled" mapstructure:"enabled" yaml:"enabled"`
}
RetryConfig controls transient model request retries.
func (RetryConfig) Normalized ¶
func (retry RetryConfig) Normalized() RetryConfig
Normalized returns retry settings with safe defaults for omitted values.
type TaskRuntimeConfig ¶
type TaskRuntimeConfig struct {
Workers int `json:"workers" mapstructure:"workers" yaml:"workers"`
SessionWorkers int `json:"session_workers" mapstructure:"session_workers" yaml:"session_workers"`
PollInterval time.Duration `json:"poll_interval" mapstructure:"poll_interval" yaml:"poll_interval"`
LeaseDuration time.Duration `json:"lease_duration" mapstructure:"lease_duration" yaml:"lease_duration"`
Heartbeat time.Duration `json:"heartbeat_interval" mapstructure:"heartbeat_interval" yaml:"heartbeat_interval"`
RecoveryInterval time.Duration `json:"recovery_interval" mapstructure:"recovery_interval" yaml:"recovery_interval"`
DefaultTimeout time.Duration `json:"default_timeout" mapstructure:"default_timeout" yaml:"default_timeout"`
MaxTimeout time.Duration `json:"max_timeout" mapstructure:"max_timeout" yaml:"max_timeout"`
MaxOutcomeBytes int `json:"max_outcome_bytes" mapstructure:"max_outcome_bytes" yaml:"max_outcome_bytes"`
}
TaskRuntimeConfig controls bounded durable background execution.