//! The per-agent paths this daemon needs. use std::path::PathBuf; /// The harness-served in-agent todo socket (loose-ends v2). This daemon /// pushes exactly one todo per subagent lifetime — the completion summary, /// once its background turn finishes. Override via `HIVE_AGENT_SOCKET`; /// same resolution as `hive-bash-mcp`'s own `paths::agent_socket`. #[must_use] pub fn agent_socket() -> PathBuf { std::env::var_os("HIVE_AGENT_SOCKET").map_or_else( || PathBuf::from(hive_agent_sock::DEFAULT_AGENT_SOCKET), PathBuf::from, ) } /// Durable state directory for the current agent. Same resolution as /// `hive-agent`'s own `paths::state_dir` — reads `HYPERHIVE_STATE_DIR` /// (always injected via `systemd.globalEnvironment` by the meta flake), /// falling back to the `HIVE_LABEL`-derived pattern for dev/test /// environments where the env var may not be set. Copied rather than shared /// with `hive-agent` (a binary crate with no lib target) — a five-line env /// read isn't worth a crate dependency to dedupe. #[must_use] pub fn state_dir() -> PathBuf { if let Some(p) = std::env::var_os("HYPERHIVE_STATE_DIR") { return PathBuf::from(p); } let label = std::env::var("HIVE_LABEL").unwrap_or_default(); PathBuf::from(format!("/agents/{label}/state")) } /// Harness-internal scratch dir this daemon writes its own generated /// subagent `--mcp-config` file into (see `crate::mcp_config`). Delegates to /// the shared resolver so this and `hive-agent`'s own harness dir always /// agree on the same path. #[must_use] pub fn harness_dir() -> PathBuf { hive_agent_sock::paths::harness_dir() }