Skip to content

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

fix(cli): remove duplicate server start message

Steven Enamakel6a269ea360cd
diff --git a/crates/openhuman-rpc/src/server/cli.rs b/crates/openhuman-rpc/src/server/cli.rs
new file mode 100644
index 0000000000..6c33395773
--- /dev/null
+++ b/crates/openhuman-rpc/src/server/cli.rs
@@ -0,0 +1,36 @@
+//! The server behind `openhuman-core run` / `serve`.
+
+use std::future::Future;
+use std::pin::Pin;
+
+use openhuman_core::core::server_launcher::{install_server_launcher, ServeRequest};
+
+/// Install this crate's server as the one the core CLI's `run` / `serve`
+/// subcommands start. Call once, before
+/// [`run_core_from_args`](openhuman_core::run_core_from_args); later calls are
+/// no-ops.
+pub fn install_cli_server() {
+ install_server_launcher(launch);
+}
+
+fn launch(request: ServeRequest) -> Pin<Box<dyn Future<Output = anyhow::Result<()>> + Send>> {
+ Box::pin(async move {
+ log::debug!(
+ "[rpc:cli] starting server host={:?} port={:?} socketio={} headless_api={}",
+ request.host,
+ request.port,
+ request.socketio_enabled,
+ request.headless_api
+ );
+ if request.headless_api {
+ super::run_server_headless(request.host.as_deref(), request.port).await
+ } else {
+ super::run_server(
+ request.host.as_deref(),
+ request.port,
+ request.socketio_enabled,
+ )
+ .await
+ }
+ })
+}
diff --git a/crates/openhuman-rpc/src/server/mod.rs b/crates/openhuman-rpc/src/server/mod.rs
new file mode 100644
index 0000000000..75bf70dba4
--- /dev/null
+++ b/crates/openhuman-rpc/src/server/mod.rs
@@ -0,0 +1,33 @@
+//! The core's JSON-RPC server.
+//!
+//! | Module | Owns |
+//! |---|---|
+//! | `serve` | [`serve`]: bind the listener for a [`CoreRuntime`](openhuman_core::core::runtime::CoreRuntime) and run until shutdown |
+//! | `shims` | the `run_server*` entry points that build a runtime and serve it |
+//! | `http` | the axum router and one module per route family |
+//! | `auth` | bearer-token route policy over `openhuman_core::core::auth` |
+//! | `classify` | how the `/rpc` handler reports a failed call |
+//! | `socketio` | the Socket.IO live-event bridge and `rpc:request` |
+//! | `dev_connect` | the debug-only `/dev/connect` handoff |
+//! | `cli` | [`install_cli_server`], the launcher behind `openhuman-core run` |
+//!
+//! Dispatch itself is core's
+//! ([`invoke_method`](openhuman_core::core::invoke::invoke_method)); every
+//! transport here resolves a method through it.
+
+mod auth;
+mod classify;
+mod cli;
+mod dev_connect;
+pub(crate) mod http;
+mod serve;
+mod shims;
+mod socketio;
+#[cfg(test)]
+mod testing;
+
+pub use cli::install_cli_server;
+pub use http::{build_core_http_router, rpc_handler};
+pub use serve::{serve, EmbeddedReadySignal};
+pub use shims::{run_server, run_server_embedded, run_server_embedded_with_ready, run_server_headless};
+pub use socketio::publish_companion_state_changed;