Skip to main content

Config

Struct Config 

Source
pub struct Config {
Show 19 fields pub provider: Option<String>, pub model: Option<String>, pub api_key: Option<String>, pub base_url: Option<String>, pub vertex_project_id: Option<String>, pub vertex_location: Option<String>, pub package_manager: Option<String>, pub architect_model: Option<String>, pub actuator_model: Option<String>, pub verifier_model: Option<String>, pub speculator_model: Option<String>, pub providers: BTreeMap<String, ProviderEntry>, pub models: Option<ModelsConfig>, pub external_tools: Vec<ExternalToolConfig>, pub ensemble: Option<Value>, pub verification: Option<VerificationConfig>, pub exploration: Option<ExplorationConfig>, pub prompts: Option<PromptsConfig>, pub context: Option<ContextConfig>,
}
Expand description

Main configuration struct.

All fields are optional. Documented aliases are accepted on load so that older field names keep working (provider_type, default_provider, default_model).

Fields§

§provider: Option<String>

Provider id, e.g. openai, anthropic, gemini, vertex, ollama.

§model: Option<String>

Default chat/simple-chat model.

§api_key: Option<String>

API key for the configured provider. Optional; may also come from env.

§base_url: Option<String>

Optional base URL override for OpenAI-compatible / local endpoints.

§vertex_project_id: Option<String>

Google Cloud project id for Vertex AI. Optional; may also come from VERTEX_PROJECT_ID or Google Cloud project environment variables.

§vertex_location: Option<String>

Vertex AI location. Optional; may also come from VERTEX_LOCATION.

§package_manager: Option<String>

Preferred package manager for greenfield project init. Optional and fully plugin-driven: the active language plugin maps it to its own init command and default (e.g. Python → uv, JS → npm). Unknown values fall back to each plugin’s default. Examples: uv, poetry, pdm, pipenv (Python); pnpm, yarn (JS).

§architect_model: Option<String>

Agent Architect-tier model override.

§actuator_model: Option<String>

Agent Actuator-tier model override.

§verifier_model: Option<String>

Agent Verifier-tier model override.

§speculator_model: Option<String>

Agent Speculator-tier model override.

§providers: BTreeMap<String, ProviderEntry>

The [providers.<id>] table: several credentials coexisting in one process (PSP-9 system 1). Empty for single-provider configurations, which continue to use the flat fields above.

§models: Option<ModelsConfig>

The [models] table: per-tier fully qualified provider::model routes. When present it takes precedence over the flat *_model fields.

§external_tools: Vec<ExternalToolConfig>

Shared MCP server configuration. Omitted modes default to agent-only.

§ensemble: Option<Value>

Detector for the removed PSP-9 [ensemble] block. Deserialization only: a present block fails validation with a pointed migration error naming [exploration] (PSP-10 cutover), never a silent ignore.

§verification: Option<VerificationConfig>

Verification acceptance-stage options ([verification]).

§exploration: Option<ExplorationConfig>

Bounded search configuration ([exploration]; PSP-10 system 20).

§prompts: Option<PromptsConfig>

Prompt bundles and activation bounds ([prompts]; PSP-10 system 25).

§context: Option<ContextConfig>

Resident-context reserves ([context]; PSP-10 Definition 6).

Implementations§

Source§

impl Config

Source

pub fn from_toml_str(content: &str) -> Result<Self>

Parse a Config from a TOML string. A partial document is valid.

Source

pub fn load_from_path(path: &Path) -> Result<Self>

Load a Config from a file path. Returns Config::default() when the file does not exist, so callers can always work with effective values.

Source

pub fn to_toml_string(&self) -> Result<String>

Serialize this config to a TOML string.

Source

pub fn masked(&self) -> Self

Return a clone with the API key masked, for display purposes.

Source

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

Source

pub fn set_value(&mut self, key: &str, value: &str) -> Result<()>

Set a single key to a string value, used by config --set.

Returns an error for unknown keys so typos surface immediately.

Trait Implementations§

Source§

impl Clone for Config

Source§

fn clone(&self) -> Config

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() -> Config

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§

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

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

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

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.

§

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

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: 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
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: 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> Same for T

Source§

type Output = T

Should always be Self
§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

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

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