Skip to main content

Config

Struct Config 

Source
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: u32

The 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: Dotenv

Which .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

Source

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

Source

pub fn settings(&self) -> Vec<Setting>

Every scalar key this build knows, defaults and current values included, sorted by path.

Nested tables and arrays of tables are skipped: they are structures, not settings (see the module doc). Arrays of scalars are settings and are included.

Source

pub fn setting(&self, path: &str) -> Option<Setting>

The setting path names (provider.model), if this build has it.

Source§

impl Config

Source

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.

Source

pub fn load_with(explicit: Option<&Path>, env: EnvFn<'_>) -> Result<Config>

Source

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.

Source

pub fn profile_name(&self) -> &str

The profile name in effect, default when none was selected.

Source

pub fn state_dir(&self, env: EnvFn<'_>) -> Result<PathBuf>

This profile’s state directory (sessions, REPL history).

Source

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.

Source

pub fn from_file(path: &Path) -> Result<Config>

Source

pub fn from_toml_str(text: &str) -> Result<Config, String>

Source

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.

Source

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.

Source

pub fn require_provider(&self) -> Result<()>

Fail early, with an actionable message, if the provider is not configured.

Source

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.

Source

pub fn route_names(&self) -> String

The routes that exist, for a sentence that has to name them.

Source

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.

Source

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.

Source

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.

Source

pub fn sessions_dir(&self, env: EnvFn<'_>) -> Result<PathBuf>

Source

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).

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn global_context_dir(&self, env: EnvFn<'_>) -> Option<PathBuf>

Where the global AGENT.md lives (the config directory, whatever --config says).

Source

pub fn home(&self, env: EnvFn<'_>) -> Option<PathBuf>

Source

pub fn workspace_root(&self, env: EnvFn<'_>) -> PathBuf

Trait Implementations§

Source§

impl Clone for Config

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Config

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Config

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Config
where Config: Default,

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for Config

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl Forget for Config

§

impl Freeze for Config

§

impl Move for Config

§

impl RefUnwindSafe for Config

§

impl Send for Config
where RawVecInner: Send, NodeRef<Owned, String, Value, LeafOrInternal>: Send, BoxRaw<(String, Value)>: Send, NodeRef<Owned, String, Value, LeafOrInternal>: Send, BoxRaw<(String, Value)>: Send, NodeRef<Owned, String, String, LeafOrInternal>: Send, BoxRaw<(String, String)>: Send, NodeRef<Owned, String, Policy, LeafOrInternal>: Send, BoxRaw<(String, Policy)>: Send, NodeRef<Owned, String, BotConfig, LeafOrInternal>: Send, BoxRaw<(String, BotConfig)>: Send,

§

impl Sync for Config
where RawVecInner: Sync, NodeRef<Owned, String, Value, LeafOrInternal>: Sync, BoxRaw<(String, Value)>: Sync, NodeRef<Owned, String, Value, LeafOrInternal>: Sync, BoxRaw<(String, Value)>: Sync, NodeRef<Owned, String, String, LeafOrInternal>: Sync, BoxRaw<(String, String)>: Sync, NodeRef<Owned, String, Policy, LeafOrInternal>: Sync, BoxRaw<(String, Policy)>: Sync, NodeRef<Owned, String, BotConfig, LeafOrInternal>: Sync, BoxRaw<(String, BotConfig)>: Sync,

§

impl Unpin for Config
where *const u8 is !null: Unpin, *const LeafNode<String, Value> is !null: Unpin, Box<(String, Value)>: Unpin, *const LeafNode<String, Value> is !null: Unpin, Box<(String, Value)>: Unpin, *const LeafNode<String, String> is !null: Unpin, Box<(String, String)>: Unpin, *const LeafNode<String, Policy> is !null: Unpin, Box<(String, Policy)>: Unpin, *const LeafNode<String, BotConfig> is !null: Unpin, Box<(String, BotConfig)>: Unpin,

§

impl UnsafeUnpin for Config

§

impl UnwindSafe for Config

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more