pub struct Config {
pub agents: Vec<AgentSpec>,
pub roles: Roles,
pub graph: Graph,
pub blind: Blind,
pub verify: Verify,
pub disk: Disk,
pub merge: Merge,
pub update: Update,
pub prompts: Prompts,
pub notify: Notify,
pub repos: Repos,
}Expand description
Top-level configuration.
Fields§
§agents: Vec<AgentSpec>Agent roster.
roles: RolesRole assignment.
graph: GraphGraph shape.
blind: BlindBlindness policy.
verify: VerifyVerification commands.
disk: DiskDisk hygiene.
merge: MergeMerge policy.
update: UpdateSelf-update policy.
prompts: PromptsProject-specific text appended to the node prompts.
notify: NotifyHow the operator is told a run is waiting on them.
repos: ReposLocal repositories the plan surface can start or derive a conversation against.
Implementations§
Source§impl Config
impl Config
Sourcepub const CONFIG_DIR_ENV: &str = "MAGI_CONFIG_DIR"
pub const CONFIG_DIR_ENV: &str = "MAGI_CONFIG_DIR"
Environment variable that relocates the machine-wide config layer.
Set it to a directory and magi reads <dir>/magi/config.toml instead
of the one under dirs::config_dir; set it to the empty string and
magi reads no machine layer at all.
This exists because the machine layer is otherwise unavoidable, and a
test that builds a config fixture is not asking for the operator’s
preferences to be merged into it. Adding [repos] roots to the real
machine config on a development box turned two passing tests red -
repos_list_returns_name_and_path_for_every_configured_root and
repos_list_only_rescans_within_the_ttl_when_asked_to, whose fixtures
declare [repos] roots of their own, which Config::layers then
found in two layers and Config::refuse_split_arrays correctly
refused. CI never saw it: a runner has no machine config, so the suite
was green there and red only where somebody actually uses magi.
An operator gets the same escape hatch for free: a second machine config, or none, without moving files about.
Sourcepub fn load(path: &Path) -> Result<Self>
pub fn load(path: &Path) -> Result<Self>
Load one file through teravars: Tera rendering, [vars] resolution,
and the include = [...] directive.
Sourcepub fn load_layers(paths: &[PathBuf]) -> Result<Self>
pub fn load_layers(paths: &[PathBuf]) -> Result<Self>
Load and deep-merge a stack of config files, later files winning.
This is why the config is TOML-through-teravars rather than plain serde:
the roster is a machine fact (which CLIs and plans you pay for) while
the gate is a repository fact (cargo make check here, pnpm test
there). Picking one file and ignoring the other would force every repo
to restate the roster.
Sourcepub fn discover(
repo: &Path,
explicit: Option<&Path>,
) -> Result<(Self, Vec<PathBuf>)>
pub fn discover( repo: &Path, explicit: Option<&Path>, ) -> Result<(Self, Vec<PathBuf>)>
Resolve the config for repo, honouring an explicit --config path.
Returns the config and the layers it came from, empty for built-in defaults.
Sourcepub fn layers(repo: &Path) -> Vec<PathBuf>
pub fn layers(repo: &Path) -> Vec<PathBuf>
Every config layer that applies to repo, in increasing precedence.
The machine layer is whatever Config::machine_layer resolves to,
which is nothing at all in a test build.
Sourcepub fn autodetected() -> Self
pub fn autodetected() -> Self
Built-in config whose roster is the agent CLIs found on PATH.
Sourcepub fn cache_dir(&self) -> Option<PathBuf>
pub fn cache_dir(&self) -> Option<PathBuf>
The shared build cache the verify commands and the agents both build
into, when the config declares one. See Verify::cache_dir.
Sourcepub fn resolve_roles(&self) -> Result<ResolvedRoles>
pub fn resolve_roles(&self) -> Result<ResolvedRoles>
Fill the roles out to the configured widths.
An empty role list rotates through the whole roster, so a three-agent
roster with candidates = 3 gives one implementation per agent, and
judges = 3 rotates the judge seats by one so that judge i is not the
author of candidate i whenever the roster has more than one agent.
Sourcepub fn starter_toml() -> String
pub fn starter_toml() -> String
Starter config, as written by magi init.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Config
impl<'de> Deserialize<'de> for Config
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnsafeUnpin for Config
impl UnwindSafe for Config
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more