Module data_paths

Module data_paths 

Source
Expand description

Unified data-path resolution for AgentMux.

Single source of truth for where state lives on disk. Replaces the launcher / host / sidecar trio of independent path computations (see docs/specs/SPEC_DATA_DIR_UNIFICATION_2026-05-05.md §3) and the per-version isolation pattern it set up (data was keyed on the build version so My Agents reset on every patch bump). The current model keys data on a channel — a stable identifier that spans versions within the same compat band, so agents survive rebuilds. See docs/specs/SPEC_DATA_CHANNELS_2026_05_24.md and discussion #1026 for the channel design and rationale.

Layout:

~/.agentmux/
├── shared/                       (cookies, credentials, account-wide)
├── channels/<channel>/           (installed + portable + custom)
│   ├── data/, config/, logs/, cef-cache/, agents/
│   └── runtime/                  (lock + IPC, single instance per channel)
└── dev/<branch>/                 (per-branch dev isolation)
    └── (same children as channels/<channel>/)

Channel resolution (via DataPaths::resolve):

  • AGENTMUX_CHANNEL=<name> env override wins for Installed / Portable modes — lets the operator point a released binary at any channel for parallel-channel testing.
  • RuntimeMode::Installed / Portable w/o override → build-time default from AGENTMUX_BUILD_CHANNEL_DEFAULT (set by the packaging script; defaults to "stable" if unset, e.g. for cargo run).
  • RuntimeMode::Dev { branch } → channel name is dev-<branch> for diagnostics; on-disk path stays at ~/.agentmux/dev/<branch>/ (NOT under channels/). Both the host (agentmux-cef) and launcher (agentmux-launcher) use DataPaths::resolve_path_only for dev builds to ignore AGENTMUX_CHANNEL — a dev session launched from inside a parent agentmux pane mustn’t inherit the parent’s channel and break per-branch isolation. Channel override is intentionally NOT supported in dev mode; if you want a different channel, use a portable build.

Structs§

DataPaths
All paths a launcher / host / srv needs. Computed once by the launcher; downstream binaries read paths from env vars set by the launcher rather than recomputing (avoids the legacy desync risk where each binary made its own portable / dev-mode determination).