move hive-sh4re's paused_marker() composition into hive-agent

This commit is contained in:
damocles 2026-08-09 18:25:59 +02:00
commit 2024848251
5 changed files with 32 additions and 25 deletions

View file

@ -33,25 +33,9 @@ pub fn harness_dir() -> PathBuf {
/// `hive-priv-sock`, which owns the definition because hive-priv (root) is
/// the component that actually creates and unlinks the marker — hive-c0re
/// runs unprivileged and cannot write to the agent-owned harness dir — and
/// hive-priv deliberately does not depend on this crate. Shared so the
/// in-container resolver below, hive-c0re's host-side one (which builds the
/// same path from `/var/lib/hyperhive/agents/{name}/harness`) and the
/// privileged writer cannot drift apart.
/// hive-priv deliberately does not depend on this crate. Shared so
/// hive-agent's in-container resolver (`hive_agent::paths::paused_marker`),
/// hive-c0re's host-side one (which builds the same path from
/// `/var/lib/hyperhive/agents/{name}/harness`) and the privileged writer
/// cannot drift apart.
pub use hive_priv_sock::PAUSED_MARKER_FILE;
/// Marker file whose presence means "this agent is paused": the harness
/// keeps serving its web UI and MCP daemons but drives no turns, so
/// inbox messages queue up unacked until it's removed.
///
/// It lives in the harness dir rather than `state/` because `state/` is
/// the agent's own scratch space — this is harness control state. The
/// harness dir is bind-mounted from the host, so the marker is the
/// single source of truth for both sides: the harness stats it to gate
/// the turn loop, and hive-c0re stats it to render the paused
/// indicator and creates/removes it for `hivectl pause|resume`. Being a
/// plain file, it survives container restarts — pause is sticky by
/// construction, and works even when the harness isn't running.
#[must_use]
pub fn paused_marker() -> PathBuf {
harness_dir().join(PAUSED_MARKER_FILE)
}