refactor(#2455): split hive-agent-mcp into its own bin crate
This commit is contained in:
parent
59dd3a0aa7
commit
e7f8254788
15 changed files with 334 additions and 100 deletions
19
hive-agent-mcp/src/paths.rs
Normal file
19
hive-agent-mcp/src/paths.rs
Normal 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"))
|
||||
}
|
||||
Loading…
Reference in a new issue