pub struct Config {Show 23 fields
pub config_version: u32,
pub provider: ProviderConfig,
pub agent: AgentConfig,
pub tools: ToolsConfig,
pub sessions: SessionsConfig,
pub attachments: AttachmentsConfig,
pub plugins: PluginsConfig,
pub web: WebConfig,
pub gateway: GatewayConfig,
pub cli: CliConfig,
pub update: UpdateConfig,
pub hooks: HooksConfig,
pub context: ContextPolicyConfig,
pub user: UserConfig,
pub skills: SkillsConfig,
pub vision: VisionConfig,
pub profile: Option<String>,
pub route_pin: Option<String>,
pub dotenv: Dotenv,
pub mcp: Vec<Spec>,
pub no_mcp: bool,
pub flares: FlaresConfig,
pub bots: BTreeMap<String, BotConfig>,
}Fields§
§config_version: u32The config_version the file was written with, and the one thing here that is metadata
rather than a setting: it is not in the catalogue, config set refuses it, and the agent
never reads it. 0 means “written before the stamp existed” and is the version every
install older than this key reports.
Top-level because it describes the file, and it must survive a section rename.
provider: ProviderConfig§agent: AgentConfig§tools: ToolsConfig§sessions: SessionsConfig§attachments: AttachmentsConfig§plugins: PluginsConfig§web: WebConfig§gateway: GatewayConfig§cli: CliConfig§update: UpdateConfig§hooks: HooksConfig§context: ContextPolicyConfig§user: UserConfig§skills: SkillsConfig§vision: VisionConfig§profile: Option<String>Which profile this was loaded as. Not part of the file: it comes from --profile /
ECLIPSE_PROFILE, and only decides which overlay and which directories apply.
route_pin: Option<String>The route a run is pinned to (--route, else ECLIPSE_ROUTE). Not part of the file:
pinning is a decision about one invocation. Set through Config::pin_route.
dotenv: DotenvWhich .env files were read and what they held. Not part of the file, and never
serialised: values are exactly what must not be printed.
mcp: Vec<Spec>[[mcp]]: MCP servers declared in config.toml (#352). The same spec a plugin manifest
carries — one loader, two providers — and the one a name clash with a manifest wins, because
this file is somebody’s decision about this machine while a manifest is what a plugin
shipped. Tools they list are reported as config:mcp:<server>.
no_mcp: bool--no-mcp: start no MCP server for this process. Not part of the file — it is a decision
about one invocation, and it exists because a server that hangs at startup must not be
able to lock someone out of their own agent.
flares: FlaresConfig[flares]: the budget and cap defaults a flare run starts from (#171).
bots: BTreeMap<String, BotConfig>[bots.<name>]: named agent identities (#509). A bot is a declaration plus one session
whose origin is bot:<name> — no second runtime and no second store. The gateway reads
this table at startup, keeps an agent per bot, and the Bots tab lists what it found.
Implementations§
Source§impl Config
impl Config
Sourcepub fn unknown_keys(&self, value: &Value) -> Vec<UnknownKey>
pub fn unknown_keys(&self, value: &Value) -> Vec<UnknownKey>
Every key in value this build does not read, table by table as the parser hands them
over (sorted, not in the order the file wrote them — toml::Table is a map).
value is one file as written — the base config, or a profile’s overlay. self supplies the
shape, so pass the config that was actually loaded: a file that sets model is only known
to be right because the struct has the field.
Source§impl Config
impl Config
Source§impl Config
impl Config
Sourcepub fn load(explicit: Option<&Path>) -> Result<Config>
pub fn load(explicit: Option<&Path>) -> Result<Config>
Load from explicit (must exist) or the default path (optional), then apply
environment overrides, using the real process environment.
pub fn load_with(explicit: Option<&Path>, env: EnvFn<'_>) -> Result<Config>
Sourcepub fn load_with_profile(
explicit: Option<&Path>,
profile: Option<&str>,
env: EnvFn<'_>,
) -> Result<Config>
pub fn load_with_profile( explicit: Option<&Path>, profile: Option<&str>, env: EnvFn<'_>, ) -> Result<Config>
Load the base config, then the profile’s overlay (profiles/<name>/config.toml, if it
exists) on top of it, then environment overrides. Keys the overlay does not mention
keep the base value; a key it does mention replaces it (tables are merged, so a
profile can change one provider field without restating the rest).
The profile also comes from ECLIPSE_PROFILE; an explicit argument wins. The name
default is the default profile: it may still have an overlay and its own plugins,
but its state lives in the plain state directory.
Sourcepub fn profile_name(&self) -> &str
pub fn profile_name(&self) -> &str
The profile name in effect, default when none was selected.
Sourcepub fn state_dir(&self, env: EnvFn<'_>) -> Result<PathBuf>
pub fn state_dir(&self, env: EnvFn<'_>) -> Result<PathBuf>
This profile’s state directory (sessions, REPL history).
Sourcepub fn plugins_dirs(&self, env: EnvFn<'_>) -> Vec<PathBuf>
pub fn plugins_dirs(&self, env: EnvFn<'_>) -> Vec<PathBuf>
Where plugins are looked for, in order: this profile’s own plugins/ directory
first, then the shared one ([plugins] dir, else <config_dir>/plugins). A profile
copy of a plugin shadows the shared copy.
pub fn from_file(path: &Path) -> Result<Config>
pub fn from_toml_str(text: &str) -> Result<Config, String>
Sourcepub fn apply_env(&mut self, env: EnvFn<'_>)
pub fn apply_env(&mut self, env: EnvFn<'_>)
ECLIPSE_BASE_URL, ECLIPSE_API_KEY, ECLIPSE_MODEL.
These describe [provider], the default route, and nothing else: one variable cannot
sensibly be the key for every route in a chain. A named route takes its key from its
own api_key_env.
Sourcepub fn to_toml_redacted(&self) -> Result<String>
pub fn to_toml_redacted(&self) -> Result<String>
Serialise to TOML with every secret-looking value replaced, safe to print.
Redaction follows the key name rather than a list of known fields, so a new setting
called api_token is covered the day it is added instead of the day someone
remembers to add it here.
Sourcepub fn require_provider(&self) -> Result<()>
pub fn require_provider(&self) -> Result<()>
Fail early, with an actionable message, if the provider is not configured.
Sourcepub fn declared_routes(&self) -> Vec<NamedRoute>
pub fn declared_routes(&self) -> Vec<NamedRoute>
The routes the file declares, default first when [provider] is in use.
With no routes at all default is always listed, so a bare config still has one
route and says what is wrong with it rather than that it has none.
Sourcepub fn route_names(&self) -> String
pub fn route_names(&self) -> String
The routes that exist, for a sentence that has to name them.
Sourcepub fn validate_routes(&self) -> Result<()>
pub fn validate_routes(&self) -> Result<()>
Check the route table: every rule is something a run would otherwise find out halfway through, and each message names the route or the key at fault.
[provider] itself is not checked here — whether base_url and model are set is
asked when a run needs it (Config::chain), which is why config show and
config init work on a half-written file.
Sourcepub fn pin_route(&mut self, flag: Option<&str>, env: EnvFn<'_>) -> Result<()>
pub fn pin_route(&mut self, flag: Option<&str>, env: EnvFn<'_>) -> Result<()>
Pin this configuration to a route, or leave it unpinned.
flag is --route; without it ECLIPSE_ROUTE is read from the environment and then
from the .env chain, the same layering every other ECLIPSE_* setting has. An unknown
name is an error that lists the routes that exist, here rather than after a run starts.
Sourcepub fn chain(&self) -> Result<Chain>
pub fn chain(&self) -> Result<Chain>
The routes a run will use, in order, checked.
A pinned run gets exactly one route and ChainSource::Pinned: pinning means pinned,
and nothing downstream may fall back from it. Otherwise it is [provider] fallback, or
default alone, which is every config that existed before routes did.
pub fn sessions_dir(&self, env: EnvFn<'_>) -> Result<PathBuf>
Sourcepub fn validate_bots(&self) -> Result<()>
pub fn validate_bots(&self) -> Result<()>
[bots.<name>]: a bot name is half of a session’s origin (bot:<name>) and a segment of
a dashboard URL, so it is checked once at load rather than at the first request that
spells it — a name with a : in it would make its own sessions unparseable.
Lowercase letters, digits, - and _, one to thirty-two of them: the same rule a profile
name follows, because it is the same kind of thing (a word a person types, and a path).
Sourcepub fn bot_file(&self, env: EnvFn<'_>, path: &str) -> Option<PathBuf>
pub fn bot_file(&self, env: EnvFn<'_>, path: &str) -> Option<PathBuf>
A path from a bot’s declaration (instructions, memory): ~ expanded, and a relative
path taken from this profile’s own directory, the same rule [user] file follows.
Sourcepub fn bot_memory(
&self,
env: EnvFn<'_>,
name: &str,
bot: &BotConfig,
) -> Option<PathBuf>
pub fn bot_memory( &self, env: EnvFn<'_>, name: &str, bot: &BotConfig, ) -> Option<PathBuf>
Where a bot’s MEMORY.md lives: its declaration, else <profile>/memory/bots/<name>/ with
the human’s own file name. Always a file of its own — the one thing a bot must not share
with the person it answers.
Sourcepub fn attachments_dir(&self, env: EnvFn<'_>) -> Option<PathBuf>
pub fn attachments_dir(&self, env: EnvFn<'_>) -> Option<PathBuf>
Where attached pictures are kept (#499): the override, else <state_dir>/attachments.
None when neither can be worked out — no HOME, no ECLIPSE_HOME and no override — which
the caller reports rather than guessing a directory the agent would write to.
Sourcepub fn where_am_i(&self, env: EnvFn<'_>, loaded: Option<&Path>) -> Where
pub fn where_am_i(&self, env: EnvFn<'_>, loaded: Option<&Path>) -> Where
The four answers a person needs when a profile surprises them: which profile, from which file, under which home, writing sessions where.
Every one of them comes from the function that already answers it — home_root,
config_path, sessions_dir — so /profile, /settings and eclipse doctor cannot
disagree the first time [sessions] dir or ECLIPSE_HOME moves. loaded is the file the
caller actually read: --config may point outside the root, and naming the default path
while running from another one is exactly the mistake this reports.
Sourcepub fn context_dir(&self, env: EnvFn<'_>) -> Option<PathBuf>
pub fn context_dir(&self, env: EnvFn<'_>) -> Option<PathBuf>
The directory this profile’s own files live in: <config>/profiles/<name> for a named
profile, the config directory itself for the default one.
Sourcepub fn scripts_dir(&self, env: EnvFn<'_>) -> Option<PathBuf>
pub fn scripts_dir(&self, env: EnvFn<'_>) -> Option<PathBuf>
Where this profile’s scripts live: scripts/ under Self::context_dir, so the
profile’s own directory when a profile is in effect and the shared one otherwise.
Nothing falls back from one to the other — a profile with no scripts has none, which is
the same rule the profile’s MEMORY.md follows.
Always absolute: the path is handed to scripts in ECLIPSE_SCRIPTS_DIR and compared
against the paths a model writes, and --config some/relative/config.toml would
otherwise make it mean something different from one working directory to the next.
Sourcepub fn memory_dir(&self, env: EnvFn<'_>) -> Option<PathBuf>
pub fn memory_dir(&self, env: EnvFn<'_>) -> Option<PathBuf>
Where the agent’s memory lives: memory/ under this profile’s directory. AGENT.md,
USER.md and MEMORY.md all sit here, because “what the agent has been told” is one
thing and answering “where is it?” with three directories is how you end up with a
SOUL.md nobody remembers writing.
[user] file and [user] memory_file may still be absolute, and an absolute path wins —
Path::join refuses to descend into one.
Sourcepub fn global_context_dir(&self, env: EnvFn<'_>) -> Option<PathBuf>
pub fn global_context_dir(&self, env: EnvFn<'_>) -> Option<PathBuf>
Where the global AGENT.md lives (the config directory, whatever --config says).