Skip to content

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

refactor(rpc): split http_host and server modules into submodules

Steven Enamakel6cba00259a00
diff --git a/crates/openhuman-rpc/src/http_host/auth.rs b/crates/openhuman-rpc/src/http_host/auth.rs
index 46fbbc0de8..f050be243c 100644
--- a/crates/openhuman-rpc/src/http_host/auth.rs
+++ b/crates/openhuman-rpc/src/http_host/auth.rs
@@ -5,8 +5,8 @@ use rand::RngExt as _;
use crate::http_host::types::HostedDirAuth;
use crate::http_host::LOG_PREFIX;
-use openhuman_core::config;
-use openhuman_core::security::credentials::session_support;
+use crate::core_host::config;
+use crate::core_host::security::credentials::session_support;
// The `Err` is the ready-to-send 401 `Response`; the core crate allows this
// lint crate-wide, and boxing it would only add an allocation per rejection.
diff --git a/crates/openhuman-rpc/src/http_host/http_host_tests.rs b/crates/openhuman-rpc/src/http_host/http_host_tests.rs
index 243fecb607..0422c52893 100644
--- a/crates/openhuman-rpc/src/http_host/http_host_tests.rs
+++ b/crates/openhuman-rpc/src/http_host/http_host_tests.rs
@@ -102,7 +102,7 @@ async fn start_serves_files_with_basic_auth() {
fn register_controllers_adds_http_host_namespace_idempotently() {
crate::http_host::register_controllers().expect("first registration");
crate::http_host::register_controllers().expect("re-registration is a no-op");
- let schemas = openhuman_core::core::all::all_controller_schemas();
+ let schemas = crate::core_host::core::all::all_controller_schemas();
let functions: Vec<&str> = schemas
.iter()
.filter(|s| s.namespace == "http_host")
diff --git a/crates/openhuman-rpc/src/http_host/mod.rs b/crates/openhuman-rpc/src/http_host/mod.rs
index cd46f74326..02b7f2cfa5 100644
--- a/crates/openhuman-rpc/src/http_host/mod.rs
+++ b/crates/openhuman-rpc/src/http_host/mod.rs
@@ -28,7 +28,7 @@ pub use schemas::{
pub(crate) const LOG_PREFIX: &str = "[http_host]";
-use openhuman_core::core::all::{register_controller_extension, ControllerExtension, DomainGroup};
+use crate::core_host::core::all::{register_controller_extension, ControllerExtension, DomainGroup};
const NAMESPACES: &[(&str, &str)] = &[(
"http_host",
diff --git a/crates/openhuman-rpc/src/http_host/ops.rs b/crates/openhuman-rpc/src/http_host/ops.rs
index 6c7fe6208d..8195f7f58b 100644
--- a/crates/openhuman-rpc/src/http_host/ops.rs
+++ b/crates/openhuman-rpc/src/http_host/ops.rs
@@ -273,7 +273,7 @@ pub async fn stop_all_hosted_dir_servers() {
fn register_shutdown_hook_once() {
SHUTDOWN_HOOK_REGISTERED.get_or_init(|| {
- openhuman_core::core::shutdown::register(|| async {
+ crate::core_host::core::shutdown::register(|| async {
stop_all_hosted_dir_servers().await;
});
});
diff --git a/crates/openhuman-rpc/src/http_host/rpc.rs b/crates/openhuman-rpc/src/http_host/rpc.rs
index f61e2f25d9..6e3f863230 100644
--- a/crates/openhuman-rpc/src/http_host/rpc.rs
+++ b/crates/openhuman-rpc/src/http_host/rpc.rs
@@ -5,7 +5,7 @@ use crate::http_host::types::{
HostedDirGetResult, HostedDirListResult, HostedDirLookupParams, HostedDirStartResult,
HostedDirStopResult, StartHostedDirParams,
};
-use openhuman_core::core::Outcome;
+use crate::core_host::core::Outcome;
pub async fn start(params: StartHostedDirParams) -> Result<Outcome<HostedDirStartResult>, String> {
let server = ops::start_hosted_dir_server(params).await?;
diff --git a/crates/openhuman-rpc/src/http_host/schemas.rs b/crates/openhuman-rpc/src/http_host/schemas.rs
index c632081368..2fba913b84 100644
--- a/crates/openhuman-rpc/src/http_host/schemas.rs
+++ b/crates/openhuman-rpc/src/http_host/schemas.rs
@@ -3,8 +3,8 @@
use serde::de::DeserializeOwned;
use serde_json::{Map, Value};
-use openhuman_core::core::all::{ControllerFuture, RegisteredController};
-use openhuman_core::core::{ControllerSchema, FieldSchema, TypeSchema};
+use crate::core_host::core::all::{ControllerFuture, RegisteredController};
+use crate::core_host::core::{ControllerSchema, FieldSchema, TypeSchema};
use super::types::{HostedDirLookupParams, StartHostedDirParams};
diff --git a/crates/openhuman-rpc/src/lib.rs b/crates/openhuman-rpc/src/lib.rs
index 897da54b6d..f46d1a2e3a 100644
--- a/crates/openhuman-rpc/src/lib.rs
+++ b/crates/openhuman-rpc/src/lib.rs
@@ -1,8 +1,8 @@
//! OpenHuman's JSON-RPC protocol, on both sides of the wire.
//!
//! The core owns what a controller *is*: its schema, the
-//! [`Outcome`](openhuman_core::core::Outcome) it returns, and in-process
-//! dispatch ([`openhuman_core::core::invoke::invoke_method`]). This crate owns
+//! [`Outcome`](crate::core_host::core::Outcome) it returns, and in-process
+//! dispatch ([`crate::core_host::core::invoke::invoke_method`]). This crate owns
//! how that is exposed over JSON-RPC 2.0, and sits above the core:
//!
//! - [`RpcRequest`], [`RpcSuccess`], [`RpcFailure`] and [`RpcError`] are the
@@ -40,5 +40,5 @@ pub use envelope::{
decode_response, request_body, RpcError, RpcFailure, RpcRequest, RpcSuccess, JSONRPC_VERSION,
SERVER_ERROR_CODE,
};
-pub use openhuman_core::core::unwrap_rpc;
+pub use crate::core_host::core::unwrap_rpc;
pub use origin::{is_origin_allowed_with_extra, ALLOWED_ORIGINS_ENV};
diff --git a/crates/openhuman-rpc/src/server/auth.rs b/crates/openhuman-rpc/src/server/auth.rs
index 35395ac565..56138ebc8b 100644
--- a/crates/openhuman-rpc/src/server/auth.rs
+++ b/crates/openhuman-rpc/src/server/auth.rs
@@ -1,6 +1,6 @@
//! Bearer-token authentication for the core's HTTP API.
//!
-//! The token itself is owned by [`openhuman_core::core::auth`]; this module is
+//! The token itself is owned by [`crate::core_host::core::auth`]; this module is
//! the route policy on top of it.
//!
//! Endpoints exempt from auth (checked by [`rpc_auth_middleware`]):
@@ -33,9 +33,9 @@ use axum::response::{IntoResponse, Response};
use axum::Json;
use serde_json::json;
-use openhuman_core::config::Config;
-use openhuman_core::inference::http::EXTERNAL_OPENAI_COMPAT_PROVIDER;
-use openhuman_core::security::credentials::AuthService;
+use crate::core_host::config::Config;
+use crate::core_host::inference::http::EXTERNAL_OPENAI_COMPAT_PROVIDER;
+use crate::core_host::security::credentials::AuthService;
/// Paths that bypass bearer-token authentication.
///
@@ -114,7 +114,7 @@ pub async fn rpc_auth_middleware(req: axum::extract::Request, next: Next) -> Res
return next.run(req).await;
}
- let Some(expected) = openhuman_core::core::auth::get_rpc_token() else {
+ let Some(expected) = crate::core_host::core::auth::get_rpc_token() else {
// Shouldn't happen in production — token is always initialized before
// the router starts serving. Deny to be safe.
log::error!("[auth] RPC token not initialized — denying request to {path}");
@@ -136,7 +136,7 @@ pub async fn rpc_auth_middleware(req: axum::extract::Request, next: Next) -> Res
.and_then(|v| v.strip_prefix("Bearer "))
.unwrap_or("");
- if openhuman_core::core::auth::bearer_matches(header_token, expected) {
+ if crate::core_host::core::auth::bearer_matches(header_token, expected) {
log::trace!("[auth] authorized request to {path} (header)");
return next.run(req).await;
}
@@ -152,7 +152,7 @@ pub async fn rpc_auth_middleware(req: axum::extract::Request, next: Next) -> Res
// this is not a separate credential — only a transport workaround.
if QUERY_TOKEN_PATHS.contains(&path.as_str()) {
if let Some(query_token) = extract_query_token(req.uri().query()) {
- if openhuman_core::core::auth::bearer_matches(&query_token, expected) {
+ if crate::core_host::core::auth::bearer_matches(&query_token, expected) {
log::trace!("[auth] authorized request to {path} (query token)");
return next.run(req).await;
}
@@ -182,7 +182,7 @@ fn verify_external_inference_bearer_for_config(config: &Config, supplied: &str)
let auth = AuthService::from_config(config);
match auth.get_provider_bearer_token(EXTERNAL_OPENAI_COMPAT_PROVIDER, None) {
- Ok(Some(expected)) => openhuman_core::core::auth::bearer_matches(supplied, expected.trim()),
+ Ok(Some(expected)) => crate::core_host::core::auth::bearer_matches(supplied, expected.trim()),
Ok(None) => false,
Err(err) => {
log::warn!("[auth] failed to read external inference bearer: {err}");
diff --git a/crates/openhuman-rpc/src/server/classify.rs b/crates/openhuman-rpc/src/server/classify.rs
index 74911774b8..4b4a494a2c 100644
--- a/crates/openhuman-rpc/src/server/classify.rs
+++ b/crates/openhuman-rpc/src/server/classify.rs
@@ -2,22 +2,22 @@
//!
//! [`classify_failure`] is pure so the routing can be tested without a server.
//! Whether an error is a session expiry is core's call
-//! ([`openhuman_core::core::session_expiry`]); this module only decides how
+//! ([`crate::core_host::core::session_expiry`]); this module only decides how
//! loudly the transport reports it.
-use openhuman_core::core::session_expiry::is_session_expired_error;
+use crate::core_host::core::session_expiry::is_session_expired_error;
/// Returns `true` when the error is the wallet's "not configured yet" message.
///
/// Wallet-backed RPCs return
-/// [`openhuman_core::web3::wallet::WALLET_NOT_CONFIGURED_MESSAGE`] before
+/// [`crate::core_host::web3::wallet::WALLET_NOT_CONFIGURED_MESSAGE`] before
/// setup. That is expected user state, not an internal failure.
///
/// Matched against the shared wallet constant (exact equality) so a wording
/// change in the wallet layer fails the coupling test in `classify_tests.rs`
/// rather than silently letting the noise back into Sentry.
pub(super) fn is_wallet_not_configured_error(msg: &str) -> bool {
- msg == openhuman_core::web3::wallet::WALLET_NOT_CONFIGURED_MESSAGE
+ msg == crate::core_host::web3::wallet::WALLET_NOT_CONFIGURED_MESSAGE
}
/// How the `/rpc` handler reports a failed call, in priority order.
@@ -95,13 +95,13 @@ pub(super) const USAGE_BACKOFF_CLIENT_MESSAGE: &str =
/// The order is significant: the first matching rule wins, exactly as the
/// handler's `if`/`else` chain did before it was extracted.
pub(super) fn classify_failure(message: &str, expected_user_state: bool) -> FailureDisposition {
- use openhuman_core::core::observability;
+ use crate::core_host::core::observability;
if expected_user_state {
FailureDisposition::ExpectedUserState
} else if is_wallet_not_configured_error(message) {
FailureDisposition::WalletNotConfigured
- } else if openhuman_core::core::params::is_param_validation_error(message) {
+ } else if crate::core_host::core::params::is_param_validation_error(message) {
FailureDisposition::ParamValidation
} else if is_session_expired_error(message) {
FailureDisposition::SessionExpired
@@ -110,10 +110,10 @@ pub(super) fn classify_failure(message: &str, expected_user_state: bool) -> Fail
} else if observability::is_transient_message_failure(message) {
FailureDisposition::TransientDownstream
} else if let Some(unknown_method) =
- openhuman_core::core::dispatch::unknown_method_name(message)
+ crate::core_host::core::dispatch::unknown_method_name(message)
{
FailureDisposition::UnknownMethod {
- probe: openhuman_core::core::dispatch::is_known_probe_method(unknown_method),
+ probe: crate::core_host::core::dispatch::is_known_probe_method(unknown_method),
}
} else {
FailureDisposition::Unexpected
diff --git a/crates/openhuman-rpc/src/server/classify_tests.rs b/crates/openhuman-rpc/src/server/classify_tests.rs
index c5d12eed3b..5258e19934 100644
--- a/crates/openhuman-rpc/src/server/classify_tests.rs
+++ b/crates/openhuman-rpc/src/server/classify_tests.rs
@@ -5,7 +5,7 @@ fn is_wallet_not_configured_error_matches_wallet_constant() {
// The classifier keys off the wallet layer's exact "not configured"
// message so wallet-backed RPCs stay out of Sentry.
assert!(is_wallet_not_configured_error(
- openhuman_core::web3::wallet::WALLET_NOT_CONFIGURED_MESSAGE
+ crate::core_host::web3::wallet::WALLET_NOT_CONFIGURED_MESSAGE
));
}
@@ -15,7 +15,7 @@ fn is_wallet_not_configured_error_is_coupled_to_the_wallet_constant() {
// constant the classifier matches, this fails — preventing the noise from
// silently returning to Sentry. Mirrors the param-validation prefix locks.
assert_eq!(
- openhuman_core::web3::wallet::WALLET_NOT_CONFIGURED_MESSAGE,
+ crate::core_host::web3::wallet::WALLET_NOT_CONFIGURED_MESSAGE,
"wallet is not configured; run wallet setup first"
);
}
@@ -51,14 +51,14 @@ fn classify_failure_expected_user_state_flag_wins() {
fn classify_failure_routes_each_boundary_class() {
assert_eq!(
classify_failure(
- openhuman_core::web3::wallet::WALLET_NOT_CONFIGURED_MESSAGE,
+ crate::core_host::web3::wallet::WALLET_NOT_CONFIGURED_MESSAGE,
false
),
FailureDisposition::WalletNotConfigured
);
assert_eq!(
classify_failure(
- &openhuman_core::core::params::unknown_param_message(
+ &crate::core_host::core::params::unknown_param_message(
"api_key",
"config",
"update_model_settings"
@@ -75,7 +75,7 @@ fn classify_failure_routes_each_boundary_class() {
classify_failure(
&format!(
"{}totally.made.up.method",
- openhuman_core::core::dispatch::UNKNOWN_METHOD_PREFIX
+ crate::core_host::core::dispatch::UNKNOWN_METHOD_PREFIX
),
false
),
@@ -94,7 +94,7 @@ fn classify_failure_param_validation_outranks_session_expiry() {
// could have expired anything.
assert_eq!(
classify_failure(
- &openhuman_core::core::params::missing_required_param_message(
+ &crate::core_host::core::params::missing_required_param_message(
"token",
"Session expired token"
),
diff --git a/crates/openhuman-rpc/src/server/cli.rs b/crates/openhuman-rpc/src/server/cli.rs
index fb38cc6595..930937f965 100644
--- a/crates/openhuman-rpc/src/server/cli.rs
+++ b/crates/openhuman-rpc/src/server/cli.rs
@@ -3,11 +3,11 @@
use std::future::Future;
use std::pin::Pin;
-use openhuman_core::core::server_launcher::{install_server_launcher, ServeRequest};
+use crate::core_host::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
+/// [`run_core_from_args`](crate::core_host::run_core_from_args); later calls are
/// no-ops.
pub fn install_cli_server() {
crate::http_host::ensure_registered();
diff --git a/crates/openhuman-rpc/src/server/dev_connect.rs b/crates/openhuman-rpc/src/server/dev_connect.rs
index 52b4dffdb5..b603781882 100644
--- a/crates/openhuman-rpc/src/server/dev_connect.rs
+++ b/crates/openhuman-rpc/src/server/dev_connect.rs
@@ -1,7 +1,7 @@
//! `GET /dev/connect` — hand this core to a browser-hosted dev renderer.
//!
//! The desktop shell mints the RPC bearer per launch and keeps it in memory
-//! (see [`openhuman_core::core::auth`]), so nothing on disk lets a browser tab reach the
+//! (see [`crate::core_host::core::auth`]), so nothing on disk lets a browser tab reach the
//! running desktop core. This route closes that gap for development: it
//! redirects to a loopback Vite dev server's `/__dev-connect` page with the
//! RPC URL and bearer in the URL **fragment**, and that page seeds them into
@@ -141,7 +141,7 @@ pub async fn dev_connect_handler(
);
};
- let Some(token) = openhuman_core::core::auth::get_rpc_token() else {
+ let Some(token) = crate::core_host::core::auth::get_rpc_token() else {
return refuse(StatusCode::SERVICE_UNAVAILABLE, "core has no RPC token yet");
};
diff --git a/crates/openhuman-rpc/src/server/http/dictation.rs b/crates/openhuman-rpc/src/server/http/dictation.rs
index 493903cc99..5912ee53fe 100644
--- a/crates/openhuman-rpc/src/server/http/dictation.rs
+++ b/crates/openhuman-rpc/src/server/http/dictation.rs
@@ -40,14 +40,14 @@ pub(super) async fn dictation_ws_handler(
}
ws.on_upgrade(|socket| async move {
- let config = match openhuman_core::config::rpc::load_config_with_timeout().await {
+ let config = match crate::core_host::config::rpc::load_config_with_timeout().await {
Ok(c) => Arc::new(c),
Err(e) => {
log::error!("[ws] failed to load config for dictation: {e}");
return;
}
};
- openhuman_core::voice::streaming::handle_dictation_ws(socket, config).await;
+ crate::core_host::voice::streaming::handle_dictation_ws(socket, config).await;
})
}
@@ -75,7 +75,7 @@ pub(super) fn authorize_dictation_request(
.map(str::trim)
.filter(|s| !s.is_empty());
let bearer_ok = header_token
- .map(openhuman_core::core::auth::verify_bearer_token)
+ .map(crate::core_host::core::auth::verify_bearer_token)
.unwrap_or(false);
let bearer_ok = bearer_ok
|| query
@@ -83,7 +83,7 @@ pub(super) fn authorize_dictation_request(
.as_deref()
.map(str::trim)
.filter(|s| !s.is_empty())
- .map(openhuman_core::core::auth::verify_bearer_token)
+ .map(crate::core_host::core::auth::verify_bearer_token)
.unwrap_or(false);
if !bearer_ok {
log::warn!("[ws] dictation upgrade rejected: missing or invalid bearer token");
diff --git a/crates/openhuman-rpc/src/server/http/dictation_tests.rs b/crates/openhuman-rpc/src/server/http/dictation_tests.rs
index e8ebe9d90d..13ee3063cd 100644
--- a/crates/openhuman-rpc/src/server/http/dictation_tests.rs
+++ b/crates/openhuman-rpc/src/server/http/dictation_tests.rs
@@ -8,10 +8,10 @@ use super::{authorize_dictation_request, DictationQuery};
fn test_token() -> String {
static INIT: Once = Once::new();
INIT.call_once(|| {
- openhuman_core::core::auth::init_rpc_token_with_value("dictation-http-tests-token")
+ crate::core_host::core::auth::init_rpc_token_with_value("dictation-http-tests-token")
.expect("initialize test bearer");
});
- openhuman_core::core::auth::get_rpc_token()
+ crate::core_host::core::auth::get_rpc_token()
.expect("test bearer initialized")
.to_string()
}
diff --git a/crates/openhuman-rpc/src/server/http/events.rs b/crates/openhuman-rpc/src/server/http/events.rs
index 0a06ad3a08..8f66ae2951 100644
--- a/crates/openhuman-rpc/src/server/http/events.rs
+++ b/crates/openhuman-rpc/src/server/http/events.rs
@@ -5,7 +5,7 @@ use axum::http::{header, StatusCode};
use axum::response::sse::{Event, KeepAlive, Sse};
use axum::response::{IntoResponse, Response};
use axum::Json;
-use openhuman_core::core::events::DomainEvent;
+use crate::core_host::core::events::DomainEvent;
use serde_json::json;
use tokio_stream::StreamExt;
@@ -48,7 +48,7 @@ pub(super) async fn events_handler(
.map(str::trim)
.filter(|s| !s.is_empty());
let bearer_ok = bearer
- .map(openhuman_core::core::auth::verify_bearer_token)
+ .map(crate::core_host::core::auth::verify_bearer_token)
.unwrap_or(false);
if !bearer_ok {
@@ -73,7 +73,7 @@ pub(super) async fn events_handler(
)
.into_response();
};
- if !openhuman_core::core::event_bind_tokens::consume(&query.client_id, supplied_token) {
+ if !crate::core_host::core::event_bind_tokens::consume(&query.client_id, supplied_token) {
let client_id_len = query.client_id.len();
log::warn!(
"[events] reject subscribe: bind token invalid or expired (client_id_len={})",
@@ -92,7 +92,7 @@ pub(super) async fn events_handler(
}
let client_id = query.client_id;
- let rx = openhuman_core::web_chat::subscribe_web_channel_events();
+ let rx = crate::core_host::web_chat::subscribe_web_channel_events();
let stream = tokio_stream::wrappers::BroadcastStream::new(rx).filter_map(
move |item| -> Option<Result<Event, std::convert::Infallible>> {
let event = item.ok()?;
@@ -133,7 +133,7 @@ pub(super) async fn domain_events_handler(headers: axum::http::HeaderMap) -> Res
.map(str::trim)
.filter(|s| !s.is_empty());
let bearer_ok = bearer
- .map(openhuman_core::core::auth::verify_bearer_token)
+ .map(crate::core_host::core::auth::verify_bearer_token)
.unwrap_or(false);
if !bearer_ok {
@@ -150,12 +150,12 @@ pub(super) async fn domain_events_handler(headers: axum::http::HeaderMap) -> Res
}
// Read dashboard config for event stream settings.
- let es_cfg = openhuman_core::config::rpc::load_config_with_timeout()
+ let es_cfg = crate::core_host::config::rpc::load_config_with_timeout()
.await
.map(|c| c.dashboard.event_stream)
.unwrap_or_default();
- let bus = openhuman_core::core::bus::BUS.get();
+ let bus = crate::core_host::core::bus::BUS.get();
if let Some(response) = domain_event_stream_unavailable(es_cfg.enabled, bus.is_some()) {
return response;
}
@@ -170,7 +170,7 @@ pub(super) async fn domain_events_handler(headers: axum::http::HeaderMap) -> Res
// per connection, not per event — and it refills the cache the row
// stamping below relies on.
let active_workspace =
- active_workspace_handle(openhuman_core::config::active_workspace_dir().await);
+ active_workspace_handle(crate::core_host::config::active_workspace_dir().await);
// Send config as first SSE event so frontend can apply settings.
let config_event = Event::default().event("config").data(
@@ -220,7 +220,7 @@ fn domain_event_stream_unavailable(enabled: bool, bus_initialized: bool) -> Opti
fn active_workspace_handle(result: anyhow::Result<std::path::PathBuf>) -> Option<String> {
result
- .map(|dir| openhuman_core::config::workspace_handle(&dir))
+ .map(|dir| crate::core_host::config::workspace_handle(&dir))
.map_err(|error| {
log::warn!(
"[events/domain] could not resolve the active workspace ({error}); \
@@ -239,9 +239,9 @@ fn domain_event_payload(event: &DomainEvent) -> Option<(String, String)> {
// Only already-redacted failure details enter the event log.
"detail": event.log_detail(),
// Public event rows expose workspace handles, never raw home paths.
- "workspace": event.workspace_dir().map(openhuman_core::config::workspace_handle),
- "active_workspace": openhuman_core::config::active_workspace_dir_cached()
- .map(|dir| openhuman_core::config::workspace_handle(&dir)),
+ "workspace": event.workspace_dir().map(crate::core_host::config::workspace_handle),
+ "active_workspace": crate::core_host::config::active_workspace_dir_cached()
+ .map(|dir| crate::core_host::config::workspace_handle(&dir)),
"timestamp": chrono::Utc::now().format("%H:%M:%S").to_string(),
});
serde_json::to_string(&data).ok().map(|data| (domain, data))
diff --git a/crates/openhuman-rpc/src/server/http/events_tests.rs b/crates/openhuman-rpc/src/server/http/events_tests.rs
index a5669e02dd..0ebcab7f78 100644
--- a/crates/openhuman-rpc/src/server/http/events_tests.rs
+++ b/crates/openhuman-rpc/src/server/http/events_tests.rs
@@ -32,7 +32,7 @@ fn active_workspace_resolution_failure_is_nonfatal() {
#[test]
fn domain_event_payload_includes_redacted_detail_and_workspace_handle() {
- let event = openhuman_core::core::events::DomainEvent::McpServerProbeTimedOut {
+ let event = crate::core_host::core::events::DomainEvent::McpServerProbeTimedOut {
server_id: "server-1".into(),
qualified_name: "example.test/mcp".into(),
probe_timeout_secs: 10,
@@ -77,7 +77,7 @@ async fn events_require_a_credential_and_reject_unknown_bind_tokens() {
#[tokio::test]
async fn events_bind_token_is_client_bound_and_single_use() {
- let token = openhuman_core::core::event_bind_tokens::issue("right", None)
+ let token = crate::core_host::core::event_bind_tokens::issue("right", None)
.expect("bind token")
.token;
@@ -98,10 +98,10 @@ async fn events_bind_token_is_client_bound_and_single_use() {
#[tokio::test]
async fn events_stream_forwards_only_the_bound_client() {
- use openhuman_core::web_chat::{publish_web_channel_event, WebChannelEvent};
+ use crate::core_host::web_chat::{publish_web_channel_event, WebChannelEvent};
use tokio_stream::StreamExt;
- let token = openhuman_core::core::event_bind_tokens::issue("stream-client", None)
+ let token = crate::core_host::core::event_bind_tokens::issue("stream-client", None)
.expect("bind token")
.token;
let response = events_handler(HeaderMap::new(), query("stream-client", Some(&token))).await;
@@ -140,7 +140,7 @@ async fn domain_events_require_a_bearer() {
#[tokio::test(flavor = "current_thread")]
async fn domain_events_stream_config_then_published_events() {
use futures::StreamExt;
- use openhuman_core::core::events::DomainEvent;
+ use crate::core_host::core::events::DomainEvent;
use std::ffi::OsString;
let workspace = tempfile::tempdir().expect("workspace tempdir");
@@ -148,13 +148,13 @@ async fn domain_events_stream_config_then_published_events() {
"OPENHUMAN_WORKSPACE",
OsString::from(workspace.path()),
)]);
- openhuman_core::core::auth::init_rpc_token_with_value("events-http-tests-token")
+ crate::core_host::core::auth::init_rpc_token_with_value("events-http-tests-token")
.expect("initialize test bearer");
- let token = openhuman_core::core::auth::get_rpc_token()
+ let token = crate::core_host::core::auth::get_rpc_token()
.expect("test bearer initialized")
.to_string();
- if openhuman_core::core::bus::BUS.get().is_none() {
- openhuman_core::core::bus::init()
+ if crate::core_host::core::bus::BUS.get().is_none() {
+ crate::core_host::core::bus::init()
.await
.expect("initialize in-process event bus");
}
@@ -175,7 +175,7 @@ async fn domain_events_stream_config_then_published_events() {
.expect("SSE bytes");
assert!(String::from_utf8_lossy(&config).contains("event: config"));
- openhuman_core::core::bus::BUS.publish(DomainEvent::SystemStartup {
+ crate::core_host::core::bus::BUS.publish(DomainEvent::SystemStartup {
component: "events-test".into(),
});
let event = tokio::time::timeout(std::time::Duration::from_secs(1), chunks.next())
diff --git a/crates/openhuman-rpc/src/server/http/health.rs b/crates/openhuman-rpc/src/server/http/health.rs
index a8b5bf54f0..79e1ee23ae 100644
--- a/crates/openhuman-rpc/src/server/http/health.rs
+++ b/crates/openhuman-rpc/src/server/http/health.rs
@@ -6,7 +6,7 @@ use axum::response::IntoResponse;
use axum::Json;
use serde::Serialize;
-use openhuman_core::core::types::AppState;
+use crate::core_host::core::types::AppState;
/// Handler for the health check endpoint.
///
@@ -17,8 +17,8 @@ use openhuman_core::core::types::AppState;
/// flag and per-component buckets in the body so readiness probes and operators
/// can still see partial failures.
pub(super) async fn health_handler() -> impl IntoResponse {
- let snapshot = openhuman_core::platform::health::snapshot();
- let verdict = openhuman_core::platform::health::verdict(&snapshot);
+ let snapshot = crate::core_host::platform::health::snapshot();
+ let verdict = crate::core_host::platform::health::verdict(&snapshot);
let status = if verdict.healthy {
StatusCode::OK
@@ -79,16 +79,16 @@ struct HttpMethodSchema {
/// Human-readable description of what the method does.
description: String,
/// List of input parameters.
- inputs: Vec<openhuman_core::core::FieldSchema>,
+ inputs: Vec<crate::core_host::core::FieldSchema>,
/// List of output fields.
- outputs: Vec<openhuman_core::core::FieldSchema>,
+ outputs: Vec<crate::core_host::core::FieldSchema>,
}
/// Aggregates schemas from all registered controllers into a single dump.
///
/// Also includes built-in core methods like `core.ping` and `core.version`.
fn build_http_schema_dump() -> HttpSchemaDump {
- let mut methods: Vec<HttpMethodSchema> = openhuman_core::core::all::all_http_method_schemas()
+ let mut methods: Vec<HttpMethodSchema> = crate::core_host::core::all::all_http_method_schemas()
.into_iter()
.map(|method| HttpMethodSchema {
method: method.method,
diff --git a/crates/openhuman-rpc/src/server/http/inference_route_tests.rs b/crates/openhuman-rpc/src/server/http/inference_route_tests.rs
index 322aa04152..4ab9fd5735 100644
--- a/crates/openhuman-rpc/src/server/http/inference_route_tests.rs
+++ b/crates/openhuman-rpc/src/server/http/inference_route_tests.rs
@@ -13,7 +13,7 @@ use axum::body::Body;
use axum::http::{header, Method, Request, StatusCode};
use tower::ServiceExt;
-use openhuman_core::core::auth::CORE_TOKEN_ENV_VAR;
+use crate::core_host::core::auth::CORE_TOKEN_ENV_VAR;
use super::build_core_http_router;
@@ -36,10 +36,10 @@ fn ensure_test_rpc_auth() -> String {
// binaries don't collide (they run in separate processes anyway).
unsafe { std::env::set_var(CORE_TOKEN_ENV_VAR, TEST_RPC_TOKEN) };
let tmp = tempfile::tempdir().expect("tempdir for token file");
- openhuman_core::core::auth::init_rpc_token(tmp.path())
+ crate::core_host::core::auth::init_rpc_token(tmp.path())
.expect("init rpc auth token for http tests");
});
- openhuman_core::core::auth::get_rpc_token()
+ crate::core_host::core::auth::get_rpc_token()
.expect("rpc bearer must be installed after ensure_test_rpc_auth")
.to_string()
}
diff --git a/crates/openhuman-rpc/src/server/http/live_voice.rs b/crates/openhuman-rpc/src/server/http/live_voice.rs
index d2d98e7b5f..d055bbc220 100644
--- a/crates/openhuman-rpc/src/server/http/live_voice.rs
+++ b/crates/openhuman-rpc/src/server/http/live_voice.rs
@@ -2,7 +2,7 @@
//!
//! Same upgrade guard as `/ws/dictation` (origin allowlist plus the core bearer
//! from the `Authorization` header or `?token=`); the session itself is
-//! `openhuman_core::voice::live::ws::handle_live_voice_ws`.
+//! `crate::core_host::voice::live::ws::handle_live_voice_ws`.
use std::sync::Arc;
@@ -24,13 +24,13 @@ pub(super) async fn live_voice_ws_handler(
// Agent audio arrives in ~40 ms chunks; keep frames small and unbounded
// in count rather than buffering.
ws.on_upgrade(|socket| async move {
- let config = match openhuman_core::config::rpc::load_config_with_timeout().await {
+ let config = match crate::core_host::config::rpc::load_config_with_timeout().await {
Ok(c) => Arc::new(c),
Err(e) => {
log::error!("[ws] failed to load config for live voice: {e}");
return;
}
};
- openhuman_core::voice::live::ws::handle_live_voice_ws(socket, config).await;
+ crate::core_host::voice::live::ws::handle_live_voice_ws(socket, config).await;
})
}
diff --git a/crates/openhuman-rpc/src/server/http/mod.rs b/crates/openhuman-rpc/src/server/http/mod.rs
index 976d459ded..5fd31205d7 100644
--- a/crates/openhuman-rpc/src/server/http/mod.rs
+++ b/crates/openhuman-rpc/src/server/http/mod.rs
@@ -12,7 +12,7 @@ use axum::routing::{get, post};
use axum::{Json, Router};
use serde_json::json;
-use openhuman_core::core::types::AppState;
+use crate::core_host::core::types::AppState;
pub(crate) mod cors;
mod dictation;
@@ -77,7 +77,7 @@ pub fn build_core_http_router(socketio_enabled: bool) -> Router {
get(crate::server::dev_connect::dev_connect_handler),
)
// OpenAI-compatible inference endpoint (/v1/chat/completions, /v1/models)
- .nest("/v1", openhuman_core::inference::http::router())
+ .nest("/v1", crate::core_host::inference::http::router())
// Apply `AppState` here so the outer router becomes `Router<()>` and
// matches any state-less sub-router merged into it.
.with_state(AppState {
@@ -131,9 +131,9 @@ async fn http_request_log_middleware(req: Request, next: Next) -> Response {
/// Handler for the root endpoint, returning server information and available endpoints.
async fn root_handler() -> impl IntoResponse {
- let api_server = match openhuman_core::config::Config::load_or_init().await {
- Ok(cfg) => openhuman_core::backend::base_url(&cfg.api_url).ok(),
- Err(_) => openhuman_core::backend::base_url(&None).ok(),
+ let api_server = match crate::core_host::config::Config::load_or_init().await {
+ Ok(cfg) => crate::core_host::backend::base_url(&cfg.api_url).ok(),
+ Err(_) => crate::core_host::backend::base_url(&None).ok(),
};
(
diff --git a/crates/openhuman-rpc/src/server/http/oauth_mcp.rs b/crates/openhuman-rpc/src/server/http/oauth_mcp.rs
index 72de17bd94..333fccd36f 100644
--- a/crates/openhuman-rpc/src/server/http/oauth_mcp.rs
+++ b/crates/openhuman-rpc/src/server/http/oauth_mcp.rs
@@ -63,7 +63,7 @@ pub(super) async fn oauth_mcp_callback_handler(
log::info!("[oauth:mcp] callback received (state present); completing exchange");
- let config = match openhuman_core::config::Config::load_or_init().await {
+ let config = match crate::core_host::config::Config::load_or_init().await {
Ok(c) => c,
Err(e) => {
log::warn!("[oauth:mcp] config load failed: {e}");
@@ -74,7 +74,7 @@ pub(super) async fn oauth_mcp_callback_handler(
}
};
- match openhuman_core::mcp::registry::oauth::complete(&config, &state, &code).await {
+ match crate::core_host::mcp::registry::oauth::complete(&config, &state, &code).await {
Ok(server_id) => {
log::info!("[oauth:mcp] completed sign-in for server_id={server_id}");
html(
diff --git a/crates/openhuman-rpc/src/server/http/rpc_handler.rs b/crates/openhuman-rpc/src/server/http/rpc_handler.rs
index 81962ccf06..14bc56a98b 100644
--- a/crates/openhuman-rpc/src/server/http/rpc_handler.rs
+++ b/crates/openhuman-rpc/src/server/http/rpc_handler.rs
@@ -5,9 +5,9 @@ use axum::http::StatusCode;
use axum::response::{IntoResponse, Response};
use axum::Json;
-use openhuman_core::core::invoke::invoke_method;
-use openhuman_core::core::types::AppState;
-use openhuman_core::core::StructuredRpcError;
+use crate::core_host::core::invoke::invoke_method;
+use crate::core_host::core::types::AppState;
+use crate::core_host::core::StructuredRpcError;
use super::super::classify::{classify_failure, FailureDisposition, USAGE_BACKOFF_CLIENT_MESSAGE};
use crate::{RpcError, RpcFailure, RpcRequest, RpcSuccess, JSONRPC_VERSION, SERVER_ERROR_CODE};
@@ -112,7 +112,7 @@ pub async fn rpc_handler(State(state): State<AppState>, Json(req): Json<RpcReque
);
}
FailureDisposition::UnknownMethod { probe: false } => {
- openhuman_core::core::observability::report_warning_message(
+ crate::core_host::core::observability::report_warning_message(
display_message.as_str(),
"rpc",
"invoke_method",
@@ -120,7 +120,7 @@ pub async fn rpc_handler(State(state): State<AppState>, Json(req): Json<RpcReque
);
}
FailureDisposition::Unexpected => {
- openhuman_core::core::observability::report_error_or_expected(
+ crate::core_host::core::observability::report_error_or_expected(
display_message.as_str(),
"rpc",
"invoke_method",
diff --git a/crates/openhuman-rpc/src/server/http/rpc_handler_tests.rs b/crates/openhuman-rpc/src/server/http/rpc_handler_tests.rs
index 83f45ca836..337b96eb3a 100644
--- a/crates/openhuman-rpc/src/server/http/rpc_handler_tests.rs
+++ b/crates/openhuman-rpc/src/server/http/rpc_handler_tests.rs
@@ -4,7 +4,7 @@ use std::sync::Arc;
use super::rpc_handler;
use crate::server::testing::EnvVarGuard;
-use openhuman_core::core::invoke::default_state;
+use crate::core_host::core::invoke::default_state;
#[tokio::test(flavor = "current_thread")]
async fn structured_rpc_error_envelope_passes_through_generic_dispatch() {
@@ -80,7 +80,7 @@ async fn thread_not_found_rpc_error_does_not_report_to_sentry() {
// `report_error_message` are captured directly via
// `sentry::capture_message` and must not be picked up here too
// (otherwise this test sees double events).
- if metadata.target() == openhuman_core::core::observability::REPORT_ERROR_TRACING_TARGET
+ if metadata.target() == crate::core_host::core::observability::REPORT_ERROR_TRACING_TARGET
{
return sentry::integrations::tracing::EventFilter::Ignore;
}
@@ -198,7 +198,7 @@ async fn unknown_method_severity_split_by_probe_allow_list() {
// Mirror production: diagnostics from the report_* helpers are
// captured directly via `sentry::capture_message`, so the bridge
// must ignore their marker target to avoid double events.
- if metadata.target() == openhuman_core::core::observability::REPORT_ERROR_TRACING_TARGET
+ if metadata.target() == crate::core_host::core::observability::REPORT_ERROR_TRACING_TARGET
{
return sentry::integrations::tracing::EventFilter::Ignore;
}
@@ -308,7 +308,7 @@ async fn invalid_memory_ingest_is_not_reported_to_sentry() {
let subscriber = tracing_subscriber::registry().with(
sentry::integrations::tracing::layer().event_filter(|metadata| {
- if metadata.target() == openhuman_core::core::observability::REPORT_ERROR_TRACING_TARGET
+ if metadata.target() == crate::core_host::core::observability::REPORT_ERROR_TRACING_TARGET
{
return sentry::integrations::tracing::EventFilter::Ignore;
}
diff --git a/crates/openhuman-rpc/src/server/mod.rs b/crates/openhuman-rpc/src/server/mod.rs
index 0db23a41fa..26cda682b7 100644
--- a/crates/openhuman-rpc/src/server/mod.rs
+++ b/crates/openhuman-rpc/src/server/mod.rs
@@ -2,17 +2,17 @@
//!
//! | Module | Owns |
//! |---|---|
-//! | `serve` | [`serve`]: bind the listener for a [`CoreRuntime`](openhuman_core::core::runtime::CoreRuntime) and run until shutdown |
+//! | `serve` | [`serve`]: bind the listener for a [`CoreRuntime`](crate::core_host::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` |
+//! | `auth` | bearer-token route policy over `crate::core_host::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
+//! ([`invoke_method`](crate::core_host::core::invoke::invoke_method)); every
//! transport here resolves a method through it.
mod auth;
diff --git a/crates/openhuman-rpc/src/server/serve.rs b/crates/openhuman-rpc/src/server/serve.rs
index 7f014161b1..6c8de907a9 100644
--- a/crates/openhuman-rpc/src/server/serve.rs
+++ b/crates/openhuman-rpc/src/server/serve.rs
@@ -4,7 +4,7 @@ use std::sync::Arc;
use tokio_util::sync::CancellationToken;
-use openhuman_core::core::runtime::CoreRuntime;
+use crate::core_host::core::runtime::CoreRuntime;
/// Metadata sent back to the Tauri host once the embedded core has selected
/// and bound its listen port.
@@ -73,27 +73,27 @@ pub async fn serve(
// and reachable from the network. See issue #1919. The self-generated
// {workspace}/core.token does NOT count — remote clients cannot read it,
// so treating it as "explicit" would be fail-open.
- if openhuman_core::security::pairing::is_public_bind(&resolved_host)
+ if crate::core_host::security::pairing::is_public_bind(&resolved_host)
&& !runtime.has_operator_token()
{
log::error!(
"[core] SECURITY: refusing to bind on public address {resolved_host} without an \
explicit operator-supplied RPC token. Set {} in your environment (or hand the \
bearer in-memory via the embedded core handle) to secure the RPC endpoint.",
- openhuman_core::core::auth::CORE_TOKEN_ENV_VAR
+ crate::core_host::core::auth::CORE_TOKEN_ENV_VAR
);
eprintln!(
"\n\x1b[1;31m[SECURITY]\x1b[0m Refusing to bind on {resolved_host} without {}.\n\
The auto-generated {{workspace}}/core.token does NOT secure a public bind —\n\
remote clients cannot read it. Set {} in your environment to secure the\n\
RPC endpoint, or bind on a loopback address.\n",
- openhuman_core::core::auth::CORE_TOKEN_ENV_VAR,
- openhuman_core::core::auth::CORE_TOKEN_ENV_VAR
+ crate::core_host::core::auth::CORE_TOKEN_ENV_VAR,
+ crate::core_host::core::auth::CORE_TOKEN_ENV_VAR
);
anyhow::bail!(
"refusing to bind on non-loopback address {resolved_host} without an explicit \
operator-supplied RPC token ({})",
- openhuman_core::core::auth::CORE_TOKEN_ENV_VAR
+ crate::core_host::core::auth::CORE_TOKEN_ENV_VAR
);
}
@@ -104,11 +104,11 @@ pub async fn serve(
// nothing to take over: another live core on the port (the desktop
// app's, another checkout's) is a neighbour, so move to a free port.
let occupied_by_core = if ready_tx.is_some() {
- openhuman_core::platform::connectivity::rpc::OccupiedByCore::Takeover
+ crate::core_host::platform::connectivity::rpc::OccupiedByCore::Takeover
} else {
- openhuman_core::platform::connectivity::rpc::OccupiedByCore::Fallback
+ crate::core_host::platform::connectivity::rpc::OccupiedByCore::Fallback
};
- let pick = openhuman_core::platform::connectivity::rpc::pick_listen_port_for_host_with(
+ let pick = crate::core_host::platform::connectivity::rpc::pick_listen_port_for_host_with(
host.as_str(),
preferred_port,
occupied_by_core,
@@ -141,7 +141,7 @@ pub async fn serve(
move |req: axum::extract::Request, next: axum::middleware::Next| {
let ctx = Arc::clone(&ctx);
async move {
- openhuman_core::core::runtime::CoreContext::scope(ctx, next.run(req)).await
+ crate::core_host::core::runtime::CoreContext::scope(ctx, next.run(req)).await
}
},
),
@@ -153,7 +153,7 @@ pub async fn serve(
log::info!(
"[core] OpenHuman core is ready — listening on http://{bind_addr} (version {})",
- openhuman_core::core::invoke::default_state().core_version
+ crate::core_host::core::invoke::default_state().core_version
);
log::info!("[rpc:http] JSON-RPC — POST http://{bind_addr}/rpc (JSON-RPC 2.0)");
if runtime.services().socketio {
@@ -182,7 +182,7 @@ pub async fn serve(
.await
} else {
axum::serve(listener, app)
- .with_graceful_shutdown(openhuman_core::core::shutdown::signal())
+ .with_graceful_shutdown(crate::core_host::core::shutdown::signal())
.await
};
if let Err(error) = &served {
diff --git a/crates/openhuman-rpc/src/server/shims.rs b/crates/openhuman-rpc/src/server/shims.rs
index 466e677963..b84c74adfc 100644
--- a/crates/openhuman-rpc/src/server/shims.rs
+++ b/crates/openhuman-rpc/src/server/shims.rs
@@ -1,5 +1,5 @@
//! Server entry points kept for the hosts that predate
-//! [`CoreBuilder`](openhuman_core::core::runtime::CoreBuilder).
+//! [`CoreBuilder`](crate::core_host::core::runtime::CoreBuilder).
//!
//! Each `run_server*` function is a thin shim that composes a `CoreBuilder`
//! and calls [`serve`](super::serve::serve).
@@ -38,7 +38,7 @@ pub async fn run_server(
/// 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 = openhuman_core::core::runtime::ServiceSet::headless_api();
+ let services = crate::core_host::core::runtime::ServiceSet::headless_api();
run_server_with_services(host, port, services, false, None, None, None).await
}
@@ -66,7 +66,7 @@ pub async fn run_server_embedded(
/// 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::core::auth::init_rpc_token_with_value` without ever
+/// via `crate::core_host::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(
@@ -99,7 +99,7 @@ async fn run_server_inner(
ready_tx: Option<tokio::sync::oneshot::Sender<EmbeddedReadySignal>>,
rpc_token: Option<std::sync::Arc<String>>,
) -> anyhow::Result<()> {
- let mut services = openhuman_core::core::runtime::ServiceSet::desktop();
+ let mut services = crate::core_host::core::runtime::ServiceSet::desktop();
services.socketio = socketio_enabled;
run_server_with_services(
host,
@@ -116,7 +116,7 @@ async fn run_server_inner(
async fn run_server_with_services(
host: Option<&str>,
port: Option<u16>,
- services: openhuman_core::core::runtime::ServiceSet,
+ services: crate::core_host::core::runtime::ServiceSet,
embedded_core: bool,
shutdown_token: Option<CancellationToken>,
ready_tx: Option<tokio::sync::oneshot::Sender<EmbeddedReadySignal>>,
@@ -129,15 +129,15 @@ async fn run_server_with_services(
// Tauri shell; standalone splits CLI / Docker via `detect_standalone`).
// See the pluggable-core work (`core::runtime`).
let host_kind = if embedded_core {
- openhuman_core::core::types::HostKind::TauriShell
+ crate::core_host::core::types::HostKind::TauriShell
} else {
- openhuman_core::core::types::HostKind::detect_standalone()
+ crate::core_host::core::types::HostKind::detect_standalone()
};
let token = match rpc_token {
- Some(token) => openhuman_core::core::runtime::TokenSource::Fixed(token),
- None => openhuman_core::core::runtime::TokenSource::EnvOrFile,
+ Some(token) => crate::core_host::core::runtime::TokenSource::Fixed(token),
+ None => crate::core_host::core::runtime::TokenSource::EnvOrFile,
};
- let mut builder = openhuman_core::core::runtime::CoreBuilder::new(host_kind)
+ let mut builder = crate::core_host::core::runtime::CoreBuilder::new(host_kind)
.token(token)
.services(services);
// The browser E2E harness scripts direct tool calls through its mock model.
@@ -160,10 +160,10 @@ async fn run_server_with_services(
}
fn apply_e2e_tool_groups(
- builder: openhuman_core::core::runtime::CoreBuilder,
-) -> openhuman_core::core::runtime::CoreBuilder {
+ builder: crate::core_host::core::runtime::CoreBuilder,
+) -> crate::core_host::core::runtime::CoreBuilder {
if std::env::var_os("OPENHUMAN_E2E").is_some() {
- builder.tool_groups(openhuman_core::tools::toolpacks::ToolGroups::advertised())
+ builder.tool_groups(crate::core_host::tools::toolpacks::ToolGroups::advertised())
} else {
builder
}
diff --git a/crates/openhuman-rpc/src/server/shims_tests.rs b/crates/openhuman-rpc/src/server/shims_tests.rs
index 42e87bec7b..b8f6b7d75f 100644
--- a/crates/openhuman-rpc/src/server/shims_tests.rs
+++ b/crates/openhuman-rpc/src/server/shims_tests.rs
@@ -6,7 +6,7 @@ use crate::server::testing::EnvVarGuard;
fn e2e_environment_enables_advertised_tool_groups() {
let _guard = EnvVarGuard::set_many(vec![("OPENHUMAN_E2E", "1".into())]);
let builder =
- openhuman_core::core::runtime::CoreBuilder::new(openhuman_core::core::types::HostKind::Cli);
+ crate::core_host::core::runtime::CoreBuilder::new(crate::core_host::core::types::HostKind::Cli);
let _ = super::apply_e2e_tool_groups(builder);
}
@@ -47,7 +47,7 @@ fn server_shim_refuses_public_bind_without_operator_token() {
),
("OPENHUMAN_CORE_TOKEN", OsString::from("")),
]);
- let services = openhuman_core::core::runtime::ServiceSet::headless_api();
+ let services = crate::core_host::core::runtime::ServiceSet::headless_api();
let error = super::run_server_with_services(
Some("0.0.0.0"),
diff --git a/crates/openhuman-rpc/src/server/socketio.rs b/crates/openhuman-rpc/src/server/socketio.rs
index f522886418..7ef05c076b 100644
--- a/crates/openhuman-rpc/src/server/socketio.rs
+++ b/crates/openhuman-rpc/src/server/socketio.rs
@@ -1,12 +1,12 @@
//! Socket.IO live-event bridge to the desktop shell.
//!
//! `spawn_web_channel_bridge` spawns one forwarding task per source. Domain
-//! broadcast channels: web-chat events (`openhuman_core::web_chat`), dictation hotkeys
-//! and transcription results (`openhuman_core::voice::dictation_listener`), overlay
-//! attention bubbles (`openhuman_core::desktop::overlay::subscribe_attention_events`,
+//! broadcast channels: web-chat events (`crate::core_host::web_chat`), dictation hotkeys
+//! and transcription results (`crate::core_host::voice::dictation_listener`), overlay
+//! attention bubbles (`crate::core_host::desktop::overlay::subscribe_attention_events`,
//! see `desktop/overlay/README.md`), core notifications
-//! (`openhuman_core::desktop::notifications`), and shell companion state
-//! (`COMPANION_STATE_BUS`). `DomainEvent`s read off `openhuman_core::core::bus::BUS`:
+//! (`crate::core_host::desktop::notifications`), and shell companion state
+//! (`COMPANION_STATE_BUS`). `DomainEvent`s read off `crate::core_host::core::bus::BUS`:
//! session expiry, MCP setup secret requests, memory sync and tree-build
//! progress, channel listener health, and active-workspace changes. Web-chat
//! events go to the initiating client's room and the `thread:<id>` room
@@ -37,7 +37,7 @@ use serde_json::Value;
use socketioxide::extract::{AckSender, Data, SocketRef, TryData};
use socketioxide::SocketIo;
-use openhuman_core::web_chat::{GuardrailPayload, WebChannelEvent};
+use crate::core_host::web_chat::{GuardrailPayload, WebChannelEvent};
/// Shell-originated companion lifecycle events that still need to reach
/// Socket.IO-only surfaces such as the native macOS notch WKWebView.
@@ -276,7 +276,7 @@ pub fn attach_socketio() -> (socketioxide::layer::SocketIoLayer, SocketIo) {
// `TryData` lets us treat a missing/malformed `auth` payload as a
// soft failure (no panic) and reject the connect cleanly.
let supplied = handshake.ok().and_then(|h| h.token).unwrap_or_default();
- if !openhuman_core::core::auth::verify_bearer_token(&supplied) {
+ if !crate::core_host::core::auth::verify_bearer_token(&supplied) {
log::warn!(
"[socketio] rejecting connect: missing or invalid bearer client={}",
client_id
@@ -317,9 +317,9 @@ pub fn attach_socketio() -> (socketioxide::layer::SocketIoLayer, SocketIo) {
let socket = socket.clone();
let client_id = client_id.clone();
tokio::spawn(async move {
- match openhuman_core::config::active_workspace_snapshot().await {
+ match crate::core_host::config::active_workspace_snapshot().await {
Ok((dir, revision)) => {
- let handle = openhuman_core::config::workspace_handle(&dir);
+ let handle = crate::core_host::config::workspace_handle(&dir);
// One snapshot, not two reads: resolved
// separately, a switch between them would pair
// this workspace with the *next* one's revision,
@@ -359,8 +359,8 @@ pub fn attach_socketio() -> (socketioxide::layer::SocketIoLayer, SocketIo) {
);
// Invoke the method through the same logic used by the HTTP RPC endpoint.
- let response = match openhuman_core::core::invoke::invoke_method(
- openhuman_core::core::invoke::default_state(),
+ let response = match crate::core_host::core::invoke::invoke_method(
+ crate::core_host::core::invoke::default_state(),
payload.method.as_str(),
payload.params,
)
@@ -401,9 +401,9 @@ pub fn attach_socketio() -> (socketioxide::layer::SocketIoLayer, SocketIo) {
payload.message.len()
);
if let Some(run_mode) = payload.run_mode.as_deref() {
- match openhuman_core::agent::tinyagents::run_mode::parse_mode_label(run_mode) {
+ match crate::core_host::agent::tinyagents::run_mode::parse_mode_label(run_mode) {
Some(mode) => {
- openhuman_core::agent::tinyagents::run_mode::set_mode(&thread_id, mode);
+ crate::core_host::agent::tinyagents::run_mode::set_mode(&thread_id, mode);
}
None => log::warn!(
"[socketio] chat:start thread_id={thread_id} ignoring unrecognized run_mode={run_mode}"
@@ -412,7 +412,7 @@ pub fn attach_socketio() -> (socketioxide::layer::SocketIoLayer, SocketIo) {
}
// Trigger the web channel's chat logic.
- match openhuman_core::web_chat::start_chat(
+ match crate::core_host::web_chat::start_chat(
&client_id,
&payload.thread_id,
&payload.message,
@@ -420,7 +420,7 @@ pub fn attach_socketio() -> (socketioxide::layer::SocketIoLayer, SocketIo) {
payload.temperature,
payload.locale,
payload.queue_mode,
- openhuman_core::web_chat::ChatRequestMetadata::default(),
+ crate::core_host::web_chat::ChatRequestMetadata::default(),
)
.await
{
@@ -448,7 +448,7 @@ pub fn attach_socketio() -> (socketioxide::layer::SocketIoLayer, SocketIo) {
// every other `chat_error`: by `error_type`, plus
// a typed `guardrail` payload it doesn't have to
// parse out of `message`.
- if let openhuman_core::web_chat::StartChatError::Guardrail {
+ if let crate::core_host::web_chat::StartChatError::Guardrail {
verdict,
score,
reasons,
@@ -481,7 +481,7 @@ pub fn attach_socketio() -> (socketioxide::layer::SocketIoLayer, SocketIo) {
client_id,
payload.thread_id
);
- let _ = openhuman_core::web_chat::cancel_chat_scoped(
+ let _ = crate::core_host::web_chat::cancel_chat_scoped(
&client_id,
&payload.thread_id,
payload.request_id.as_deref(),
@@ -557,7 +557,7 @@ pub fn spawn_web_channel_bridge(io: SocketIo) {
// 1. Web channel events → per-client rooms.
let io_web = io.clone();
tokio::spawn(async move {
- let mut rx = openhuman_core::web_chat::subscribe_web_channel_events();
+ let mut rx = crate::core_host::web_chat::subscribe_web_channel_events();
loop {
let event = match rx.recv().await {
Ok(event) => event,
@@ -584,7 +584,7 @@ pub fn spawn_web_channel_bridge(io: SocketIo) {
// 2. Dictation hotkey events → broadcast to all connected clients.
tokio::spawn(async move {
- let mut rx = openhuman_core::voice::dictation_listener::subscribe_dictation_events();
+ let mut rx = crate::core_host::voice::dictation_listener::subscribe_dictation_events();
loop {
let event = match rx.recv().await {
Ok(event) => event,
@@ -634,7 +634,7 @@ pub fn spawn_web_channel_bridge(io: SocketIo) {
// 3. Overlay attention events → broadcast to all clients.
tokio::spawn(async move {
- let mut rx = openhuman_core::desktop::overlay::subscribe_attention_events();
+ let mut rx = crate::core_host::desktop::overlay::subscribe_attention_events();
loop {
let event = match rx.recv().await {
Ok(event) => event,
@@ -662,7 +662,7 @@ pub fn spawn_web_channel_bridge(io: SocketIo) {
// chat session is active. Pattern mirrors the overlay attention
// bridge above — fire-and-forget, no per-client routing.
tokio::spawn(async move {
- let mut rx = openhuman_core::desktop::notifications::subscribe_core_notifications();
+ let mut rx = crate::core_host::desktop::notifications::subscribe_core_notifications();
loop {
let event = match rx.recv().await {
Ok(event) => event,
@@ -705,7 +705,7 @@ pub fn spawn_web_channel_bridge(io: SocketIo) {
let max_attempts = (MAX_WAIT_SECS * 1000) / RETRY_INTERVAL_MS;
let mut attempts: u64 = 0;
loop {
- if let Some(bus) = openhuman_core::core::bus::BUS.get() {
+ if let Some(bus) = crate::core_host::core::bus::BUS.get() {
break bus;
}
attempts += 1;
@@ -724,7 +724,7 @@ pub fn spawn_web_channel_bridge(io: SocketIo) {
let Some(event) = rx.recv().await else {
break;
};
- if let openhuman_core::core::events::DomainEvent::SessionExpired { source, reason } =
+ if let crate::core_host::core::events::DomainEvent::SessionExpired { source, reason } =
event
{
// Other publishers may emit a backend 401 while this core is
@@ -732,7 +732,7 @@ pub fn spawn_web_channel_bridge(io: SocketIo) {
// correctly keeps that credential, so the UI must not receive
// a contradictory sign-out event from this independent bus
// consumer. Real JWT expiry still broadcasts as before.
- if openhuman_core::security::credentials::session_support::current_session_is_local(
+ if crate::core_host::security::credentials::session_support::current_session_is_local(
)
.await
{
@@ -778,7 +778,7 @@ pub fn spawn_web_channel_bridge(io: SocketIo) {
let max_attempts = (MAX_WAIT_SECS * 1000) / RETRY_INTERVAL_MS;
let mut attempts: u64 = 0;
loop {
- if let Some(bus) = openhuman_core::core::bus::BUS.get() {
+ if let Some(bus) = crate::core_host::core::bus::BUS.get() {
break bus;
}
attempts += 1;
@@ -797,12 +797,12 @@ pub fn spawn_web_channel_bridge(io: SocketIo) {
let Some(event) = rx.recv().await else {
break;
};
- if let openhuman_core::core::events::DomainEvent::ActiveWorkspaceChanged {
+ if let crate::core_host::core::events::DomainEvent::ActiveWorkspaceChanged {
workspace_dir,
revision,
} = event
{
- let handle = openhuman_core::config::workspace_handle(&workspace_dir);
+ let handle = crate::core_host::config::workspace_handle(&workspace_dir);
log::info!(
"[socketio] broadcast workspace_changed workspace={handle} revision={revision}"
);
@@ -816,7 +816,7 @@ pub fn spawn_web_channel_bridge(io: SocketIo) {
// 5. Transcription results → broadcast to all connected clients.
tokio::spawn(async move {
- let mut rx = openhuman_core::voice::dictation_listener::subscribe_transcription_results();
+ let mut rx = crate::core_host::voice::dictation_listener::subscribe_transcription_results();
loop {
let text = match rx.recv().await {
Ok(text) => text,
@@ -849,7 +849,7 @@ pub fn spawn_web_channel_bridge(io: SocketIo) {
let max_attempts = (MAX_WAIT_SECS * 1000) / RETRY_INTERVAL_MS;
let mut attempts: u64 = 0;
loop {
- if let Some(bus) = openhuman_core::core::bus::BUS.get() {
+ if let Some(bus) = crate::core_host::core::bus::BUS.get() {
break bus;
}
attempts += 1;
@@ -869,7 +869,7 @@ pub fn spawn_web_channel_bridge(io: SocketIo) {
break;
};
match event {
- openhuman_core::core::events::DomainEvent::HarnessInitProgress {
+ crate::core_host::core::events::DomainEvent::HarnessInitProgress {
step_id,
state,
message,
@@ -883,7 +883,7 @@ pub fn spawn_web_channel_bridge(io: SocketIo) {
});
let _ = io_memory_sync.emit("init:progress", &payload);
}
- openhuman_core::core::events::DomainEvent::HarnessInitCompleted {
+ crate::core_host::core::events::DomainEvent::HarnessInitCompleted {
overall,
failed_required,
} => {
@@ -898,7 +898,7 @@ pub fn spawn_web_channel_bridge(io: SocketIo) {
// truth and the Workflows UI keeps a 2s poller as fallback, so
// a dropped event here (broadcast lag) only delays the live
// update, never corrupts run history.
- openhuman_core::core::events::DomainEvent::FlowRunProgress {
+ crate::core_host::core::events::DomainEvent::FlowRunProgress {
run_id,
node_id,
status,
@@ -923,7 +923,7 @@ pub fn spawn_web_channel_bridge(io: SocketIo) {
// instead of waiting for the blocking `flows_run` RPC to
// resolve or the first `FlowRunProgress` step. Best-effort,
// same rationale as `flow:run_progress` above.
- openhuman_core::core::events::DomainEvent::FlowRunStarted { flow_id, run_id } => {
+ crate::core_host::core::events::DomainEvent::FlowRunStarted { flow_id, run_id } => {
let payload = serde_json::json!({
"flow_id": flow_id,
"run_id": run_id,
@@ -942,7 +942,7 @@ pub fn spawn_web_channel_bridge(io: SocketIo) {
// canvas/sidebar can flip a run to Completed/Failed live
// instead of relying on a poll to notice. Best-effort, same
// rationale as the other `flow:*` bridges.
- openhuman_core::core::events::DomainEvent::FlowRunFinished {
+ crate::core_host::core::events::DomainEvent::FlowRunFinished {
flow_id,
run_id,
status,
@@ -966,7 +966,7 @@ pub fn spawn_web_channel_bridge(io: SocketIo) {
// — most importantly, so an agent `save_workflow` becomes
// visible in a canvas the user has open (audit F6). Best-effort;
// the UI's refetch-on-focus is the backstop.
- openhuman_core::core::events::DomainEvent::FlowChanged {
+ crate::core_host::core::events::DomainEvent::FlowChanged {
flow_id,
kind,
actor,
@@ -991,7 +991,7 @@ pub fn spawn_web_channel_bridge(io: SocketIo) {
// bridge — because a flow run has no chat thread/client to
// target; the Workflows UI listens process-wide and filters
// by `flow_id`/`run_id` client-side.
- openhuman_core::core::events::DomainEvent::FlowApprovalRequested {
+ crate::core_host::core::events::DomainEvent::FlowApprovalRequested {
request_id,
flow_id,
run_id,
@@ -1036,7 +1036,7 @@ pub fn spawn_web_channel_bridge(io: SocketIo) {
let max_attempts = (MAX_WAIT_SECS * 1000) / RETRY_INTERVAL_MS;
let mut attempts: u64 = 0;
loop {
- if let Some(bus) = openhuman_core::core::bus::BUS.get() {
+ if let Some(bus) = crate::core_host::core::bus::BUS.get() {
break bus;
}
attempts += 1;
@@ -1056,7 +1056,7 @@ pub fn spawn_web_channel_bridge(io: SocketIo) {
break;
};
let payload = match event {
- openhuman_core::core::events::DomainEvent::ChannelConnected { channel } => {
+ crate::core_host::core::events::DomainEvent::ChannelConnected { channel } => {
log::debug!(
"[socketio] broadcast channel:connection-updated {channel} -> connected"
);
@@ -1066,7 +1066,7 @@ pub fn spawn_web_channel_bridge(io: SocketIo) {
None,
))
}
- openhuman_core::core::events::DomainEvent::ChannelDisconnected {
+ crate::core_host::core::events::DomainEvent::ChannelDisconnected {
channel,
reason,
} => {
@@ -1243,7 +1243,7 @@ fn event_alias(name: &str) -> Option<String> {
/// request is no longer parked, so a socket that already has the card just
/// re-renders the same one.
fn replay_parked_approval(socket: &SocketRef, thread_id: &str) {
- let Some(gate) = openhuman_core::security::approval::ApprovalGate::try_global() else {
+ let Some(gate) = crate::core_host::security::approval::ApprovalGate::try_global() else {
return;
};
let Some(row) = gate.parked_request_for_thread(thread_id) else {
@@ -1251,7 +1251,7 @@ fn replay_parked_approval(socket: &SocketRef, thread_id: &str) {
};
let client_id = socket.id.to_string();
let expires_at = row.expires_at.map(|t| t.to_rfc3339());
- let mut event = openhuman_core::web_chat::approval_request_event(
+ let mut event = crate::core_host::web_chat::approval_request_event(
&row.request_id,
&row.tool_name,
&row.action_summary,
@@ -1264,7 +1264,7 @@ fn replay_parked_approval(socket: &SocketRef, thread_id: &str) {
// Replay is a fresh emit to a newly-joined socket, not a resend of the
// original event, so stamp `ts` with "now" (same clock as
// `publish_web_channel_event`) rather than leaving it unset.
- event.ts = Some(openhuman_core::web_chat::unix_epoch_ms());
+ event.ts = Some(crate::core_host::web_chat::unix_epoch_ms());
let Ok(payload) = serde_json::to_value(&event) else {
return;
};
@@ -1282,12 +1282,12 @@ fn replay_parked_approval(socket: &SocketRef, thread_id: &str) {
/// UI the same fire-and-forget way, so the same reconciliation applies.
fn replay_parked_plan_review(socket: &SocketRef, thread_id: &str) {
let Some(row) =
- openhuman_core::agent::plan_review::gate::global().parked_review_for_thread(thread_id)
+ crate::core_host::agent::plan_review::gate::global().parked_review_for_thread(thread_id)
else {
return;
};
let client_id = socket.id.to_string();
- let mut event = openhuman_core::web_chat::plan_review_request_event(
+ let mut event = crate::core_host::web_chat::plan_review_request_event(
&row.request_id,
&row.summary,
&row.steps,
@@ -1296,7 +1296,7 @@ fn replay_parked_plan_review(socket: &SocketRef, thread_id: &str) {
row.tool_call_id.as_deref(),
row.expires_at.as_deref(),
);
- event.ts = Some(openhuman_core::web_chat::unix_epoch_ms());
+ event.ts = Some(crate::core_host::web_chat::unix_epoch_ms());
let Ok(payload) = serde_json::to_value(&event) else {
return;
};
diff --git a/crates/openhuman-rpc/src/session_store/mod.rs b/crates/openhuman-rpc/src/session_store/mod.rs
index 9434cab661..63cc15ef6c 100644
--- a/crates/openhuman-rpc/src/session_store/mod.rs
+++ b/crates/openhuman-rpc/src/session_store/mod.rs
@@ -134,8 +134,8 @@ fn stores_at(workspace: &Path) -> AgentStores {
/// sweep runs; the workspace is resolved per call because the desktop rebinds
/// it when a different user signs in.
pub fn install() {
- openhuman_core::agent::session_store::install(Arc::new(SqliteSessionStores::resolving(
- openhuman_core::agent::session_store::context_workspace_dir,
+ crate::core_host::agent::session_store::install(Arc::new(SqliteSessionStores::resolving(
+ crate::core_host::agent::session_store::context_workspace_dir,
)));
}