fix: replace bash_tasks.rs with generic mcp_loose_ends scanner

- hive-ag3nt: remove bash_tasks.rs entirely; add mcp_loose_ends.rs that
  scans harness/mcp-loose-ends/*.json generically (no bash knowledge)
- hive-bash-mcp: daemon writes mcp-loose-ends/bash.json on every task
  state transition (pending/running/done/interrupted/timed_out)
- get_loose_ends: reads mcp_loose_ends::collect() instead of bash-specific code
- implements the generic mechanism from #1162
This commit is contained in:
damocles 2026-06-03 17:23:40 +02:00 committed by mara
commit 8731474104
6 changed files with 119 additions and 93 deletions

View file

@ -48,6 +48,24 @@ pub fn hyperhive_socket() -> PathBuf {
.map_or_else(|| PathBuf::from("/run/hive/mcp.sock"), PathBuf::from)
}
/// 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.
#[must_use]
pub fn mcp_loose_ends_dir() -> PathBuf {
let base = if let Some(p) = std::env::var_os("HYPERHIVE_HARNESS_DIR") {
PathBuf::from(p)
} else {
let state = std::env::var("HYPERHIVE_STATE_DIR").unwrap_or_default();
let state_path = PathBuf::from(&state);
state_path
.parent()
.map(|p| p.join("harness"))
.unwrap_or_else(|| PathBuf::from(state))
};
base.join("mcp-loose-ends")
}
/// Full path for a task's JSON metadata file.
#[must_use]
pub fn task_json(id: &str) -> PathBuf {