The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
perf(core): box cross-crate async entry points to avoid duplicate monomorphization
Steven Enamakeled8cb2e5c9b4
diff --git a/crates/openhuman-core/src/config/schema/load/dirs.rs b/crates/openhuman-core/src/config/schema/load/dirs.rsindex 4c6ff0cd3a..8720861656 100644--- a/crates/openhuman-core/src/config/schema/load/dirs.rs+++ b/crates/openhuman-core/src/config/schema/load/dirs.rs@@ -322,7 +322,17 @@ pub(crate) async fn resolve_runtime_config_dirs(/// revision separately: a switch between those two reads pairs workspace A/// with B's revision, and a receiver comparing revisions then ranks the stale/// A above the B it should yield to.-pub async fn active_workspace_snapshot() -> Result<(PathBuf, u64)> {+/// Returned boxed and `#[inline(never)]` on purpose: other crates await this+/// (`openhuman-rpc`, `openhuman-embed`), and an `async fn` body is otherwise+/// re-instantiated inside every calling crate's state machine. Boxing here+/// keeps one copy, compiled in this crate.+#[inline(never)]+pub fn active_workspace_snapshot(+) -> futures::future::BoxFuture<'static, Result<(PathBuf, u64)>> {+ Box::pin(active_workspace_snapshot_inner())+}++async fn active_workspace_snapshot_inner() -> Result<(PathBuf, u64)> {// An embedding host that supplied its own `Config` is authoritative, and// `config::ops::load_config_with_timeout` already short-circuits on it for// exactly this reason. Resolving from disk/env here instead would answerdiff --git a/crates/openhuman-core/src/inference/host_runtime/ops/agent_chat.rs b/crates/openhuman-core/src/inference/host_runtime/ops/agent_chat.rsindex b4aa7160e3..f819f959e2 100644--- a/crates/openhuman-core/src/inference/host_runtime/ops/agent_chat.rs+++ b/crates/openhuman-core/src/inference/host_runtime/ops/agent_chat.rs@@ -219,8 +219,37 @@ fn build_turn_agent(/// thread./// * The agent is built by `target`, so a library host can run one booted/// core with many independently defined agents.+///+/// Returned boxed and `#[inline(never)]` on purpose: other crates await this+/// (`openhuman-rpc`, `openhuman-embed`), and an `async fn` body is otherwise+/// re-instantiated inside every calling crate's state machine. Boxing here+/// keeps one copy, compiled in this crate.+#[allow(clippy::too_many_arguments)]+#[inline(never)]+pub fn agent_chat_for<'a>(+ config: &'a mut Config,+ target: AgentChatTarget<'a>,+ message: &'a str,+ model_override: Option<String>,+ temperature: Option<f64>,+ thread_id: Option<String>,+ cwd: Option<String>,+ route: Option<crate::config::schema::EphemeralRoute>,+) -> futures::future::BoxFuture<'a, Result<Outcome<String>, String>> {+ Box::pin(agent_chat_for_inner(+ config,+ target,+ message,+ model_override,+ temperature,+ thread_id,+ cwd,+ route,+ ))+}+#[allow(clippy::too_many_arguments)]-pub async fn agent_chat_for(+async fn agent_chat_for_inner(config: &mut Config,target: AgentChatTarget<'_>,message: &str,diff --git a/crates/openhuman-core/src/web_chat/ops/start_chat.rs b/crates/openhuman-core/src/web_chat/ops/start_chat.rsindex b082978eea..64b72552fd 100644--- a/crates/openhuman-core/src/web_chat/ops/start_chat.rs+++ b/crates/openhuman-core/src/web_chat/ops/start_chat.rs@@ -131,7 +131,36 @@ fn prompt_guard_user_message(action: PromptEnforcementAction) -> &'static str {}}-pub async fn start_chat(+/// Returned boxed and `#[inline(never)]` on purpose: other crates await this+/// (`openhuman-rpc`, `openhuman-embed`), and an `async fn` body is otherwise+/// re-instantiated inside every calling crate's state machine. Boxing here+/// keeps one copy, compiled in this crate.+#[allow(clippy::too_many_arguments)]+#[inline(never)]+pub fn start_chat<'a>(+ client_id: &'a str,+ thread_id: &'a str,+ message: &'a str,+ model_override: Option<String>,+ temperature: Option<f64>,+ locale: Option<String>,+ queue_mode: Option<String>,+ metadata: ChatRequestMetadata,+) -> futures::future::BoxFuture<'a, Result<String, StartChatError>> {+ Box::pin(start_chat_inner(+ client_id,+ thread_id,+ message,+ model_override,+ temperature,+ locale,+ queue_mode,+ metadata,+ ))+}++#[allow(clippy::too_many_arguments)]+async fn start_chat_inner(client_id: &str,thread_id: &str,message: &str,