refactor(#1450): lift shared harness-path resolution into hive-sh4re
This commit is contained in:
parent
789ecd86f6
commit
41c4682f7a
7 changed files with 48 additions and 46 deletions
|
|
@ -20,22 +20,13 @@ pub fn daemon_socket() -> PathBuf {
|
|||
.map_or_else(|| PathBuf::from(DEFAULT_DAEMON_SOCKET), PathBuf::from)
|
||||
}
|
||||
|
||||
/// Base harness directory. Uses `HYPERHIVE_HARNESS_DIR` if set (injected
|
||||
/// by the hive-c0re meta flake after the harness/state split); falls
|
||||
/// back to a `harness/` sibling of the state dir for pre-split
|
||||
/// deployments. Shared by every per-agent harness artifact path below.
|
||||
/// Base harness directory. Shared resolution lives in
|
||||
/// `hive_sh4re::paths::harness_dir` so the harness + every MCP daemon
|
||||
/// agree on the layout. Re-exported here as the base for the per-agent
|
||||
/// artifact paths below.
|
||||
#[must_use]
|
||||
pub fn harness_dir() -> PathBuf {
|
||||
if let Some(p) = std::env::var_os("HYPERHIVE_HARNESS_DIR") {
|
||||
PathBuf::from(p)
|
||||
} else {
|
||||
// Pre-split fallback: derive harness/ as a sibling of state/.
|
||||
let state = std::env::var("HYPERHIVE_STATE_DIR").unwrap_or_default();
|
||||
let state_path = PathBuf::from(&state);
|
||||
state_path
|
||||
.parent()
|
||||
.map_or_else(|| PathBuf::from(state), |p| p.join("harness"))
|
||||
}
|
||||
hive_sh4re::paths::harness_dir()
|
||||
}
|
||||
|
||||
/// Base directory for task files.
|
||||
|
|
@ -64,13 +55,9 @@ pub fn hyperhive_socket() -> PathBuf {
|
|||
/// Directory where MCP daemons write loose-end summary files for the harness.
|
||||
/// Each daemon writes `<name>.json` here; the harness scans the dir in
|
||||
/// `get_loose_ends` to surface active work from all MCPs generically.
|
||||
///
|
||||
/// NOTE: the base-dir resolution logic here is intentionally mirrored in
|
||||
/// `hive-ag3nt/src/mcp_loose_ends.rs::loose_ends_dir()`. They can't share
|
||||
/// code across crates — keep them in sync if the fallback logic changes.
|
||||
#[must_use]
|
||||
pub fn mcp_loose_ends_dir() -> PathBuf {
|
||||
harness_dir().join("mcp-loose-ends")
|
||||
hive_sh4re::paths::mcp_loose_ends_dir()
|
||||
}
|
||||
|
||||
/// Full path for a task's JSON metadata file.
|
||||
|
|
|
|||
Loading…
Reference in a new issue