Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

feat(mcp): add agent_close_pending host helper

Steven Enamakelfe14483104b4
diff --git a/crates/openhuman-core/src/mcp/host.rs b/crates/openhuman-core/src/mcp/host.rs
index 5cd5725458..b187cf72de 100644
--- a/crates/openhuman-core/src/mcp/host.rs
+++ b/crates/openhuman-core/src/mcp/host.rs
@@ -50,6 +50,14 @@ pub fn schedule_agent_close(workspace_dir: &std::path::Path, agent_id: &str) {
);
}
+/// Whether a cached agent client still awaits module cleanup acknowledgment.
+#[cfg(feature = "mcp")]
+pub fn agent_close_pending(workspace_dir: &std::path::Path, agent_id: &str) -> bool {
+ crate::mcp::module_client::McpConfiguredClient::agent_close_pending(
+ &workspace_dir.join("agents").join(agent_id),
+ )
+}
+
/// Whether a prior agent-scoped module close is still pending acknowledgment.
#[cfg(feature = "mcp")]
pub fn agent_close_pending(workspace_dir: &std::path::Path, agent_id: &str) -> bool {
@@ -68,6 +76,12 @@ pub async fn close_agent(_workspace_dir: &std::path::Path, _agent_id: &str) -> b
#[cfg(not(feature = "mcp"))]
pub fn schedule_agent_close(_workspace_dir: &std::path::Path, _agent_id: &str) {}
+/// No agent-scoped module cleanup is pending when MCP is disabled.
+#[cfg(not(feature = "mcp"))]
+pub fn agent_close_pending(_workspace_dir: &std::path::Path, _agent_id: &str) -> bool {
+ false
+}
+
/// No agent-scoped module close is pending when MCP is disabled.
#[cfg(not(feature = "mcp"))]
pub fn agent_close_pending(_workspace_dir: &std::path::Path, _agent_id: &str) -> bool {