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 settings_path::settings_dir_for;pub use settings_path::SETTINGS_FILE;pub use pin::PinRecord;pub use layout_intent::LayoutEdge;pub use layout_intent::LayoutIntent;pub use layout_intent::LayoutResizeOp;pub use layout_intent::LayoutViewState;pub use layout_types::FlexDirection;pub use layout_types::LayoutClientSlices;pub use layout_types::LayoutNode;pub use layout_types::LayoutNodeData;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§
- agent_
create_ types - The request types of
Agents createand of theruntimechoiceAgents spawnshares with it. Re-exported byapi_types, where the rest of the agent requests are. - agent_
roots - The agent CLIs srv is running, kept on disk for the launcher.
- 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.
- appimage_
record - Which data channel an AppImage runs in, kept so that moving or renaming the file doesn’t lose it (#47873).
- browser_
control_ types - The request types of the Browser actions that take back, take, give up and report on control of a pane (
retake,take_control,release,handoff_status), zoom a pane (zoom) and find what is at a point of a screenshot (locate). Re-exported byapi_types, where the rest of the browser requests are. - build_
kind - What kind of build this binary is: a published release, a local package build, or a source-tree dev build.
- build_
slot - Puts the build slot where agents’ shells find it, so only one heavy build or test runs
at a time on a machine:
docs/specs/SPEC_BUILD_SLOT_ENFORCEMENT_2026_10_20.md. - capture_
shape - The shape a
Browsercapturecan ask a value to have (#47629). - checkout
- Is a test binary running the code of the checkout that runs it?
- 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.
- debug_
privilege - Whether this process holds
SeDebugPrivilegeenabled. - deeplinks
- Deep links: one address for every place AgentMux can show
(docs/specs/SPEC_DEEP_LINKS_ONE_FRAMEWORK_2026_11_20.md). The registry of destinations
(
crates/common/deeplinks/destinations.json) is generated intoregistry.rs;parsereads a link against it. srv’s guard and thePanetool read both; the app has the same pair infrontend/app/deeplinks/. - dev_
home_ guard - A dev build started by hand must not run on the real AgentMux home.
- disk_
space - Free and total space of the volume that holds a path, on every platform.
- 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. - file_
rename_ types - The request of
POST /api/v1/file/rename, which agentmux-mcp’sPane(renamewith targetfile) sends to srv. Kept out ofapi_types.rs, which re-exports it, for that file’s size. - gateway_
stamp - The stamp the container agents’ gateway forwarder puts on a model-gateway request, and what srv checks.
- github_
broker_ shim - The
ghandgitshell functions of an agent whose GitHub access goes through AgentMux Cloud. - incidents
- The incident record: what went wrong and what AgentMux did about it, kept
for the user (docs/specs/SPEC_RECOVERY_NOTICES_AND_TOASTS_2026_10_16.md
§4.1). The host writes the cases it handles (
agentmux-cefcommands::incidents), the launcher the ones only it sees (a restart); the frontend shows each one the user hasn’t closed. - 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_
files - Files sent with a jekt: the manifest, its digest, and how the msgid binds it (docs/specs/SPEC_JEKT_FILE_TRANSFER_2026_10_05.md §3.2–§3.3).
- jekt_
sign - Jekt sender signing/verification: five schemes, each over its own material:
- lan_
firewall_ rules - The Windows Firewall rules that let LAN peers reach AgentMux, and what to change to get from the rules a machine
has to those rules (
docs/specs/SPEC_LAN_FIREWALL_SETUP_2026_10_01.md4.1). Pure: it reads and writes nothing. The elevated helper in the launcher reads the machine’s rules intoExisting, asksplanwhat to do and applies the answer; running it twice changes nothing the second time. - lan_
install_ binding - An agent’s own statement of which install hosts it, for a LAN peer’s pin
(
docs/specs/SPEC_LAN_KEY_CONTINUITY_2026_10_29.md). A certificate shows only that some trusted install wrapped the agent’s public key in one, which any install of the account can do for a key it has seen. This statement is signed with the agent’s own LAN key, so only the host that holds the private half can make it. - layout_
intent - Layout intents: the frontend’s layout-tree actions, sent to srv instead of
the tree they produce. Each variant is one
LayoutTreeActionTypeoffrontend/layout/lib/types.ts, with the sametypetag and field names, so the frontend sends what its own reducer applied. docs/specs/SPEC_STRONG_REDUCER_AUTHORITY_LAYOUT_2026_06_30.md §4. - 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).
- local_
http - The HTTP client of a program that only talks to the local AgentMux server (the MCP server, bashwrap, the desktop host’s credential broker): plain http on the loopback, never https.
- 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. - mcp_
config_ path - Where an agent’s MCP config lives (#3680), shared by srv and
agentmux-mcp doctor. - muxbus_
reconnect - Whether srv reconnects to MuxBus at launch with the stored sign-in, or
waits for the user to sign in (moved out of
data_paths.rs, which holds the auth and settings isolation flags this one deliberately stays apart from). - owner_
only - Files and folders only their own user may open: the place AgentMux Headless keeps its data and the key file that signs a browser in. On Linux and macOS that is a file mode (0700, 0600). Windows has access lists instead, and a profile folder can have been changed so that others are in them; this module reads a folder’s list, says who besides the user, the system and the administrators is given access, and sets a list that gives it to the user and the system only.
- 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. - pii_
mask - Hides what looks like a payment card, an ID number or a one-time code in text an agent is about to read from a web page (the Browser tool’s snapshot, find, wait, log and every other answer).
- pin
- A pane pinned to its window: it stays on screen, at the place it has in its own tab, in every window tab
(
docs/specs/SPEC_PIN_TRANSFORM_FACILITY_2026_12_02.md§9). A pin is a flag: the pane’s block stays in its tab and in that tab’s layout, so pinning and unpinning in that tab change no layout at all. Where the pane sits is read from that layout, the one place its size is kept; the workspace holds only the list of pinned blocks. - place_
args - 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.
- process_
hardening - Keeping other processes of the same user out of srv’s and the host’s memory.
- quit_
question - The question asked before a quit that would stop agents in the middle of a turn.
- record_
events - Events for the record AgentMux keeps on this computer
(docs/specs/SPEC_LONG_RUNNING_ZERO_DEGRADATION_2026_11_16.md §6, task #47820): a stall of the host’s UI thread
or of srv’s runtime, written as one JSON line in a file for its month,
events-YYYY-MM.jsonl, next to the record’s days. srv reads them back (backend::record); the window host, a process of its own, writes the ones it sees from here, so the writer is in this crate. - 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-core/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_
env - Taking a secret out of the process environment for good.
- secret_
eq - Constant-time comparison for secrets presented by a caller.
- secret_
shape - The shape of a secret in text a page held, for the places that hand page text to an agent (#47628, #47656).
- settings_
file - Writing
settings.jsonwithout losing what the person put in it (docs/specs/SPEC_SETTINGS_JSON_EVERY_KEY_ONE_TO_ONE_2026_11_01.md §3, §5.4). - settings_
jsonc - Reading
settings.jsonthe way srv does: JSONC, so//and/* */comments and trailing commas are allowed. The seeded template has both, so a reader that parses strict JSON gets nothing from a seeded file (#1903). - settings_
path - Where a channel’s
settings.jsonlives: one answer for srv, the host and the launcher (#1903). - 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.) - shown_
once - A secret a web page shows once: a new OAuth client secret, an app registration’s client secret, a key next to a Copy button (docs/specs/SPEC_VAULT_GENERATE_CAPTURE_AND_BROWSER_SIGNINS_2026_10_28.md §15.1).
- shown_
url - How a page address is shown to an agent (in an action’s answer, a wait, a snapshot header, the action log).
- slug
- Name → slug / id / path-component rules, one named function per rule.
- srv_
binary - Where the srv binary may be, for the launcher and the CEF host. Each anchors its own folders; the file names and the order within a folder are the same.
- srv_
estart_ wait - Waiting for srv’s readiness line (
AGENTMUXSRV-ESTART), shared by the launcher and the CEF host. - 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). - system_
certs - What is said when a Linux machine has no system certificates, in one place so that
agentmux doctor, the server’s log and the error a failed https request carries all use the same words. - test_
offscreen - A test build that never shows a window on a real display.
- time
- Wall-clock “now” helpers.
- tls_
provider - The TLS crypto provider every reqwest client needs.
- tokens
- The token estimate every AgentMux surface shows, labelled “~N tok (est.)”:
⌈Unicode scalar values ÷ 4⌉. The frontend’s
estimateTokenCount(frontend/util/format-count.ts) counts the same way, and both test the same vector, so the Memory pane, the context delivery card and the reinjection card agree to the token (SPEC_MEMORY_PANE_TOKENS_2026_10_15.md §4.1). - toolchain_
path - GUI-launch PATH enrichment.
- typed_
secrets - What was typed into a page from the Vault, kept as a keyed digest so a read can leave it out wherever it shows (docs/specs/SPEC_VAULT_AGENTS_ENTER_CREDENTIALS_WHEREVER_ASKED_2026_11_16.md, G4).
- ui_
record_ types - The request and response of
POST /api/v1/ui/record(theUIRecordtool). Re-exported byapi_types, where the rest of the UI requests are. - ui_
screenshot_ types - The request and response of
POST /api/v1/ui/screenshot(theUItool’sscreenshot). Re-exported byapi_types, where the rest of the UI requests are. - update_
manifest - The signed manifest of a release’s files
(
docs/specs/SPEC_SIGNED_UPDATE_CHECKSUMS_2026_10_25.md). - url_
guard - The origin of an address, asked through one guard.
- user_
path - The person’s own PATH on Windows (
HKEY_CURRENT_USER\Environment, valuePath): whatinstall.ps1 -Headlessadds one entry to, andagentmux uninstalltakes that entry back out of. Only the person’s own list is read or written, never the machine’s, and only entries inside the install folder are removed; the rest of the value is kept as it is. The text work is plain code that is tested on every platform. - win32
- Win32 process-creation flags shared by every crate that spawns a child on Windows.
- xauthority
Macros§
- checkout_
guard - Runs [
guard] for the invoking crate when its test binary starts, from the platform’s initializer section (as thectorcrate does). Invoke it once per test binary: at a crate’s root, behind#[cfg(test)]where the crate hasagentmux-commononly as a dev-dependency, and at the top of each file undertests/. Pass theCHECKOUT_DIRof each other workspace library the binary links (agentmux_common’s is always checked).
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.