rony-llm-agent/pkg/config/README.es.md

84 lines
No EOL
1.7 KiB
Markdown

# pkg/config
> 🌐 **Idioma:** [English](README.md) | [Español](README.es.md)
> Carga de configuración YAML con precedencia jerárquica.
## Responsabilidad
Resolver la configuración final del agente combinando múltiples fuentes con orden de precedencia:
1. **Flags CLI** (highest)
2. **Environment variables**
3. **Project config** (`./.rony.yaml`)
4. **Global config** (`~/.config/rony/config.yaml`)
5. **Defaults embebidos** (lowest)
## API pública
```go
type Config struct {
Model string
Persona string
Provider ProviderConfig
Tools ToolPolicy
Logging LoggingConfig
Sandbox SandboxConfig
}
type Loader interface {
Load(ctx context.Context, workdir string) (Config, error)
LoadFromBytes(data []byte, source string) (Config, error)
}
type ProviderConfig struct {
Type string // "openai" | "anthropic" | "ollama" | "llamacpp"
Model string
APIKey string // resuelto de env si es referencia
Endpoint string
}
type ToolPolicy map[string]tools.Permission
```
## Formato YAML
```yaml
# ~/.config/rony/config.yaml
model: claude-sonnet-4.5
persona: pragmatista
provider:
type: anthropic
api_key_env: ANTHROPIC_API_KEY
tools:
bash: ask
read: allow
write: ask
logging:
level: info
format: json
sandbox:
workspace: .
timeout_ms: 30000
```
## Override por env
```bash
RONY_MODEL=gpt-4o rony chat # override model
RONY_LOG_LEVEL=debug rony chat # override log level
```
## Precedencia
El loader resuelve en este orden (mayor prioridad primero):
```
flag > RONY_* env > ./.rony.yaml > ~/.config/rony/config.yaml > defaults
```
## Ver también
- [pkg/agent](../agent/README.md) — Usa Config
- [pkg/llm](../llm/README.md) — ProviderConfig se mapea a LLMClient