Skip to main content

Crate agentmux_common

Crate agentmux_common 

Source
Expand description

Shared utilities for AgentMux crates.

Re-exports§

pub use data_paths::isolated_auth_enabled;
pub use data_paths::isolated_auth_reason;
pub use data_paths::isolated_muxbus_reconnect_enabled;
pub use data_paths::isolated_muxbus_reconnect_reason;
pub use data_paths::isolated_settings_enabled;
pub use data_paths::isolated_settings_reason;
pub use data_paths::DataPaths;
pub use data_paths::IsolatedAuthReason;
pub use data_paths::IsolatedMuxbusReconnectReason;
pub use data_paths::IsolatedSettingsReason;
pub use errors::AgentMuxError;
pub use errors::AmxCode;
pub use layout_types::FlexDirection;
pub use layout_types::LayoutClientSlices;
pub use layout_types::LayoutNode;
pub use layout_types::LayoutNodeData;
pub use layout_types::ResizeOp;
pub use layout_types::SplitPosition;
pub use layout_types::StackMovePosition;
pub use runtime_mode::is_dev_build_exe;
pub use runtime_mode::is_dev_self;
pub use runtime_mode::RuntimeMode;
pub use toolchain_path::refresh_login_path_cache;
pub use toolchain_path::enrich_current_process_path;
pub use toolchain_path::enrich_current_process_path_cached;
pub use toolchain_path::looks_like_launchd_default;
pub use toolchain_path::resolve_login_path;
pub use toolchain_path::EnrichOutcome;
pub use toolchain_path::EnrichedPath;
pub use toolchain_path::PathSource;

Modules§

