Expand description
Shared utilities for AgentMux crates.
Re-exports§
pub use data_paths::ensure_history_link;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-bashwrappublishes through srv’sPOST /agentmux/wps/publish. srv declares the same types for these events (backend::mps_events), refuses a publish whosedataisn’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-levelgone. The desktop sends it only as the goodbye when it quits, signs out or stops publishing:gone: trueand 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 optionalline, 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-cefcommands/cli_login.rs) and by srv’sauth.*(agentmux-srvserver/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) andagentmux-cef(memory_heartbeat.rs’s low-memory banner). Extracted fromsysinfo.rsbydocs/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.platformvalues), from Rust’sstd::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 fromcrates/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.rshas 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-srvuses to talk to whichever process supervises it — the launcher in packaged builds andtask dev(crates/launcher/src/srv_spawner.rs), or the CEF host intask dev:standalone(crates/cef/src/sidecar.rs). - time
- Wall-clock “now” helpers.
- toolchain_
path - GUI-launch PATH enrichment.
- transcript_
request transcript_request/transcript_responsewire payload —muxspectPhase 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
/wsupgrade. srv checks it incrates/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 isAUTH_KEY_HEADERinfrontend/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_pathto the actual(program, args)spawn target — the.cmd/.batshim parsing on Windows, factored out ofbuild_cli_cmdso non-tokio::process::Commandspawners (e.g.portable_pty::CommandBuilder, whichrun_cli_login_ptyuses) can reuse the same resolution instead of spawning the raw shim path directly. Spawning a.cmdfile straight throughCommandBuilderforces Windows throughcmd.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.