Skip to content

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

feat(rpc): install JSON-RPC server in app and CLI before core dispatch

Steven Enamakel178db5fef04f
diff --git a/crates/openhuman-app/Cargo.toml b/crates/openhuman-app/Cargo.toml
index 4c6507fc85..44513252e5 100644
--- a/crates/openhuman-app/Cargo.toml
+++ b/crates/openhuman-app/Cargo.toml
@@ -34,7 +34,7 @@ tauri-build = { version = "2", features = [] }
serde_json = "1"
[dependencies]
-openhuman-rpc = { path = "../openhuman-rpc", features = ["http-client"] }
+openhuman-rpc = { path = "../openhuman-rpc", default-features = false, features = ["http-client", "server"] }
# The desktop session owner (login-token exchange, /auth/me, current-user
# cache) and the SDK-backed backend transport the core needs installed at
# boot. `default-features = false`: the shell controls every product gate
diff --git a/crates/openhuman-app/src/lib.rs b/crates/openhuman-app/src/lib.rs
index 994afdeea8..8c31e25f9c 100644
--- a/crates/openhuman-app/src/lib.rs
+++ b/crates/openhuman-app/src/lib.rs
@@ -3639,7 +3639,9 @@ pub fn run_core_from_args(args: &[String]) -> Result<(), String> {
// Core lives in-process: dispatch directly through the linked `openhuman_core`
// library instead of shelling out to a separate binary. The Tauri main()
// routes `OpenHuman core <args>` here so users can still drive the core CLI
- // from the bundled app.
+ // from the bundled app. `run` / `serve` start the JSON-RPC server from
+ // `openhuman-rpc`, which the core cannot depend on, so install it first.
+ openhuman_rpc::server::install_cli_server();
openhuman_core::run_core_from_args(args).map_err(|e| format!("{e:#}"))
}
diff --git a/crates/openhuman-cli/Cargo.toml b/crates/openhuman-cli/Cargo.toml
index 1f6f15ce9d..f80ed6c445 100644
--- a/crates/openhuman-cli/Cargo.toml
+++ b/crates/openhuman-cli/Cargo.toml
@@ -343,7 +343,7 @@ path = "../../examples/run_memory_reconcile.rs"
openhuman-core = { path = "../openhuman-core", package = "openhuman", default-features = false }
openhuman-embed = { path = "../openhuman-embed", default-features = false }
openhuman-tinyhumans = { path = "../openhuman-tinyhumans", default-features = false }
-openhuman-rpc.workspace = true
+openhuman-rpc = { workspace = true, features = ["server"] }
anyhow = "1.0"
async-trait = "0.1"
axum = { version = "0.8", default-features = false, features = ["http1", "json", "tokio", "query", "ws", "macros"] }
diff --git a/crates/openhuman-cli/src/main.rs b/crates/openhuman-cli/src/main.rs
index 56702c414f..5c41692cf3 100644
--- a/crates/openhuman-cli/src/main.rs
+++ b/crates/openhuman-cli/src/main.rs
@@ -281,6 +281,10 @@ fn main() {
std::process::exit(1);
}
+ // `run` / `serve` start the JSON-RPC server from `openhuman-rpc`, which the
+ // core cannot depend on; hand it the launcher before dispatching.
+ openhuman_rpc::server::install_cli_server();
+
// Delegate to the core library to handle the command.
if let Err(err) = openhuman_core::run_core_from_args(&args) {
eprintln!("{err}");