Skip to content

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

refactor(core): use shared helpers for controller registration and json conversion

Steven Enamakel35727910f8fc
diff --git a/crates/openhuman-core/src/core/all.rs b/crates/openhuman-core/src/core/all.rs
index 97e169a3e3..ed43677bea 100644
--- a/crates/openhuman-core/src/core/all.rs
+++ b/crates/openhuman-core/src/core/all.rs
@@ -326,7 +326,7 @@ fn build_registered_controllers() -> Vec<GroupedController> {
DomainGroup::Desktop,
crate::desktop::dashboard::all_dashboard_registered_controllers(),
);
- push(
+ push_entries(
&mut controllers,
DomainGroup::Mcp,
crate::mcp::all_controller_entries(),
@@ -693,7 +693,7 @@ fn build_internal_only_controllers() -> Vec<GroupedController> {
// compiled into `modules::registry`, so this namespace can start a module
// the build already trusts and nothing else.
#[cfg(feature = "modules")]
- push(
+ push_entries(
&mut controllers,
DomainGroup::Modules,
crate::modules::schemas::all_controller_entries(),
diff --git a/crates/openhuman-core/src/mcp/registry/schemas/mod.rs b/crates/openhuman-core/src/mcp/registry/schemas/mod.rs
index 48296bf7e2..68d06ad02b 100644
--- a/crates/openhuman-core/src/mcp/registry/schemas/mod.rs
+++ b/crates/openhuman-core/src/mcp/registry/schemas/mod.rs
@@ -31,7 +31,9 @@ fn parse_registry_get_params(params: Map<String, serde_json::Value>) -> Result<S
fn run_registry_get(_ctx: DispatchCtx, config: Config, qualified_name: String) -> ControllerFuture {
Box::pin(async move {
- to_json(crate::mcp::registry::ops::mcp_clients_registry_get(&config, qualified_name).await?)
+ params::to_json(
+ crate::mcp::registry::ops::mcp_clients_registry_get(&config, qualified_name).await?,
+ )
})
}
@@ -44,10 +46,6 @@ pub(crate) fn registry_get_controller_entry() -> ControllerEntry {
))
}
-fn to_json(value: impl serde::Serialize) -> Result<serde_json::Value, String> {
- serde_json::to_value(value).map_err(|error| error.to_string())
-}
-
// Test-only bridges: `schemas_tests.rs` (kept as-is; not part of the unsplit
// batch) reaches these through `use super::*`, mirroring the flat scope it
// had when `include!` spliced everything into one file.