Skip to main content

Config

Struct Config 

Source
pub struct Config {
    pub provider: Option<Setting<BuiltinProvider>>,
    pub model: Option<Setting<String>>,
    pub effort: Option<Setting<Effort>>,
    pub base_url: Option<Setting<String>>,
    pub gateways: Option<Setting<GatewayRingConfig>>,
    pub files: Vec<ContextFile>,
}
Expand description

What the discovered files say, layered.

Every field is optional because every key is: a file that sets model and nothing else has said one thing, and basis must still answer the rest the way it always did. An empty Config — Default — is exactly “no file said anything”, which is also how a host turns discovery off (WorkspaceBuilder::with_config).

Fields§

§provider: Option<Setting<BuiltinProvider>>

Which provider preset to use, and therefore which credential variable.

§model: Option<Setting<String>>

The model id, as ModelSelector::Id.

§effort: Option<Setting<Effort>>

The reasoning effort a run gets when it asked for none.

§base_url: Option<Setting<String>>

An OpenAI-compatible endpoint. Global file only; see the module docs.

§gateways: Option<Setting<GatewayRingConfig>>

Several endpoints to one model, in preference order — base_url said more than once. Global file only, for base_url’s reason, and never beside it.

§files: Vec<ContextFile>

The files that took effect, most specific first — for a caller that reports which conventions it read.

Implementations§

Source§

impl Config

Source

pub fn discover( workspace: &Path, global_dir: Option<&Path>, ) -> Result<Self, ConfigError>

Every config file that exists, layered field by field with the workspace’s own winning.

A missing file is not an error — most workspaces say nothing. A file that exists and cannot be read or understood is, because the operator wrote it meaning something: .mcp.json’s rule, and for the same reason. A repository that pinned a model and then misspelled the key should not run a different model in silence.

global_dir is the directory ContextConfig::global_dir resolves — $BASIS_CONFIG_DIR, else $XDG_CONFIG_HOME/basis, else $HOME/.config/basis. Passed in rather than resolved here so one process cannot read two different global directories.

Source

pub fn discover_default(workspace: &Path) -> Result<Self, ConfigError>

discover against the process’s environment and the default global directory.

Source

pub fn read_file(path: impl AsRef<Path>) -> Result<Self, ConfigError>

Exactly the file at path, read as the host’s own.

For an embedder that keeps its basis configuration where it chooses: nothing else is probed, and a file that is missing is an error rather than silence — a host that named a path meant one. Read with ContextScope::Global’s standing, so base_url and gateways are honored: the host chose this file, which is the trust the global file has and a repository’s file does not.

Source

pub fn is_empty(&self) -> bool

Whether any file said anything at all.

Source

pub fn model_selector(&self) -> Option<ModelSelector>

The model as a selector, for the two builders that take one.

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 Eq for Config

Source§

impl PartialEq for Config

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Config

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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.

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

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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