@alfe.ai/config
v0.4.1
Published
Read and write `~/.alfe/config.toml` for Alfe CLI, gateway, runtimes, and published plugins.
Readme
@alfe.ai/config
Read and write ~/.alfe/config.toml for Alfe CLI, gateway, runtimes, and
published plugins.
What It Does
Shared config management for the Alfe user-side tools (CLI, gateway daemon, plugins). Reads and writes the user's local config file at ~/.alfe/config.toml.
readConfig()— read and parse~/.alfe/config.tomlwriteConfig(config)— write config to~/.alfe/config.tomlconfigExists()— check if config file existsresolveConfig()— resolve environment overrides, file values, runtime, workspace, API origin, and voice HTTP origingetEndpointFromToken(token)— derive API endpoint from token prefix (alfe_dev_,alfe_test_,alfe_live_)mergeAndWriteConfig(partial)— atomically update owned top-level fields without deleting runtime tableswriteRuntimeConfig(name, config)— atomically update one runtime table
Config Format
# ~/.alfe/config.toml
api_key = "alfe_live_xxxx..."
gateway = "https://api.alfe.ai" # optional override
gateway_url = "wss://gateway.alfe.ai/ws" # optional daemon relay override
runtime = "openclaw"
[runtimes.openclaw]
workspace = "/home/alfe/.openclaw"Resolution precedence is ALFE_API_KEY / ALFE_API_URL, then the config file,
then token-prefix endpoint derivation. Plaintext HTTP/WS overrides are accepted
only for loopback development. The credential file is atomically replaced with
mode 0600 inside an owner-only ~/.alfe directory; concurrent writers are
serialized across processes.
writeConfig() intentionally replaces the complete document. Commands that
own only a subset must use mergeAndWriteConfig().
Development
pnpm install
pnpm --filter @alfe.ai/config lint
pnpm --filter @alfe.ai/config typecheck
pnpm --filter @alfe.ai/config test
pnpm --filter @alfe.ai/config buildDependencies
- smol-toml — TOML parsing and serialization
Links
- 🌐 Website: https://alfe.ai
- 📚 Docs: https://docs.alfe.ai
