Documentation
¶
Overview ¶
Package config loads and validates the agentdex user configuration (config.cue), resolves the XDG paths it lives under, resolves the per-cache TTLs, and maps the configuration together with the global flags into the agentdex library options and the modelsdev client options. It is the one place where config.cue and flags are read; the library and the modelsdev client stay configuration-agnostic and option-driven.
Index ¶
Constants ¶
const DefaultTTL = 24 * time.Hour
DefaultTTL is the built-in cache TTL applied when neither a section ttl nor cache_ttl is configured. It mirrors the library defaults so the resolved value is explicit at the call site rather than left implicit in two packages.
Variables ¶
var ErrConfig = errors.New("invalid configuration")
ErrConfig marks a configuration fault: a malformed config.cue, a value that violates the schema, or an unparseable duration.
Functions ¶
Types ¶
type Config ¶
type Config struct {
CatalogModule string
CatalogDir string
CatalogTTL time.Duration
ModelsURL string
ModelsTTL time.Duration
SearchDirs []string
BinPaths map[string]string
Color string
}
Config is the resolved, typed configuration: defaults applied, durations parsed into the per-cache TTLs. Decoupled from config.cue's wire shape so callers never re-parse strings.
func Load ¶
Load reads, validates, and resolves config.cue at path. A missing file is a clean empty configuration: schema defaults still materialise. A syntax error, schema violation, or unparseable duration is an ErrConfig.
func (*Config) Options ¶
Options builds the agentdex.Open options from the resolved configuration and the global flags. When catalog.dir is set it is the sole catalog source (module omitted); otherwise catalog.module is used — the two are mutually exclusive in the library. Force-refresh is owned by Index.Refresh.