pub enum Mechanism {
Env(&'static str),
EnvFile(&'static str),
FlagDir(ConflictOption),
FlagFile(ConflictOption),
}Expand description
How an adapter points its agent at the profile: the cross product of {variable, flag} x
{directory, file}. This is the complete, closed set — it is the same vocabulary the probe harness
speaks (sandbox/probes/common.sh, env: / envfile: / flagdir: / flagfile:), so a fifth
variant here would be a mechanism no probe can exercise.
§Three renderings, one per consumer — do not collapse them
std::fmt::Display— the path-free sentence, for error messages. An error message cannot name a path, becausecheck_conflictsrefuses an argument before any plan exists and therefore before any path has been chosen. It prints the placeholder<dir>/<file>instead.Mechanism::sentence_for— the concrete sentence that becomesPlannedLaunch::mechanism, for the launch report. A report line should name the exact path it is about to create, so here the placeholder is the real path.Mechanism::probe_token— the machine identifier the evidence pipeline consumes. The human text above may be reworded freely; this token may not.
That (1) and (2) differ in form for flag mechanisms is deliberate, not drift: they answer different questions at different times. For environment mechanisms they coincide, because there is no path in the sentence to differ over.
All three are generated from this one value, and so is the launch itself: Mechanism::plan (crate
internal, so not linked here — a public doc comment cannot link a private item) dispatches on the
variant and takes the variable name or
flag spelling out of the variant’s own payload. An adapter passes no name and no flag, so there is no
second string for the first to drift from.
Variants§
Env(&'static str)
A variable set to the profile directory.
EnvFile(&'static str)
A variable set to a file inside the profile directory.
FlagDir(ConflictOption)
An option passed the profile directory.
FlagFile(ConflictOption)
An option passed a file inside the profile directory.
Implementations§
Source§impl Mechanism
impl Mechanism
Sourcepub fn conflict_option(&self) -> Option<&ConflictOption>
pub fn conflict_option(&self) -> Option<&ConflictOption>
The option this mechanism itself occupies, if it is a flag. check_conflicts scans it alongside
the adapter’s declared extra conflicts, so an adapter cannot accept a flag it uses itself.
Sourcepub fn sentence_for(&self, target: &Path) -> String
pub fn sentence_for(&self, target: &Path) -> String
The report sentence naming target, the path this mechanism points at. Environment mechanisms
name the variable and ignore target.
Sourcepub fn probe_token(&self) -> String
pub fn probe_token(&self) -> String
The evidence pipeline’s identifier, e.g. env:CODEX_HOME or flagfile:--config.
Source§impl Mechanism
impl Mechanism
Sourcepub(crate) fn plan(
&self,
adapter: &dyn Adapter,
ctx: &PlanContext<'_>,
) -> Result<PlannedLaunch>
pub(crate) fn plan( &self, adapter: &dyn Adapter, ctx: &PlanContext<'_>, ) -> Result<PlannedLaunch>
Plans a launch that points the agent at its profile through this mechanism.
The variable name and the flag spelling are read out of the mechanism’s own payload, and the
report sentence comes from Mechanism::sentence_for on the very same value. There is no
parameter through which an adapter could pass a second name, so declaring Env("A") and
launching with "B" is not expressible — the two used to be separate arguments and agreed only
because every adapter happened to pass the same constant twice.
It lives here rather than in metadata because planning needs this module’s private
machinery — executable discovery, the case-twin check and path materialization state.
Adapter-specific extras stay in the adapter: plan() returns no notes, and an adapter that has
one (Codex’s logged-out note, Aider’s layering note) pushes it onto the result.
Trait Implementations§
impl Copy for Mechanism
impl Eq for Mechanism
impl StructuralPartialEq for Mechanism
Auto Trait Implementations§
impl Freeze for Mechanism
impl RefUnwindSafe for Mechanism
impl Send for Mechanism
impl Sync for Mechanism
impl Unpin for Mechanism
impl UnsafeUnpin for Mechanism
impl UnwindSafe for Mechanism
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.