Paths
paths
Shared filesystem roots, owned by axm-config and only read elsewhere.
The galaxy declared the same roots over and over: ~/axm/sessions in five
packages, ~/axm/quality in three, ~/axm/protocols in three, and the
~/.axm/warden.sock resolution copy-pasted across four sites in two repos.
Each copy is a place the value can silently drift. This module is the single
owner: consumers call a getter here instead of rebuilding Path.home() / ....
Two properties make adoption safe, and they are the whole point:
- Production keeps the caller's default. Without an active profile, every
getter returns the caller's current constant byte-for-byte when no value is
configured. Under a non-production profile, the default branch is instead
rooted below
~/.axm/profiles/<profile>/so state is isolated by default. Configured environment and file values keep their higher precedence. - Normalisation happens here, once. :func:
get_pathturns the resolver's raw value (an env var is always astr; a TOML value keeps its parsed type) into an expanded, resolved :class:~pathlib.Path. If each consumer did its ownPath(...)/expanduser(), the duplication would simply move up one level instead of disappearing.
Precedence is the resolver's own env > file > default, so an existing
override such as AXM_PATHS_WARDEN_SOCKET keeps working unchanged.
Security: a configured path is passed through
:func:axm_config.home.resolve_safe, which refuses anything resolving inside a
git checkout -- runtime state (session traces, quality reports, a socket) must
never land in a repo where it can be committed. The default is never
checked: it is code, not user input, and validating it would turn a
working installation into a failing one, breaking the additive guarantee above.
get_bool(key, default, *, namespace=PATHS_NAMESPACE)
Resolve a configured boolean while preserving an untouched default.
Source code in packages/axm-config/src/axm_config/paths.py
get_int(key, default, *, namespace=PATHS_NAMESPACE, env_aliases=())
Resolve a configured integer while preserving an untouched default.
Source code in packages/axm-config/src/axm_config/paths.py
get_path(key, default, *, namespace=PATHS_NAMESPACE, profile=None)
Resolve key in [paths] as a normalised :class:~pathlib.Path.
default is the caller's existing constant. In production it is returned
unchanged when nothing is configured. For the state paths registered in
_PROFILE_RELATIVE_PATHS, a non-production profile replaces that fallback
with a path rooted below :func:profile_root.
A configured value (env or file) is expanded (~), resolved to an
absolute path, and refused via :func:resolve_safe if it sits inside a git
checkout. Raises :class:ConfigError on a non-string/non-path value or an
in-repo path, so a bad config fails loudly at the boundary rather than
writing runtime state somewhere unintended.
Source code in packages/axm-config/src/axm_config/paths.py
get_str(key, default, *, namespace=PATHS_NAMESPACE)
Resolve a configured value as text while preserving an untouched default.
Source code in packages/axm-config/src/axm_config/paths.py
| Python | |
|---|---|
inference_base_url()
Return the configured inference engine address unchanged.
inference_model()
Return the configured inference model identifier unchanged.
inference_origin()
Return the configured inference provider origin.
Source code in packages/axm-config/src/axm_config/paths.py
protocols_dir(*, default=None, profile=None)
The legacy YAML protocol directory read by the engine and briefings.
Source code in packages/axm-config/src/axm_config/paths.py
quality_dir(*, default=None, profile=None)
The quality-trace directory written by axm-audit / axm-init.
Source code in packages/axm-config/src/axm_config/paths.py
service_port(service, *, profile=None)
The TCP port service listens on for the active state profile.
A listening point is a profile-owned resource exactly like the state roots above, so the decision belongs here instead of being pushed onto every caller as "configure a port or I refuse to start".
Production is frozen: with nothing configured the adopted default is
returned unchanged, so an existing installation reconfigures nothing. Under
a non-production profile the fallback is derived from the profile name, so
two installations on one machine do not fight over a port. Either way the
value is only the default handed to :func:get_int, which keeps the
resolver's env > file > default precedence intact.
A service may also carry historical environment variables, registered in
_SERVICE_PORT_ENV_ALIASES: they are consulted after the derived name
and before any configured value, so an installation still exporting the
legacy variable keeps binding the port it always bound.
profile names the profile the question is asked for, exactly like
:func:get_path and the state roots above: None means the active
profile, and naming another one is a pure read -- it neither consults nor
mutates the process-wide profile selection.
Raises :class:ConfigError naming service when it is not registered,
before any resolution is attempted.
Source code in packages/axm-config/src/axm_config/paths.py
sessions_root(*, default=None, profile=None)
The loom sessions root -- where runs write manifests, traces, artifacts.
Declared identically in axm-loom, axm-knowledge and axm-orison
(whose docstrings already say they mirror loom); this is the seam those
three delegate to. In production, default overrides the built-in
~/axm/sessions for callers retaining their migration constant; an
active non-production profile instead owns the unconfigured state root.
Source code in packages/axm-config/src/axm_config/paths.py
tickets_db(*, default=None, profile=None)
Return the ticket database path for the active state profile.
Source code in packages/axm-config/src/axm_config/paths.py
warden_autostart(*, default=None)
Return whether consumers should start the warden automatically.
Source code in packages/axm-config/src/axm_config/paths.py
warden_binary_path(*, default=None)
Return the configured or interpreter-relative warden executable path.
Source code in packages/axm-config/src/axm_config/paths.py
warden_log_path(*, default=None, profile=None)
Return the configured or AXM-home-relative warden log path.
Source code in packages/axm-config/src/axm_config/paths.py
warden_max_concurrent(*, default=None)
Return the strictly positive warden concurrency limit.
Source code in packages/axm-config/src/axm_config/paths.py
warden_mode(*, default=None)
Return the configured warden execution mode.
Source code in packages/axm-config/src/axm_config/paths.py
warden_park_threshold(*, default=None)
Return the minimum number of failed generations before parking.
Source code in packages/axm-config/src/axm_config/paths.py
warden_socket(*, default=None, profile=None)
The warden control-plane socket bound by axm-warden serve.
Note the precedence a consumer must preserve. Callers layer an explicit
argument on top of this (--socket on the CLI, the socket= kwarg on
the tools), which outranks everything here; this function covers only the
env > file > default tail below it. Collapsing the explicit argument
into the config lookup would silently change behaviour, so callers keep
their own if socket is not None: return socket guard and delegate the
rest.