refactor(#2626): retire the file-based mcp-loose-ends scanner (todos own it now)
This commit is contained in:
parent
17a9a156c2
commit
a1352376d8
4 changed files with 1 additions and 64 deletions
|
|
@ -1,42 +0,0 @@
|
||||||
//! Generic scanner for MCP loose-end summary files.
|
|
||||||
//!
|
|
||||||
//! External MCP daemons (hive-bash-mcp, hive-matrix-mcp, etc.) write
|
|
||||||
//! JSON files to `$HYPERHIVE_HARNESS_DIR/mcp-loose-ends/<name>.json`.
|
|
||||||
//! Each file contains a JSON array of plain-text summary strings.
|
|
||||||
//!
|
|
||||||
//! The harness reads all files in this directory in `get_loose_ends` to
|
|
||||||
//! surface active background work from any MCP without hardcoding
|
|
||||||
//! per-MCP knowledge here.
|
|
||||||
|
|
||||||
use std::path::PathBuf;
|
|
||||||
|
|
||||||
/// Resolution lives in `hive_sh4re::paths` so the harness + every MCP
|
|
||||||
/// daemon agree on where loose-end summary files are written.
|
|
||||||
fn loose_ends_dir() -> PathBuf {
|
|
||||||
hive_sh4re::paths::mcp_loose_ends_dir()
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Collect all loose-end summary strings published by external MCP daemons.
|
|
||||||
/// Each string is a single line suitable for inclusion in `get_loose_ends`
|
|
||||||
/// output. Returns an empty vec if the directory doesn't exist or is empty.
|
|
||||||
#[must_use]
|
|
||||||
pub fn collect() -> Vec<String> {
|
|
||||||
let Ok(rd) = std::fs::read_dir(loose_ends_dir()) else {
|
|
||||||
return Vec::new();
|
|
||||||
};
|
|
||||||
let mut out = Vec::new();
|
|
||||||
for entry in rd.flatten() {
|
|
||||||
let path = entry.path();
|
|
||||||
if path.extension().and_then(|e| e.to_str()) != Some("json") {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
let Ok(content) = std::fs::read_to_string(&path) else {
|
|
||||||
continue;
|
|
||||||
};
|
|
||||||
let Ok(items) = serde_json::from_str::<Vec<String>>(&content) else {
|
|
||||||
continue;
|
|
||||||
};
|
|
||||||
out.extend(items);
|
|
||||||
}
|
|
||||||
out
|
|
||||||
}
|
|
||||||
|
|
@ -18,7 +18,6 @@ use anyhow::Result;
|
||||||
use clap::Parser;
|
use clap::Parser;
|
||||||
|
|
||||||
mod client;
|
mod client;
|
||||||
mod loose_ends;
|
|
||||||
mod mcp;
|
mod mcp;
|
||||||
mod paths;
|
mod paths;
|
||||||
mod send_allow;
|
mod send_allow;
|
||||||
|
|
|
||||||
|
|
@ -339,20 +339,7 @@ impl AgentServer {
|
||||||
if is_self_query && let Some(todos) = local_todos().await {
|
if is_self_query && let Some(todos) = local_todos().await {
|
||||||
loose_ends.extend(todos);
|
loose_ends.extend(todos);
|
||||||
}
|
}
|
||||||
let mut out = annotate_retries(render_loose_ends(&loose_ends), retries);
|
annotate_retries(render_loose_ends(&loose_ends), retries)
|
||||||
// Append loose-end items published by external MCP daemons
|
|
||||||
// (e.g. active bash tasks from hive-bash-mcp). Generic — no
|
|
||||||
// per-MCP knowledge needed here.
|
|
||||||
let mcp_items = crate::loose_ends::collect();
|
|
||||||
if !mcp_items.is_empty() {
|
|
||||||
use std::fmt::Write as _;
|
|
||||||
let n = mcp_items.len();
|
|
||||||
let _ = write!(out, "\n\n{n} local task(s):");
|
|
||||||
for item in &mcp_items {
|
|
||||||
let _ = write!(out, "\n- {item}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
out
|
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,10 +28,3 @@ pub fn harness_dir() -> PathBuf {
|
||||||
let label = std::env::var("HIVE_LABEL").unwrap_or_default();
|
let label = std::env::var("HIVE_LABEL").unwrap_or_default();
|
||||||
PathBuf::from(format!("/agents/{label}/harness"))
|
PathBuf::from(format!("/agents/{label}/harness"))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Directory where out-of-process MCP daemons write loose-end summary
|
|
||||||
/// files (`<name>.json`) for the harness to scan in `get_loose_ends`.
|
|
||||||
#[must_use]
|
|
||||||
pub fn mcp_loose_ends_dir() -> PathBuf {
|
|
||||||
harness_dir().join("mcp-loose-ends")
|
|
||||||
}
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue