Skip to main content

RuntimeMode

Enum RuntimeMode 

Source
pub enum RuntimeMode {
    Installed,
    Portable,
    Dev {
        branch: String,
        clone_id: Option<String>,
    },
}
Expand description

Where this AgentMux binary is running from. Determines data path layout (see crate::DataPaths).

Variants§

§

Installed

Installed via the platform installer (msi/dmg/deb). State lives in ~/.agentmux/versions/<v>/.

§

Portable

Running from an extracted portable ZIP. State STILL lives in ~/.agentmux/versions/<v>/ (not under the portable folder) — portable binaries are stateless on disk.

§

Dev

Running from a source-tree build. State lives in ~/.agentmux/dev/<branch>/<clone_id>/ so different branches AND different clones of the same branch don’t share state.

clone_id is a 16-char hex hash of the clone’s workspace-root path, derived by derive_clone_id when the launcher detects Dev mode. None is permitted for backward compatibility with callers that construct RuntimeMode::Dev directly (tests, the dev:branch env-string parser that pre-dates this field): in that case path resolution falls back to the old two-level dev/<branch>/ layout. See docs/analysis/ANALYSIS_MULTI_CLONE_TASK_DEV_ISOLATION_2026-05-26.md.

Fields

§branch: String
§clone_id: Option<String>

Implementations§

Source§

impl RuntimeMode

Source

pub fn current(exe_dir: &Path) -> Self

Detect runtime mode from the launcher’s vantage point. Call ONCE at process startup. Subsequent processes read the AGENTMUX_RUNTIME_MODE env var via Self::from_env.

exe_dir should be current_exe().parent() of the binary doing the detection (typically the launcher).

Source

pub fn from_env() -> Option<Self>

Read mode from the AGENTMUX_RUNTIME_MODE env var the launcher set. Used by host + srv to consume the launcher’s decision without re-detecting (which would re-introduce the desync risk the legacy code had).

Source

pub fn current_path_only(exe_dir: &Path) -> Self

Path-only detection — skips the AGENTMUX_RUNTIME_MODE env step. Use when the env can’t be trusted (e.g., the binary was launched as a child of a different AgentMux process that set its own AGENTMUX_* vars). Mirrors the rest of Self::current’s priority order (portable marker → dev exe path → installed).

Source

pub fn to_env_string(&self) -> String

Encode for the AGENTMUX_RUNTIME_MODE env var. Round-trips with [parse_mode_string].

Source

pub fn dir_slug(&self) -> String

Slug used inside ~/.agentmux/ to separate state by mode. Stable across releases of the same major mode + branch.

Source

pub fn from_env_with_clone() -> Option<Self>

Read the runtime mode AND clone_id from the env vars exported by the parent process. Pairs AGENTMUX_RUNTIME_MODE (variant + branch) with AGENTMUX_CLONE_ID (Dev-only clone discriminator). This is the version every child process (host, srv) should call — Self::from_env is the legacy single-var form kept for callers that don’t care about clone isolation.

Trait Implementations§

Source§

impl Clone for RuntimeMode

Source§

fn clone(&self) -> RuntimeMode

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 RuntimeMode

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for RuntimeMode

Source§

impl PartialEq for RuntimeMode

Source§

fn eq(&self, other: &RuntimeMode) -> 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 RuntimeMode

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.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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