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): delegate tool visibility reconciliation to tinyagents
Steven Enamakelcbea7ac474e7
diff --git a/crates/openhuman-core/src/agent/session_host/runtime_adapter_tests.rs b/crates/openhuman-core/src/agent/session_host/runtime_adapter_tests.rsindex 8d696565d7..6b693f718c 100644--- a/crates/openhuman-core/src/agent/session_host/runtime_adapter_tests.rs+++ b/crates/openhuman-core/src/agent/session_host/runtime_adapter_tests.rs@@ -10,7 +10,6 @@ use tinyagents_session::port::{InMemorySessionStores, SessionStoreProvider};use tinyagents_session::transcript::TranscriptMeta;use tinyinference_llm::message::Message;-use super::runtime_session::tool_surface::reconcile_synthesized_visibility;use super::runtime_session::{account_committed_turn_against_goal, holistic_last_turn_usage};use super::{OpenHumanSessionHooks, OpenHumanTranscriptCodec};use crate::agent::tinyagents::host::OpenHumanRunContext;@@ -237,18 +236,22 @@ fn explicit_hidden_delegate_stays_hidden_across_dynamic_refreshes() {.into_iter().collect::<std::collections::HashSet<_>>();- reconcile_synthesized_visibility(&mut visible, &prior, &refreshed, false);+ let mut managed = tinyagents_runtime::ManagedToolNames {+ visible,+ ..Default::default()+ };+ managed.refresh_synthesized(&prior, &refreshed, false);assert!(- !visible.contains("delegate_research"),+ !managed.visible.contains("delegate_research"),"an explicitly hidden existing delegate remains hidden after refresh");assert!(- !visible.contains("delegate_drive"),+ !managed.visible.contains("delegate_drive"),"a new connection cannot bypass an explicit visibility restriction");assert!(- !visible.contains("delegate_calendar"),+ !managed.visible.contains("delegate_calendar"),"a revoked connection leaves the surface");}@@ -265,11 +268,15 @@ fn wildcard_delegate_visibility_admits_new_connections_and_removes_revoked_ones(.into_iter().collect::<std::collections::HashSet<_>>();- reconcile_synthesized_visibility(&mut visible, &prior, &refreshed, true);+ let mut managed = tinyagents_runtime::ManagedToolNames {+ visible,+ ..Default::default()+ };+ managed.refresh_synthesized(&prior, &refreshed, true);- assert!(visible.contains("delegate_drive"));- assert!(!visible.contains("delegate_calendar"));- assert!(visible.contains("read_file"));+ assert!(managed.visible.contains("delegate_drive"));+ assert!(!managed.visible.contains("delegate_calendar"));+ assert!(managed.visible.contains("read_file"));}#[tokio::test]diff --git a/crates/openhuman-core/src/agent/session_host/runtime_session/permanent.rs b/crates/openhuman-core/src/agent/session_host/runtime_session/permanent.rsindex ce332bab5b..2ee238531c 100644--- a/crates/openhuman-core/src/agent/session_host/runtime_session/permanent.rs+++ b/crates/openhuman-core/src/agent/session_host/runtime_session/permanent.rs@@ -1,41 +1,8 @@//! Permanent host tool visibility and the managed prompt catalogue.-use super::{OpenHumanTurnPrelude, OpenHumanTurnToolSurface};+use super::OpenHumanTurnPrelude;use tinyagents_runtime::{PrefixSnapshot, TurnPreparation};-pub(super) fn refresh_visibility(- surface: &mut OpenHumanTurnToolSurface,- synthesized: &[Box<dyn tinytools::Tool>],-) {- crate::tools::toolpacks::strip_packed_from_visible(- &mut surface.visible_tool_names,- &surface.agent_definition_name.clone(),- );- // Same split as the session host's `recompute_deferred_tool_names`:- // a `Deferred` synthesised tool leaves the wire and joins the- // searchable set, on a belt that opted into discovery.- if surface.discovery_enabled {- let deferred = tinytools::deferred_set(- surface.tools.as_slice(),- synthesized,- &surface.requested_deferred_tools,- );- surface- .visible_tool_names- .retain(|name| !deferred.contains(name));- surface.deferred_tool_names = deferred;- }- let permanent = surface.permanent_tool_names.clone();- surface.visible_tool_names.extend(permanent.iter().cloned());- let mut seen = std::collections::HashSet::new();- surface- .visible_tool_names- .retain(|name| seen.insert(name.clone()));- surface- .deferred_tool_names- .retain(|name| !permanent.contains(name));-}-impl OpenHumanTurnPrelude {pub(super) fn refresh_permanent_prefix(&self,@@ -57,6 +24,3 @@ impl OpenHumanTurnPrelude {}}-#[cfg(test)]-#[path = "permanent_tests.rs"]-mod tests;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 f83dd9c494..37df795c55 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@@ -115,6 +115,27 @@ impl OpenHumanTurnPrelude {.map(|spec| spec.name.clone()),);}+ crate::tools::toolpacks::strip_packed_from_visible(+ &mut surface.visible_tool_names,+ &surface.agent_definition_name.clone(),+ );+ // OpenHuman decides which product-discovered tools stay searchable+ // under its configured discovery belt. TinyAgents owns the shared+ // visible/deferred/permanent name-set reconciliation above.+ if surface.discovery_enabled {+ let deferred = tinytools::deferred_set(+ surface.tools.as_slice(),+ &synthesized,+ &surface.requested_deferred_tools,+ );+ surface+ .visible_tool_names+ .retain(|name| !deferred.contains(name));+ surface.deferred_tool_names = deferred;+ surface+ .deferred_tool_names+ .retain(|name| !surface.permanent_tool_names.contains(name));+ }let mut specs = surface.durable_tool_specs.iter()