Skip to content

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

refactor(core): adjust function signatures and registry handling

Steven Enamakelf220e43397b7
diff --git a/crates/openhuman-core/src/agent/orchestration/subagent_sessions/ops.rs b/crates/openhuman-core/src/agent/orchestration/subagent_sessions/ops.rs
index c6519c8a59..5b8e52c9c0 100644
--- a/crates/openhuman-core/src/agent/orchestration/subagent_sessions/ops.rs
+++ b/crates/openhuman-core/src/agent/orchestration/subagent_sessions/ops.rs
@@ -304,7 +304,7 @@ pub fn reuse_decision(reuse: Option<&DurableSubagentSession>, force_fresh: bool)
fn update_session<F>(
store: &SubagentSessionStore,
subagent_session_id: &str,
- mut update: F,
+ update: F,
) -> Result<bool, String>
where
F: FnMut(&mut DurableSubagentSession, String) + Send + 'static,
@@ -324,7 +324,7 @@ fn update_session_for_task<F>(
store: &SubagentSessionStore,
subagent_session_id: &str,
task_id: &str,
- update: F,
+ mut update: F,
) -> Result<bool, String>
where
F: FnMut(&mut DurableSubagentSession, String) + Send + 'static,
diff --git a/crates/openhuman-core/src/flows/caps_host/service.rs b/crates/openhuman-core/src/flows/caps_host/service.rs
index 4536a07a17..de949d5adc 100644
--- a/crates/openhuman-core/src/flows/caps_host/service.rs
+++ b/crates/openhuman-core/src/flows/caps_host/service.rs
@@ -276,7 +276,7 @@ impl CapsHostService {
crate::agent_registry::host_definition::AgentDefinitionRegistry::current();
registry
.and_then(|registry| registry.get(&id).cloned())
- .map(to_bus_agent_definition)
+ .map(|definition| to_bus_agent_definition(&definition))
.transpose()
})
.await
@@ -294,15 +294,14 @@ impl CapsHostService {
.map_err(|error| error.to_string())?;
let registry =
crate::agent_registry::host_definition::AgentDefinitionRegistry::current();
- registry
- .map(|registry| {
- registry
- .list()
- .into_iter()
- .map(to_bus_agent_definition)
- .collect()
- })
- .ok_or_else(|| "agent definition registry is unavailable".to_owned())
+ match registry {
+ Some(registry) => registry
+ .list()
+ .into_iter()
+ .map(to_bus_agent_definition)
+ .collect(),
+ None => Err("agent definition registry is unavailable".to_owned()),
+ }
})
.await
.map_err(bus_error)