Skip to content

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

refactor(server): drop embedded shims from standalone entry points

Steven Enamakel63c745107099
diff --git a/crates/openhuman-rpc/src/server/mod.rs b/crates/openhuman-rpc/src/server/mod.rs
index 3367fd0423..5067cfaf67 100644
--- a/crates/openhuman-rpc/src/server/mod.rs
+++ b/crates/openhuman-rpc/src/server/mod.rs
@@ -9,7 +9,7 @@
//! | `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` |
+//! | `cli` | the launcher behind `openhuman-core run` |
//!
//! Dispatch itself is core's
//! (`invoke_method`); every
@@ -27,11 +27,7 @@ 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,
- run_server_saas,
-};
+pub use shims::{run_server, run_server_headless, run_server_saas};
pub use socketio::publish_companion_state_changed;
diff --git a/crates/openhuman-rpc/src/server/shims.rs b/crates/openhuman-rpc/src/server/shims.rs
index ab1907dda5..065ec6e237 100644
--- a/crates/openhuman-rpc/src/server/shims.rs
+++ b/crates/openhuman-rpc/src/server/shims.rs
@@ -1,21 +1,17 @@
-//! Server entry points kept for the hosts that predate the shared host boot
-//! ([`crate::host`]).
+//! Standalone server entry points, and the build-and-serve step the shared
+//! host boot ([`crate::host`]) runs.
//!
-//! Each `run_server*` function is a thin shim: it starts from the embed host
-//! preset that matches the caller ([`RuntimeBuilder::desktop`] for the
-//! embedded desktop core, [`RuntimeBuilder::cli`] for a standalone server),
-//! applies the caller's services, bearer and listener, then builds the
-//! runtime and [`serve`](super::serve::serve)s it.
-//!
-//! The presets carry exactly what these shims used to hand `CoreBuilder` by
-//! hand: every domain family, the `embedded_core` → `HostKind` mapping
-//! (embedded == Tauri shell; standalone splits CLI / Docker via
+//! Each `run_server*` function is a thin shim over the [`RuntimeBuilder::cli`]
+//! preset: it applies the caller's services and listener, then builds the
+//! runtime and [`serve`](super::serve::serve)s it. The preset carries every
+//! domain family, the standalone `HostKind` (CLI or Docker, via
//! `HostKind::detect_standalone`), the `OPENHUMAN_E2E` tool-group switch, and
//! no supplied config (the core discovers the operator's install).
//!
-//! None of these connect the TinyHumans backend: the hosts calling them
-//! install it themselves (`openhuman_tinyhumans::install`). [`crate::host`]
-//! is the entry that connects it.
+//! None of these connect the TinyHumans backend: [`crate::host`] is the entry
+//! that does (`desktop_builder` / `serve_desktop` for the embedded desktop
+//! core, `cli` for `openhuman-core`). A caller of a bare `run_server*` installs
+//! the transport itself (`openhuman_tinyhumans::install`).
use std::sync::Arc;
@@ -49,13 +45,13 @@ pub async fn run_server(
port: Option<u16>,
socketio_enabled: bool,
) -> anyhow::Result<()> {
- run_server_inner(host, port, socketio_enabled, false, None, None, None).await
+ run_server_inner(host, port, socketio_enabled).await
}
/// Runs the request/response-only HTTP API without detached background jobs.
pub async fn run_server_headless(host: Option<&str>, port: Option<u16>) -> anyhow::Result<()> {
let services = ServiceSet::headless_api();
- run_server_with_services(host, port, services, false, None, None, None).await
+ run_server_with_services(host, port, services).await
}
/// Runs a SaaS core: many users behind a trusted gateway, booted from the
@@ -76,93 +72,24 @@ pub async fn run_server_saas(
super::serve::serve(&runtime, None, None).await
}
-/// Like [`run_server`] but marks the instance as embedded.
-pub async fn run_server_embedded(
- host: Option<&str>,
- port: Option<u16>,
- socketio_enabled: bool,
- shutdown_token: CancellationToken,
-) -> anyhow::Result<()> {
- run_server_inner(
- host,
- port,
- socketio_enabled,
- true,
- Some(shutdown_token),
- None,
- None,
- )
- .await
-}
-
-/// Embedded entrypoint with an explicit readiness callback.
-///
-/// When the caller already holds the per-launch RPC bearer in memory (the
-/// Tauri shell now that the core runs in-process — PR #1061), it should
-/// pass `Some(token)` so the embedded server can seed its auth subsystem
-/// via `openhuman::core::auth::init_rpc_token_with_value` without ever
-/// reading `OPENHUMAN_CORE_TOKEN` from the process environment. Passing
-/// `None` preserves the env-as-config fallback (CLI / docker / cloud).
-pub async fn run_server_embedded_with_ready(
- host: Option<&str>,
- port: Option<u16>,
- socketio_enabled: bool,
- shutdown_token: CancellationToken,
- ready_tx: tokio::sync::oneshot::Sender<EmbeddedReadySignal>,
- rpc_token: Option<Arc<String>>,
-) -> anyhow::Result<()> {
- run_server_inner(
- host,
- port,
- socketio_enabled,
- true,
- Some(shutdown_token),
- Some(ready_tx),
- rpc_token,
- )
- .await
-}
-
/// Internal server entrypoint.
async fn run_server_inner(
host: Option<&str>,
port: Option<u16>,
socketio_enabled: bool,
- embedded_core: bool,
- shutdown_token: Option<CancellationToken>,
- ready_tx: Option<tokio::sync::oneshot::Sender<EmbeddedReadySignal>>,
- rpc_token: Option<Arc<String>>,
) -> anyhow::Result<()> {
let mut services = ServiceSet::desktop();
services.socketio = socketio_enabled;
- run_server_with_services(
- host,
- port,
- services,
- embedded_core,
- shutdown_token,
- ready_tx,
- rpc_token,
- )
- .await
+ run_server_with_services(host, port, services).await
}
async fn run_server_with_services(
host: Option<&str>,
port: Option<u16>,
services: ServiceSet,
- embedded_core: bool,
- shutdown_token: Option<CancellationToken>,
- ready_tx: Option<tokio::sync::oneshot::Sender<EmbeddedReadySignal>>,
- rpc_token: Option<Arc<String>>,
) -> anyhow::Result<()> {
- let preset = if embedded_core {
- RuntimeBuilder::desktop()
- } else {
- RuntimeBuilder::cli()
- };
- let builder = server_builder(preset, services, host, port, rpc_token);
- build_and_serve(builder, ready_tx, shutdown_token).await
+ let builder = server_builder(RuntimeBuilder::cli(), services, host, port, None);
+ build_and_serve(builder, None, None).await
}
/// Apply a server's services, bearer and listener to a host preset.
diff --git a/crates/openhuman-rpc/src/server/shims_tests.rs b/crates/openhuman-rpc/src/server/shims_tests.rs
index 4667a2f7c2..0549f23c30 100644
--- a/crates/openhuman-rpc/src/server/shims_tests.rs
+++ b/crates/openhuman-rpc/src/server/shims_tests.rs
@@ -81,10 +81,6 @@ fn server_shim_refuses_public_bind_without_operator_token() {
Some("0.0.0.0"),
Some(0),
services,
- true,
- None,
- None,
- None,
)
.await
.expect_err("public bind must require an operator-supplied token");