@@ -9,7 +9,10 @@ import (
99 "gopkg.in/yaml.v3"
1010)
1111
12- const configFileName = "system_plugins_soc_ai.yaml"
12+ const (
13+ configFileName = "system_plugins_soc_ai.yaml"
14+ pluginKey = "soc-ai"
15+ )
1316
1417type FileConfig struct {
1518 Provider string `yaml:"provider"`
@@ -25,6 +28,13 @@ type FileConfig struct {
2528 Capabilities []string `yaml:"capabilities,omitempty"`
2629}
2730
31+ // pluginsFile is the on-disk wrapper shared with the other system_plugins_*.yaml
32+ // files: plugins.<key>.* — keeps soc-ai's config file the same namespaced shape
33+ // as the datasource plugins instead of being the one bare/flat outlier.
34+ type pluginsFile struct {
35+ Plugins map [string ]FileConfig `yaml:"plugins"`
36+ }
37+
2838type ConfigStore struct {
2939 dir string
3040 mu sync.Mutex
@@ -49,10 +59,14 @@ func (s *ConfigStore) Load() (*FileConfig, error) {
4959 if err != nil {
5060 return nil , err
5161 }
52- var fc FileConfig
53- if err := yaml .Unmarshal (data , & fc ); err != nil {
62+ var pf pluginsFile
63+ if err := yaml .Unmarshal (data , & pf ); err != nil {
5464 return nil , err
5565 }
66+ fc , ok := pf .Plugins [pluginKey ]
67+ if ! ok {
68+ return nil , nil
69+ }
5670 return & fc , nil
5771}
5872
@@ -63,7 +77,8 @@ func (s *ConfigStore) Save(fc *FileConfig) error {
6377 if err := os .MkdirAll (s .dir , 0o755 ); err != nil {
6478 return err
6579 }
66- data , err := yaml .Marshal (fc )
80+ pf := pluginsFile {Plugins : map [string ]FileConfig {pluginKey : * fc }}
81+ data , err := yaml .Marshal (pf )
6782 if err != nil {
6883 return err
6984 }
0 commit comments