hive-sh4re: make harness_dir the single resolver; hive-ag3nt delegates (#1450)

This commit is contained in:
damocles 2026-06-16 12:36:48 +02:00
commit e8d39ecb8b
2 changed files with 20 additions and 14 deletions

View file

@ -11,18 +11,25 @@ use std::path::PathBuf;
/// Base harness directory for the current agent. 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 `HYPERHIVE_STATE_DIR` for
/// pre-split / dev deployments.
/// split). For pre-split / dev deployments where it isn't set, falls back to
/// a `harness/` sibling of `HYPERHIVE_STATE_DIR`, and finally to
/// `/agents/{HIVE_LABEL}/harness` when neither dir env var is present — the
/// shape the harness derives from its label alone. The label tier subsumes
/// the resolver `hive-ag3nt` previously kept as its own copy, so the
/// resolution now genuinely lives here exactly once.
#[must_use]
pub fn harness_dir() -> PathBuf {
if let Some(p) = std::env::var_os("HYPERHIVE_HARNESS_DIR") {
return PathBuf::from(p);
}
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"))
if let Some(state) = std::env::var_os("HYPERHIVE_STATE_DIR") {
let state_path = PathBuf::from(&state);
if let Some(parent) = state_path.parent() {
return parent.join("harness");
}
}
let label = std::env::var("HIVE_LABEL").unwrap_or_default();
PathBuf::from(format!("/agents/{label}/harness"))
}
/// Directory where out-of-process MCP daemons write loose-end summary