refactor(#2455): split hive-agent-mcp into its own bin crate

This commit is contained in:
damocles 2026-07-14 23:45:33 +02:00
commit e7f8254788
15 changed files with 334 additions and 100 deletions

View file

@ -0,0 +1,19 @@
//! Per-agent path resolution for this MCP server. Self-contained (mirrors
//! the sibling helper daemons' own `paths.rs`) so the bin does not link the
//! harness lib just to resolve the agent's state dir. Only the one helper
//! the MCP server needs lives here.
use std::path::PathBuf;
/// Durable state directory for the current agent. Reads `HYPERHIVE_STATE_DIR`
/// first (always set by the meta flake to `/agents/{label}/state`); falls back
/// to the same pattern derived from `HIVE_LABEL` for dev/test environments
/// where the env var may not be set.
#[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"))
}