mirror of
https://github.com/hanzoai/agent.git
synced 2026-09-11 21:08:51 +00:00
Consolidate all Hanzo agent infrastructure into one repo: - control-plane/: Go control plane server (was agents-new) - sdk/: Go, Python, TypeScript SDKs - deployments/: Docker, Kubernetes, Helm configs - Dockerfile.sdk: Python SDK image (ghcr.io/hanzoai/agent:latest) - CI builds both SDK + control-plane images No more agentfield — everything is hanzoai/agent.
57 lines
1.3 KiB
Go
57 lines
1.3 KiB
Go
// hanzo-agents/internal/infrastructure/storage/config.go
|
|
package storage
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
|
|
"github.com/hanzoai/agents/control-plane/internal/core/domain"
|
|
"github.com/hanzoai/agents/control-plane/internal/core/interfaces"
|
|
"gopkg.in/yaml.v3"
|
|
)
|
|
|
|
type LocalConfigStorage struct {
|
|
fs interfaces.FileSystemAdapter
|
|
}
|
|
|
|
func NewLocalConfigStorage(fs interfaces.FileSystemAdapter) interfaces.ConfigStorage {
|
|
return &LocalConfigStorage{fs: fs}
|
|
}
|
|
|
|
func (s *LocalConfigStorage) LoadHanzoAgentsConfig(path string) (*domain.HanzoAgentsConfig, error) {
|
|
if !s.fs.Exists(path) {
|
|
return &domain.HanzoAgentsConfig{
|
|
HomeDir: filepath.Dir(path),
|
|
Environment: make(map[string]string),
|
|
MCP: domain.MCPConfig{
|
|
Servers: []domain.MCPServer{},
|
|
},
|
|
}, nil
|
|
}
|
|
|
|
data, err := s.fs.ReadFile(path)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
var config domain.HanzoAgentsConfig
|
|
if err := yaml.Unmarshal(data, &config); err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return &config, nil
|
|
}
|
|
|
|
func (s *LocalConfigStorage) SaveHanzoAgentsConfig(path string, config *domain.HanzoAgentsConfig) error {
|
|
data, err := yaml.Marshal(config)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
if err := os.MkdirAll(filepath.Dir(path), 0755); err != nil {
|
|
return err
|
|
}
|
|
|
|
return s.fs.WriteFile(path, data)
|
|
}
|