Documentation
¶
Overview ¶
Package config provides cross-platform configuration path management. It follows platform conventions:
- macOS: ~/Library/Application Support/Aster
- Linux: ~/.config/aster (XDG_CONFIG_HOME)
- Windows: %APPDATA%/Aster
Index ¶
- func CacheDir() string
- func ConfigDir() string
- func ConfigFile() string
- func DataDir() string
- func DatabaseFile() string
- func EnsureAllDirs() error
- func EnsureDir(path string) error
- func ExtensionsDir() string
- func LoadDefault() (*types.AgentConfig, error)
- func LogDir() string
- func MemoriesDir() string
- func MergeConfigs(base *types.AgentConfig, overlays ...*types.AgentConfig) *types.AgentConfig
- func MustLoad(path string) *types.AgentConfig
- func ProjectConfigFile(startDir string) string
- func RecipesDir() string
- func ResolveConfigFile(workDir string) string
- func SessionsDir() string
- type Loader
- type LoaderOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CacheDir ¶
func CacheDir() string
CacheDir returns the cache directory. This is for temporary data that can be safely deleted.
func ConfigDir ¶
func ConfigDir() string
ConfigDir returns the configuration directory. This is where config.yaml, recipes, and extensions are stored.
func ConfigFile ¶
func ConfigFile() string
ConfigFile returns the path to the main configuration file.
func DataDir ¶
func DataDir() string
DataDir returns the data directory. This is where sessions, memories, and persistent data are stored.
func DatabaseFile ¶
func DatabaseFile() string
DatabaseFile returns the path to the SQLite database file.
func ExtensionsDir ¶
func ExtensionsDir() string
ExtensionsDir returns the path to the extensions directory.
func LoadDefault ¶
func LoadDefault() (*types.AgentConfig, error)
LoadDefault 从默认位置加载配置 查找顺序: 1. ./agent.yaml 2. ./config/agent.yaml 3. ~/.aster/agent.yaml
func MemoriesDir ¶
func MemoriesDir() string
MemoriesDir returns the path to the memories directory.
func MergeConfigs ¶
func MergeConfigs(base *types.AgentConfig, overlays ...*types.AgentConfig) *types.AgentConfig
MergeConfigs 合并多个配置(后面的覆盖前面的)
func ProjectConfigFile ¶
ProjectConfigFile returns the path to project-level config file. It searches from the current directory upward for .aster/config.yaml
func ResolveConfigFile ¶
ResolveConfigFile returns the effective config file path. Priority: project config > global config
func SessionsDir ¶
func SessionsDir() string
SessionsDir returns the path to the sessions directory.
Types ¶
type Loader ¶
type Loader struct {
// contains filtered or unexported fields
}
Loader YAML 配置加载器 支持从文件加载配置,并展开环境变量
func (*Loader) LoadAgentConfig ¶
func (l *Loader) LoadAgentConfig(path string) (*types.AgentConfig, error)
LoadAgentConfig 从文件加载 AgentConfig
func (*Loader) LoadFromString ¶
LoadFromString 从字符串加载配置
func (*Loader) LoadModelConfig ¶
func (l *Loader) LoadModelConfig(path string) (*types.ModelConfig, error)
LoadModelConfig 从文件加载 ModelConfig