allowed_origins
The sites an agent’s browser pane may go to, when the agent limited it with OpenBrowser({allowed_origins}) (docs/specs/SPEC_BROWSER_PANE_ALLOWED_ORIGINS_2026_10_09.md §2).
api_types
Canonical HTTP request/response DTOs shared between agentmux-srv, agentmux-mcp, and agentmux-bashwrap. Every struct here is the single source of truth for the corresponding wire shape; the three crates all import rather than redeclare these types.
client_events
Payloads of the broker events agentmux-bashwrap publishes through srv’s POST /agentmux/wps/publish. srv declares the same types for these events (backend::mps_events), refuses a publish whose data isn’t one of them, and generates them for the frontend, so the three can’t drift (docs/specs/SPEC_CODEGEN_REMAINING_GAPS_2026_10_13.md, step 2).
copy_into_dir
The one “copy a file or folder into a directory” used by drag and drop, paste, and the attachment store’s copy-to-workdir. docs/specs/SPEC_DRAG_AND_DROP_CONSOLIDATION_2026_09_27.md §5.5.
data_paths
Unified data-path resolution for AgentMux.
errors
Cross-process error catalog.
event_log
Reducer event log: an in-memory ring buffer of recent Events for replay, plus an optional append-only JSON-lines disk stream for crash forensics.
install_presence
An install’s presence record: one AgentMux install (a channel on a machine) saying it is up, on which platform, and which agents it runs, so the account’s relay can list it to a signed-in phone that is not on the same LAN. Wire contract: agentmux-mobile’s SPEC_FLEET_HOST_TAGS_AND_CLOUD_HOSTS_2026_10_06 §6.1; version 2 adds each agent’s state (agentmux-mobile’s SPEC_AGENT_STATUS_AND_LIVE_PANE_FEED_2026_10_07 §13.1). The desktop publishes v2; v1 is still built and checked, for the relay’s sake. Version 3 is v2 with an optional top-level gone. The desktop sends it only as the goodbye when it quits, signs out or stops publishing: gone: true and no agent states, which the relay keeps as “offline since” for a short while instead of a live entry. Version 4 is v3 with each agent’s optional line, its Swarm summary line (agentmux’s SPEC_SWARM_OTHER_HOSTS_AND_CHANNELS_2026_10_02 §3.4 Phase 4), signed as a fourth agent field. The desktop publishes v4 when it has lines to share; a goodbye stays v3.
ipc
Phase B.2 IPC wire protocol — shared between agentmux-launcher (server) and agentmux-cef (client). One source of truth so the Command / Event shapes can’t drift between binaries on a version-skew release.
jekt_sign
Jekt sender signing/verification — three schemes, one signed-material format:
layout_types
Shared layout tree types used in both the srv wire protocol (ipc.rs Command/Event variants) and the srv object store (obj.rs LayoutState).
log_retention
Log-file retention, shared by srv and the CEF host (each rotates its own logs into its own directory).
login_pty
Shared pieces for running a provider CLI’s login under a PTY and reading its OAuth URL out of the output: used by the desktop host (agentmux-cef commands/cli_login.rs) and by srv’s auth.* (agentmux-srv server/identity_auth_spawn.rs, identity/auth_patterns.rs). docs/specs/SPEC_PROVIDER_LOGIN_THROUGH_SRV_2026_10_09.md.
pagefile
Windows page-file volume tracking, shared between agentmux-srv (backend/sysinfo.rs’s StatusBar telemetry) and agentmux-cef (memory_heartbeat.rs’s low-memory banner). Extracted from sysinfo.rs by docs/specs/SPEC_RAM_PAGEFILE_PRESSURE_SPLIT_2026_08_07.md §4 so the two processes can’t independently drift on “what counts as system-managed” the way the commit-ratio classifier and the StatusBar gauge once did (issue #2218) — one implementation, two callers.
platform_name
The OS name the frontend uses (Node’s process.platform values), from Rust’s std::env::consts::OS.
popup_rules
Which new windows a browser pane’s page may open inside AgentMux (docs/specs/SPEC_BROWSER_PANE_POPUPS_ADOPTED_2026_10_08.md §3.1, docs/specs/SPEC_BROWSER_PANE_NATIVE_POPUPS_AGENT_DRIVEN_2026_10_08.md §3).
process
Best-effort child-process termination, by PID.
redact
Shape-based, best-effort secret redaction — the one Rust implementation SPEC_ERROR_COPY_EVERYWHERE_2026_09_24.md §4.5 asks every formatter that puts error/log text on the clipboard to share, instead of each inventing its own. Moved here from crates/srv/src/backend/continuity.rs, which only recognized credential-prefixed tokens and PEM private keys — enough for a continuation packet, not enough for raw stderr and request details (Codex P1 on #3689).
runtime_mode
Runtime mode detection — single source of truth.
secret_eq
Constant-time comparison for secrets presented by a caller.
shell_quote
POSIX shell quoting, shared by srv and the CEF host. (bashwrap’s hook.rs has its own platform-aware variant that also leaves safe strings bare; it is deliberately different.)
slug
Name → slug / id / path-component rules, one named function per rule.
srv_stderr
The stderr line protocol agentmux-srv uses to talk to whichever process supervises it — the launcher in packaged builds and task dev (crates/launcher/src/srv_spawner.rs), or the CEF host in task dev:standalone (crates/cef/src/sidecar.rs).
time
Wall-clock “now” helpers.
toolchain_path
GUI-launch PATH enrichment.
transcript_request
transcript_request/transcript_response wire payload — muxspect Phase B/C’s LAN/WAN conversation-visibility protocol (docs/specs/SPEC_MUXSPECT_CROSS_TIER_CONVERSATION_VISIBILITY_2026_08_21.md, jekt tier rules confirmed in docs/specs/SPEC_JEKT_TRANSCRIPT_REQUEST_TIER_RULES_2026_08_22.md).
win32
Win32 process-creation flags shared by every crate that spawns a child on Windows.
xauthority

Constants§

AUTH_KEY_HEADER
The HTTP header that carries srv’s instance auth key, on every route and on the /ws upgrade. srv checks it in crates/srv/src/server/auth.rs; every Rust client (mcp, cef, bashwrap, launcher, srv’s own forwards) sends it under this name. The frontend’s twin is AUTH_KEY_HEADER in frontend/util/sharedconst.ts. HTTP header names are case-insensitive, so this is the spelling we send, not the only one srv accepts.

Functions§

make_cli_cmd
Create a Command for a CLI binary.
resolve_cli_spawn_target
Resolve cli_path to the actual (program, args) spawn target — the .cmd/.bat shim parsing on Windows, factored out of build_cli_cmd so non-tokio::process::Command spawners (e.g. portable_pty::CommandBuilder, which run_cli_login_pty uses) can reuse the same resolution instead of spawning the raw shim path directly. Spawning a .cmd file straight through CommandBuilder forces Windows through cmd.exe /c, and that layer hangs indefinitely under a real ConPTY (confirmed live: 0% CPU, zero output, target dir never created) — this is the fix for that class of bug, not just a refactor for its own sake.