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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Configuration Reference
|
| 2 |
+
Current `donkey.toml` reference for the SQLite-first runtime.
|
| 3 |
+
|
| 4 |
+
## Overview
|
| 5 |
+
|
| 6 |
+
Donkey reads a single TOML file, usually at `~/.config/donkey/donkey.toml`.
|
| 7 |
+
Secrets and tokens should live in `~/.config/donkey/donkey.env`.
|
| 8 |
+
|
| 9 |
+
Minimal recommended config:
|
| 10 |
+
|
| 11 |
+
```toml
|
| 12 |
+
[donkey]
|
| 13 |
+
home = "~/.donkey"
|
| 14 |
+
paddocks = "~/.donkey/paddocks"
|
| 15 |
+
log_level = "info"
|
| 16 |
+
log_file = "~/.donkey/donkey.log"
|
| 17 |
+
default_provider = "zai-coding"
|
| 18 |
+
default_model = "glm-4.7"
|
| 19 |
+
|
| 20 |
+
[sandbox]
|
| 21 |
+
mode = "oci"
|
| 22 |
+
runtime = "docker"
|
| 23 |
+
image = "alpine"
|
| 24 |
+
allow_host_fallback = false
|
| 25 |
+
allow_network = false
|
| 26 |
+
read_only_rootfs = true
|
| 27 |
+
```
|
| 28 |
+
|
| 29 |
+
## `[donkey]` - Core Settings
|
| 30 |
+
|
| 31 |
+
| Option | Type | Default | Description |
|
| 32 |
+
|--------|------|---------|-------------|
|
| 33 |
+
| `home` | string | `~/.donkey` | Base directory for Donkey state |
|
| 34 |
+
| `paddocks` | string | `~/.donkey/paddocks` | Per-user workspace directory |
|
| 35 |
+
| `log_level` | string | `info` | Logging level: `debug`, `info`, `warn`, `error` |
|
| 36 |
+
| `log_file` | string | empty | Log file path. Empty means stderr only |
|
| 37 |
+
| `default_provider` | string | empty | Instance-wide default provider before per-user preferences exist |
|
| 38 |
+
| `default_model` | string | empty | Instance-wide default model before per-user preferences exist |
|
| 39 |
+
|
| 40 |
+
Example:
|
| 41 |
+
|
| 42 |
+
```toml
|
| 43 |
+
[donkey]
|
| 44 |
+
home = "~/.donkey"
|
| 45 |
+
paddocks = "~/.donkey/paddocks"
|
| 46 |
+
log_level = "info"
|
| 47 |
+
log_file = "~/.donkey/donkey.log"
|
| 48 |
+
default_provider = "zai-coding"
|
| 49 |
+
default_model = "glm-4.7"
|
| 50 |
+
```
|
| 51 |
+
|
| 52 |
+
## `[sandbox]` - Shell Sandbox
|
| 53 |
+
|
| 54 |
+
Shell execution now uses a top-level `[sandbox]` section.
|
| 55 |
+
|
| 56 |
+
| Option | Type | Default | Description |
|
| 57 |
+
|--------|------|---------|-------------|
|
| 58 |
+
| `mode` | string | `oci` | Shell mode: `oci`, `none`, or `wasm` |
|
| 59 |
+
| `runtime` | string | `docker` | OCI runtime command, typically `docker` or `podman` |
|
| 60 |
+
| `image` | string | `alpine` | OCI image for shell execution |
|
| 61 |
+
| `allow_host_fallback` | bool | `false` | Allow fallback to host shell if the configured sandbox fails |
|
| 62 |
+
| `allow_network` | bool | `false` | Allow outbound network access inside the OCI sandbox |
|
| 63 |
+
| `read_only_rootfs` | bool | `true` | Run the OCI sandbox with a read-only root filesystem |
|
| 64 |
+
|
| 65 |
+
Recommended production config:
|
| 66 |
+
|
| 67 |
+
```toml
|
| 68 |
+
[sandbox]
|
| 69 |
+
mode = "oci"
|
| 70 |
+
runtime = "docker"
|
| 71 |
+
image = "alpine"
|
| 72 |
+
allow_host_fallback = false
|
| 73 |
+
allow_network = false
|
| 74 |
+
read_only_rootfs = true
|
| 75 |
+
```
|
| 76 |
+
|
| 77 |
+
Security notes:
|
| 78 |
+
|
| 79 |
+
- `mode = "none"` is rejected in production
|
| 80 |
+
- `allow_host_fallback = true` is dev-only
|
| 81 |
+
- `allow_network = true` is dev-only
|
| 82 |
+
- `read_only_rootfs = false` is dev-only
|
| 83 |
+
- startup validates the policy and aborts on invalid production settings
|
| 84 |
+
|
| 85 |
+
## Storage Model
|
| 86 |
+
|
| 87 |
+
### SQLite-first default
|
| 88 |
+
|
| 89 |
+
The normal build is SQLite-first. In that mode:
|
| 90 |
+
|
| 91 |
+
- MAGMA uses SQLite by default
|
| 92 |
+
- SQLite base and `sqlite-vec` are embedded in the binary
|
| 93 |
+
- the default database path is `~/.donkey/state/magma.sqlite`
|
| 94 |
+
|
| 95 |
+
You can override the path with `DONKEY_MAGMA_SQLITE_PATH`.
|
| 96 |
+
|
| 97 |
+
### PostgreSQL-backed MAGMA
|
| 98 |
+
|
| 99 |
+
If `DONKEY_PG_DSN` is set, Donkey can use PostgreSQL-backed MAGMA instead.
|
| 100 |
+
Keep this disabled unless you explicitly want the PostgreSQL runtime.
|
| 101 |
+
|
| 102 |
+
## Environment Variables
|
| 103 |
+
|
| 104 |
+
| Variable | Description |
|
| 105 |
+
|----------|-------------|
|
| 106 |
+
| `DONKEY_CONFIG` | Override config file path |
|
| 107 |
+
| `DONKEY_HOME` | Override `donkey.home` |
|
| 108 |
+
| `DONKEY_LOG_LEVEL` | Override `donkey.log_level` |
|
| 109 |
+
| `DONKEY_MAGMA_SQLITE_PATH` | Override SQLite MAGMA path |
|
| 110 |
+
| `DONKEY_PG_DSN` | Enable PostgreSQL-backed MAGMA runtime |
|
| 111 |
+
| `DONKEY_HTTP_PORT` | HTTP gateway port. Set to `0` to disable it |
|
| 112 |
+
| `DONKEY_DM_POLICY` | DM authorization: `open`, `pairing` or `allowlist` (default `open`) |
|
| 113 |
+
| `DONKEY_TELEGRAM_ALLOWED_GROUPS` | Comma-separated Telegram chat ids allowed to use the bot; empty allows every group |
|
| 114 |
+
| `DONKEY_STT_API_KEY` | Speech-to-text key; falls back to `OPENAI_API_KEY` |
|
| 115 |
+
| `DONKEY_STT_URL` | Transcription endpoint (default: OpenAI `/v1/audio/transcriptions`) |
|
| 116 |
+
| `DONKEY_STT_MODEL` | Transcription model (default: `whisper-1`) |
|
| 117 |
+
| `DONKEY_TTS_API_KEY` | Text-to-speech key; falls back to `OPENAI_API_KEY` |
|
| 118 |
+
| `DONKEY_TTS_URL` | Speech endpoint (default: OpenAI `/v1/audio/speech`) |
|
| 119 |
+
| `DONKEY_TTS_MODEL` | Speech model (default: `tts-1`) |
|
| 120 |
+
| `DONKEY_TTS_VOICE` | Default voice (default: `alloy`) |
|
| 121 |
+
| `DONKEY_ATTACHMENT_RETENTION_DAYS` | Remove files in each paddock's `attachments/` older than this many days, checked hourly. Unset or `0` keeps everything |
|
| 122 |
+
| `TELEGRAM_BOT_TOKEN` | Telegram channel token |
|
| 123 |
+
| `DISCORD_BOT_TOKEN` | Discord channel token |
|
| 124 |
+
| `DONKEY_DISCORD_ALLOWED_CHANNELS` | Comma-separated Discord server or channel ids the bot serves (`*` = all). Other servers are ignored before any identity is created. DMs follow the DM policy. Empty serves every server |
|
| 125 |
+
| `DONKEY_DISCORD_REQUIRE_MENTION` | `1`/`true`/`yes`/`on`: in a server, answer only messages that mention the bot or reply to it. DMs are unaffected. Off by default |
|
| 126 |
+
| `ZAI_API_KEY` | ZAI generic provider key |
|
| 127 |
+
| `ZAI_CODING_API_KEY` | ZAI Coding provider key |
|
| 128 |
+
| `ZAI_ANTHROPIC_API_KEY` | ZAI Anthropic provider key |
|
| 129 |
+
| `OPENROUTER_API_KEY` | OpenRouter provider key |
|
| 130 |
+
| `OPENAI_API_KEY` | OpenAI provider key |
|
| 131 |
+
| `DEEPSEEK_API_KEY` | DeepSeek provider key |
|
| 132 |
+
| `ANTHROPIC_API_KEY` | Anthropic provider key |
|
| 133 |
+
| `GEMINI_API_KEY` | Gemini provider key |
|
| 134 |
+
| `MINIMAX_API_KEY` | MiniMax provider key |
|
| 135 |
+
| `BRAVE_API_KEY` | Enables `web_search` via Brave Search |
|
| 136 |
+
|
| 137 |
+
Example:
|
| 138 |
+
|
| 139 |
+
```bash
|
| 140 |
+
export DONKEY_CONFIG="$HOME/.config/donkey/donkey.toml"
|
| 141 |
+
export DONKEY_HTTP_PORT=0
|
| 142 |
+
export TELEGRAM_BOT_TOKEN=...
|
| 143 |
+
export ZAI_CODING_API_KEY=...
|
| 144 |
+
```
|
| 145 |
+
|
| 146 |
+
## OpenAI-Compatible API
|
| 147 |
+
|
| 148 |
+
When the HTTP gateway is enabled, it exposes two OpenAI-shaped endpoints on the
|
| 149 |
+
same port and Bearer auth:
|
| 150 |
+
|
| 151 |
+
| Endpoint | Method | Behavior |
|
| 152 |
+
|---|---|---|
|
| 153 |
+
| `/v1/models` | GET | Lists the configured model as `owned_by: donkey` |
|
| 154 |
+
| `/v1/chat/completions` | POST | Runs a real agent turn (tools, memory, session) and returns a `chat.completion`; `stream: true` returns SSE chunks |
|
| 155 |
+
| `/api/sessions`, `/api/providers` | GET | Dashboard read endpoints (Bearer): session detail and provider health |
|
| 156 |
+
| `/api/sessions/{userId}/task` | POST | Dashboard action: `{"action":"new"}` starts a fresh task for an existing session |
|
| 157 |
+
| `/dashboard` | GET | Public HTML shell for the status/logs page; the page asks for the Bearer token and keeps it in `sessionStorage` |
|
| 158 |
+
|
| 159 |
+
```bash
|
| 160 |
+
curl -s http://127.0.0.1:8080/v1/chat/completions \
|
| 161 |
+
-H "Authorization: Bearer $DONKEY_HTTP_TOKEN" \
|
| 162 |
+
-H "Content-Type: application/json" \
|
| 163 |
+
-d '{"model":"donkey/default","messages":[{"role":"user","content":"oi"}]}'
|
| 164 |
+
```
|
| 165 |
+
|
| 166 |
+
This is the agent loop, not a provider proxy: the same tools, memory and
|
| 167 |
+
session a channel turn uses. `user` is the identity and must be present; the
|
| 168 |
+
`api:` namespace is applied automatically, and programmatic users never enter
|
| 169 |
+
channel onboarding. `model` is advisory and the instance routing decides the
|
| 170 |
+
provider. `stream: false` returns one `chat.completion`; `stream: true` returns
|
| 171 |
+
`text/event-stream` with `chat.completion.chunk` frames and `data: [DONE]`.
|
| 172 |
+
|
| 173 |
+
Errors follow the OpenAI shape: `400` parse/unsupported, `401` missing token,
|
| 174 |
+
`403` revoked or not allowed (before dispatch), `413` body over the cap, `429`
|
| 175 |
+
one turn per user or capacity, `502` redacted provider error, `503` wiring
|
| 176 |
+
missing, `504` turn deadline (`DONKEY_HTTP_AGENT_TIMEOUT_SEC`, default 120 s,
|
| 177 |
+
cap 600 s).
|
| 178 |
+
|
| 179 |
+
`GET /api/sessions` takes `limit` (default 50, max 200) and `offset`; invalid
|
| 180 |
+
values are clamped, never a 500. Without `DONKEY_HTTP_TOKEN`, every `/api/*`
|
| 181 |
+
route answers `401` (even on loopback); only `/`, `/health` and the
|
| 182 |
+
`/dashboard` shell stay open, and the `/v1/*` routes keep their local-only
|
| 183 |
+
behavior.
|
| 184 |
+
|
| 185 |
+
## Happy Path
|
| 186 |
+
|
| 187 |
+
`~/.config/donkey/donkey.toml`:
|
| 188 |
+
|
| 189 |
+
```toml
|
| 190 |
+
[donkey]
|
| 191 |
+
home = "~/.donkey"
|
| 192 |
+
paddocks = "~/.donkey/paddocks"
|
| 193 |
+
log_level = "info"
|
| 194 |
+
log_file = "~/.donkey/donkey.log"
|
| 195 |
+
default_provider = "zai-coding"
|
| 196 |
+
default_model = "glm-4.7"
|
| 197 |
+
|
| 198 |
+
[sandbox]
|
| 199 |
+
mode = "oci"
|
| 200 |
+
runtime = "docker"
|
| 201 |
+
image = "alpine"
|
| 202 |
+
allow_host_fallback = false
|
| 203 |
+
allow_network = false
|
| 204 |
+
read_only_rootfs = true
|
| 205 |
+
```
|
| 206 |
+
|
| 207 |
+
`~/.config/donkey/donkey.env`:
|
| 208 |
+
|
| 209 |
+
```bash
|
| 210 |
+
TELEGRAM_BOT_TOKEN=...
|
| 211 |
+
ZAI_CODING_API_KEY=...
|
| 212 |
+
BRAVE_API_KEY=... # optional
|
| 213 |
+
```
|
| 214 |
+
|
| 215 |
+
Validation and startup:
|
| 216 |
+
|
| 217 |
+
```bash
|
| 218 |
+
./donkey doctor --config ~/.config/donkey/donkey.toml
|
| 219 |
+
./donkey start --config ~/.config/donkey/donkey.toml
|
| 220 |
+
```
|
| 221 |
+
|
| 222 |
+
## Related Docs
|
| 223 |
+
|
| 224 |
+
- [Quickstart](../quickstart.md)
|
| 225 |
+
- [Installation](../getting_started/installation.md)
|
| 226 |
+
- [Architecture](../ARCHITECTURE.md)
|