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
impl Config
Sourcepub fn discover(
workspace: &Path,
global_dir: Option<&Path>,
) -> Result<Self, ConfigError>
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.
Sourcepub fn discover_default(workspace: &Path) -> Result<Self, ConfigError>
pub fn discover_default(workspace: &Path) -> Result<Self, ConfigError>
discover against the process’s environment and the
default global directory.
Sourcepub fn read_file(path: impl AsRef<Path>) -> Result<Self, ConfigError>
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.
Sourcepub fn model_selector(&self) -> Option<ModelSelector>
pub fn model_selector(&self) -> Option<ModelSelector>
The model as a selector, for the two builders that take one.