fix(config): treat a [[curators]] entry without enabled as on

This commit is contained in:
sam committed 2026-10-17 17:15:34 +11:00
1 parent 2e7158a760
commit a2ade2ee42
3 files changed
+16 -3

No files matched your search

+1 -1
View File
@@ -40,7 +40,7 @@ func curatorDefinition() Definition {
}
func CuratorDefinition(def config.CuratorDefinition) curator.Definition {
return curator.Definition{Name: def.Name, Enabled: def.Enabled, Instructions: def.Instructions, Manifest: curator.Manifest{
return curator.Definition{Name: def.Name, Enabled: def.Enabled == nil || *def.Enabled, Instructions: def.Instructions, Manifest: curator.Manifest{
Interval: def.Interval.Std(), Cooldown: def.Cooldown.Std(), OnInput: def.OnInput, Tools: def.Tools, Skills: def.Skills, MemoryEngine: def.MemoryEngine, Conversations: def.Conversations, Model: def.Model,
}}
}
+3 -2
View File
@@ -1,9 +1,10 @@
package config
// CuratorDefinition is one [[curators]] entry. Interval is required.
// CuratorDefinition is one [[curators]] entry. Interval is required. An entry
// that omits enabled is on: writing one down is the intent to run it.
type CuratorDefinition struct {
Name string `toml:"name" yaml:"name" json:"name"`
Enabled bool `toml:"enabled" yaml:"enabled" json:"enabled"`
Enabled *bool `toml:"enabled" yaml:"enabled" json:"enabled"`
Instructions string `toml:"instructions" yaml:"instructions" json:"instructions"`
Interval Duration `toml:"interval" yaml:"interval" json:"interval"`
@@ -68,6 +68,18 @@ func (l *Loader) applyDefaults(cfg *config.Config) {
applyCaptureDefaults(cfg)
applyNATSDefaults(cfg)
applyMemoryDefaults(cfg)
applyCuratorDefaults(cfg)
}
// applyCuratorDefaults resolves an omitted enabled key to on, so the seeded
// resource and the dashboard show the state the runtime applies.
func applyCuratorDefaults(cfg *config.Config) {
for i := range cfg.Curators {
if cfg.Curators[i].Enabled == nil {
on := true
cfg.Curators[i].Enabled = &on
}
}
}
// applyServiceDefaults fills each registered service's absent addresses from