The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
refactor(session_host): group mcp tool state into a catalog struct
Steven Enamakelebf7163ed339
diff --git a/crates/openhuman-core/src/agent/session_host/prelude_integrations.rs b/crates/openhuman-core/src/agent/session_host/prelude_integrations.rsindex 3ad76c9a71..8e911e15dc 100644--- a/crates/openhuman-core/src/agent/session_host/prelude_integrations.rs+++ b/crates/openhuman-core/src/agent/session_host/prelude_integrations.rs@@ -9,6 +9,15 @@ use tinyagents_runtime::ToolSnapshot;use super::OpenHumanTurnPrelude;+/// Module-projected catalogs and the names frozen in the resumed transcript.+#[cfg(feature = "mcp")]+#[derive(Default)]+pub(super) struct McpToolCatalog {+ pub(super) connected: Vec<tinymcp_bus::McpToolPresentation>,+ pub(super) configured: Vec<tinymcp_bus::McpToolPresentation>,+ pub(super) recorded_names: std::collections::HashSet<String>,+}+impl OpenHumanTurnPrelude {/// The session's own definition, else the catalogue's entry for its id.pub(super) fn session_definition(@@ -67,7 +76,7 @@ impl OpenHumanTurnPrelude {// knew under the pre-readable hashed name keeps resolving.#[cfg(feature = "mcp")]{- mutable.recorded_mcp_tool_names = recorded+ mutable.mcp_tools.recorded_names = recorded.specs().iter().filter(|spec| spec.name.starts_with("mcp_"))@@ -193,7 +202,8 @@ impl OpenHumanTurnPrelude {self.mutable.lock().unwrap_or_else(std::sync::PoisonError::into_inner)- .connected_mcp_tools+ .mcp_tools+ .connected.clear();return;}@@ -237,7 +247,8 @@ impl OpenHumanTurnPrelude {self.mutable.lock().unwrap_or_else(std::sync::PoisonError::into_inner)- .connected_mcp_tools = prepared;+ .mcp_tools+ .connected = prepared;}/// Refreshes configured static-server declarations from TinyMCP's@@ -249,7 +260,8 @@ impl OpenHumanTurnPrelude {self.mutable.lock().unwrap_or_else(std::sync::PoisonError::into_inner)- .configured_mcp_tools+ .mcp_tools+ .configured.clear();return;};@@ -268,7 +280,8 @@ impl OpenHumanTurnPrelude {self.mutable.lock().unwrap_or_else(std::sync::PoisonError::into_inner)- .configured_mcp_tools = presentations;+ .mcp_tools+ .configured = presentations;}/// Construct searchable MCP actions from the workspace's current snapshot.@@ -295,8 +308,8 @@ impl OpenHumanTurnPrelude {.lock().unwrap_or_else(std::sync::PoisonError::into_inner);(- mutable.connected_mcp_tools.clone(),- mutable.recorded_mcp_tool_names.clone(),+ mutable.mcp_tools.connected.clone(),+ mutable.mcp_tools.recorded_names.clone(),)};crate::mcp::registry::action_tool::deferred_connected_tools_with_legacy(@@ -316,7 +329,8 @@ impl OpenHumanTurnPrelude {.mutable.lock().unwrap_or_else(std::sync::PoisonError::into_inner)- .configured_mcp_tools+ .mcp_tools+ .configured.clone();let security = Arc::new(crate::security::SecurityPolicy::from_config(&config.autonomy,diff --git a/crates/openhuman-core/src/agent/session_host/runtime_session.rs b/crates/openhuman-core/src/agent/session_host/runtime_session.rsindex a4fb5e8661..02328439d0 100644--- a/crates/openhuman-core/src/agent/session_host/runtime_session.rs+++ b/crates/openhuman-core/src/agent/session_host/runtime_session.rs@@ -148,18 +148,9 @@ struct OpenHumanTurnPreludeMutable {pending_integration_announcement: Vec<String>,announced_mcp_servers: std::collections::HashSet<String>,pending_mcp_announcement: Vec<String>,- /// Live MCP tool definitions for this workspace, refreshed before each- /// turn so disconnects remove their deferred executors immediately.+ /// Current catalogs and frozen names retained by the module tool adapter.#[cfg(feature = "mcp")]- connected_mcp_tools: Vec<tinymcp_bus::McpToolPresentation>,- /// Configured static MCP tool declarations fetched through TinyMCP's- /// owner cache and refreshed with the connected-server catalog.- #[cfg(feature = "mcp")]- configured_mcp_tools: Vec<tinymcp_bus::McpToolPresentation>,- /// `mcp_*` tool names a resumed thread was sent, so a tool recorded under- /// its pre-readable hashed name is restored under that name too.- #[cfg(feature = "mcp")]- recorded_mcp_tool_names: std::collections::HashSet<String>,+ mcp_tools: prelude_integrations::McpToolCatalog,announced_skills: std::collections::HashSet<String>,pending_skill_announcement: Vec<String>,pending_skill_retraction: Vec<String>,@@ -864,11 +855,7 @@ impl OpenHumanSessionHost {announced_mcp_servers: self.announced_mcp_servers.clone(),pending_mcp_announcement: self.pending_mcp_announcement.clone(),#[cfg(feature = "mcp")]- connected_mcp_tools: Vec::new(),- #[cfg(feature = "mcp")]- configured_mcp_tools: Vec::new(),- #[cfg(feature = "mcp")]- recorded_mcp_tool_names: std::collections::HashSet::new(),+ mcp_tools: prelude_integrations::McpToolCatalog::default(),announced_skills: self.announced_skills.clone(),pending_skill_announcement: self.pending_skill_announcement.clone(),pending_skill_retraction: self.pending_skill_retraction.clone(),diff --git a/crates/openhuman-core/src/agent/session_host/runtime_session_tests.rs b/crates/openhuman-core/src/agent/session_host/runtime_session_tests.rsindex 4e2d93d909..5adde6a4fd 100644--- a/crates/openhuman-core/src/agent/session_host/runtime_session_tests.rs+++ b/crates/openhuman-core/src/agent/session_host/runtime_session_tests.rs@@ -216,7 +216,8 @@ fn connected_mcp_actions_enter_search_and_leave_on_disconnect() {.mutable.lock().expect("prelude state")- .connected_mcp_tools = vec![tinymcp_bus::McpToolPresentation {+ .mcp_tools+ .connected = vec![tinymcp_bus::McpToolPresentation {name: "mcp_weather_forecast_abc123".into(),legacy_name: "mcp_forecast_legacy".into(),server_id: "server-1".into(),@@ -241,7 +242,8 @@ fn connected_mcp_actions_enter_search_and_leave_on_disconnect() {.mutable.lock().expect("prelude state")- .connected_mcp_tools+ .mcp_tools+ .connected.clear();prelude.refresh_delegation_tool_surface().unwrap();assert!(!prelude.synthesized_tool_names_for_test().contains(&action));@@ -308,7 +310,8 @@ async fn resumed_mcp_snapshot_survives_a_cold_catalog_and_keeps_its_frozen_spec(.mutable.lock().expect("prelude state")- .connected_mcp_tools = vec![tinymcp_bus::McpToolPresentation {+ .mcp_tools+ .connected = vec![tinymcp_bus::McpToolPresentation {name: name.into(),legacy_name: "mcp_forecast_legacy".into(),server_id: "server-1".into(),diff --git a/crates/openhuman-core/src/agent/session_host/runtime_session_tool_surface.rs b/crates/openhuman-core/src/agent/session_host/runtime_session_tool_surface.rsindex 5696016128..d3eab1ff67 100644--- a/crates/openhuman-core/src/agent/session_host/runtime_session_tool_surface.rs+++ b/crates/openhuman-core/src/agent/session_host/runtime_session_tool_surface.rs@@ -26,7 +26,8 @@ impl OpenHumanTurnPrelude {.mutable.lock().unwrap_or_else(std::sync::PoisonError::into_inner)- .configured_mcp_tools+ .mcp_tools+ .configured.is_empty();#[cfg(not(feature = "mcp"))]let has_configured_mcp_tools = false;diff --git a/scripts/ci/check-openhuman-rust-layout.mjs b/scripts/ci/check-openhuman-rust-layout.mjsindex 76e7604482..757d25f11b 100644--- a/scripts/ci/check-openhuman-rust-layout.mjs+++ b/scripts/ci/check-openhuman-rust-layout.mjs@@ -40,7 +40,7 @@ const LEGACY_LIMIT_ENTRIES = [// under the general 750 limit, so it needs no exception at all.// The session-todo integration added transcript metadata construction to// this already-exempt composition seam. Keep its allowance exact.- ["crates/openhuman-core/src/agent/session_host/runtime_session.rs", 1180],+ ["crates/openhuman-core/src/agent/session_host/runtime_session.rs", 1173],// Session-host factory still assembles the product's deliberately coupled// provider, security, memory, tool and prompt policy. Generic session// state moved to tinyagents-runtime; this remaining composition is split in@@ -57,7 +57,7 @@ const LEGACY_LIMIT_ENTRIES = [["crates/openhuman-core/src/core/all_tests.rs", 1475],["crates/openhuman-core/src/core/events.rs", 1789],["crates/openhuman-core/src/core/events_tests.rs", 997],- ["crates/openhuman-core/src/core/observability.rs", 3493],+ ["crates/openhuman-core/src/core/observability.rs", 3492],];const LEGACY_LIMITS = new Map(LEGACY_LIMIT_ENTRIES);