agentmux_common/
lib.rs

1// Copyright 2025-2026, AgentMux Corp.
2// SPDX-License-Identifier: Apache-2.0
3
4//! Shared utilities for AgentMux crates.
5
6pub mod api_types;
7mod cli;
8pub mod data_paths;
9pub mod errors;
10pub mod ipc;
11pub mod layout_types;
12pub mod runtime_mode;
13pub mod toolchain_path;
14
15pub use cli::make_cli_cmd;
16pub use data_paths::DataPaths;
17pub use errors::{AgentMuxError, AmxCode};
18pub use layout_types::{FlexDirection, LayoutNode, LayoutNodeData, ResizeOp, SplitPosition};
19pub use runtime_mode::{is_dev_build_exe, is_dev_self, RuntimeMode};
20pub use toolchain_path::{
21    enrich_current_process_path, looks_like_launchd_default, resolve_login_path, EnrichedPath,
22    PathSource,
23};
24
25/// Crate-wide test-only lock for env-var-touching tests. Both
26/// `runtime_mode::tests` and `data_paths::tests` mutate process-global
27/// env vars (`AGENTMUX_RUNTIME_MODE`, `AGENTMUX_HOME_OVERRIDE`, etc.);
28/// without a lock that's shared ACROSS modules, cargo's parallel test
29/// runner can race a setter in one module against a reader in the
30/// other. A per-module `static Mutex<()>` was insufficient — they
31/// need to share the same Mutex instance.
32#[cfg(test)]
33pub(crate) static TEST_ENV_LOCK: std::sync::Mutex<()> = std::sync::Mutex::new(());