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
chore: files changed crates/openhuman-core/src/commands/ops.rs,crates/openhuman-core/src/commands/sc
Steven Enamakelf477eafc5c66
diff --git a/crates/openhuman-core/src/commands/ops.rs b/crates/openhuman-core/src/commands/ops.rsindex 4fcbbcda09..ee8607904f 100644--- a/crates/openhuman-core/src/commands/ops.rs+++ b/crates/openhuman-core/src/commands/ops.rs@@ -4,6 +4,7 @@//! so this module has no compile-time dependency on either domain's wire//! shape — only on the JSON both already return over RPC.+use crate::core::runtime::DispatchCtx;use serde_json::{Map, Value};use crate::core::all::RegisteredController;@@ -45,6 +46,7 @@ fn builtin_entries() -> Vec<CommandEntry> {/// controller, handler error): a broken skills/flows catalog must never/// take down the whole command palette.async fn invoke(+ ctx: &DispatchCtx,controllers: &[RegisteredController],namespace: &str,function: &str,@@ -53,7 +55,7 @@ async fn invoke(let controller = controllers.iter().find(|c| c.schema.namespace == namespace && c.schema.function == function)?;- match (controller.handler)(params).await {+ match (controller.handler)(ctx.clone(), params).await {Ok(value) => Some(unwrap_rpc(&value).clone()),Err(error) => {log::debug!(@@ -98,7 +100,7 @@ fn entries_from_array(value: &Value, array_field: &str, kind: CommandKind) -> Ve/// Builds the merged command list: built-ins first (stable order, cheapest),/// then skills, then workflows.-pub async fn commands_list() -> Result<Outcome<CommandsListResponse>, String> {+pub async fn commands_list(ctx: &DispatchCtx) -> Result<Outcome<CommandsListResponse>, String> {let mut entries = builtin_entries();let skills_controllers = crate::skills::all_skills_registered_controllers();@@ -107,7 +109,7 @@ pub async fn commands_list() -> Result<Outcome<CommandsListResponse>, String> {// automations — the palette wants everything runnable, not just the// Automations tab's default view.skills_params.insert("include_skills".to_string(), Value::Bool(true));- if let Some(value) = invoke(&skills_controllers, "skills", "list", skills_params).await {+ if let Some(value) = invoke(ctx, &skills_controllers, "skills", "list", skills_params).await {entries.extend(entries_from_array(&value, "skills", CommandKind::Skill));}@@ -119,7 +121,7 @@ pub async fn commands_list() -> Result<Outcome<CommandsListResponse>, String> {#[cfg(feature = "flows")]{let flows_controllers = crate::flows::all_flows_registered_controllers();- if let Some(value) = invoke(&flows_controllers, "flows", "list", Map::new()).await {+ if let Some(value) = invoke(ctx, &flows_controllers, "flows", "list", Map::new()).await {entries.extend(entries_from_array(&value, "flows", CommandKind::Workflow));}}diff --git a/crates/openhuman-core/src/commands/schemas.rs b/crates/openhuman-core/src/commands/schemas.rsindex cb41f6c06d..206a1ce108 100644--- a/crates/openhuman-core/src/commands/schemas.rs+++ b/crates/openhuman-core/src/commands/schemas.rs@@ -53,9 +53,9 @@ pub fn schemas(function: &str) -> ControllerSchema {}}-fn handle_list(_ctx: DispatchCtx, _params: Map<String, Value>) -> ControllerFuture {+fn handle_list(ctx: DispatchCtx, _params: Map<String, Value>) -> ControllerFuture {Box::pin(async move {- super::ops::commands_list()+ super::ops::commands_list(&ctx).await?.into_cli_compatible_json()})diff --git a/crates/openhuman-core/src/core/cli.rs b/crates/openhuman-core/src/core/cli.rsindex c038220833..43e7a72fb8 100644--- a/crates/openhuman-core/src/core/cli.rs+++ b/crates/openhuman-core/src/core/cli.rs@@ -4,6 +4,7 @@//! for the CLI. It supports commands for running the server, making RPC calls,//! and invoking domain-specific functionality across various namespaces.+use crate::core::runtime::DispatchCtx;use anyhow::Result;use serde_json::{Map, Value};use std::collections::BTreeMap;@@ -414,7 +415,7 @@ fn run_call_command(args: &[String]) -> Result<()> {.max_blocking_threads(crate::core::runtime::MAX_BLOCKING_THREADS).build()?;let value = rt- .block_on(async { invoke_method(default_state(), &method, params).await })+ .block_on(async { invoke_method(DispatchCtx::process_default(), default_state(), &method, params).await }).map_err(anyhow::Error::msg)?;// Output the result as pretty-printed JSON to stdout.@@ -477,7 +478,7 @@ fn run_namespace_command(.max_blocking_threads(crate::core::runtime::MAX_BLOCKING_THREADS).build()?;let value = rt- .block_on(async { invoke_method(default_state(), &method, Value::Object(params)).await })+ .block_on(async { invoke_method(DispatchCtx::process_default(), default_state(), &method, Value::Object(params)).await }).map_err(anyhow::Error::msg)?;println!("{}", serde_json::to_string_pretty(&value)?);diff --git a/crates/openhuman-core/src/core/dispatch.rs b/crates/openhuman-core/src/core/dispatch.rsindex 5ec70c15fc..0c4d1f328a 100644--- a/crates/openhuman-core/src/core/dispatch.rs+++ b/crates/openhuman-core/src/core/dispatch.rs@@ -3,6 +3,7 @@//! This module coordinates the routing of incoming requests to either the//! core subsystem or the OpenHuman domain-specific handlers.+use crate::core::runtime::DispatchCtx;use crate::core::legacy_aliases::resolve_legacy;use crate::core::rpc_log;use crate::core::types::{AppState, InvocationResult};diff --git a/crates/openhuman-core/src/core/invoke.rs b/crates/openhuman-core/src/core/invoke.rsindex 9e032dfffd..776da91564 100644--- a/crates/openhuman-core/src/core/invoke.rs+++ b/crates/openhuman-core/src/core/invoke.rs@@ -116,7 +116,7 @@ async fn invoke_method_inner(let params_obj = crate::core::params::params_to_object(params.clone())?;// Validate inputs against the schema before calling the handler.all::validate_params(&schema, ¶ms_obj)?;- if let Some(result) = all::try_invoke_registered_rpc(ctx, method, params_obj).await {+ if let Some(result) = all::try_invoke_registered_rpc(ctx.clone(), method, params_obj).await {return result;}log::debug!(diff --git a/crates/openhuman-core/src/core/runtime/builder.rs b/crates/openhuman-core/src/core/runtime/builder.rsindex d22a6dada1..8a653ee0dd 100644--- a/crates/openhuman-core/src/core/runtime/builder.rs+++ b/crates/openhuman-core/src/core/runtime/builder.rs@@ -21,6 +21,7 @@//! See the pluggable-core work (`core::runtime`) for how this fits with//! [`context`](crate::core::runtime::context) and `services`.+use crate::core::runtime::DispatchCtx;use std::sync::Arc;use crate::config::Config;@@ -439,7 +440,7 @@ impl CoreRuntime {) -> Result<serde_json::Value, String> {log::trace!("[core-runtime] invoke_in method={method}");CoreContext::scope(- ctx,+ Arc::clone(&ctx),crate::core::invoke::invoke_method(crate::core::runtime::DispatchCtx::new(ctx),crate::core::invoke::default_state(),diff --git a/crates/openhuman-core/src/desktop/notifications/schemas.rs b/crates/openhuman-core/src/desktop/notifications/schemas.rsindex e569188c2b..a969429618 100644--- a/crates/openhuman-core/src/desktop/notifications/schemas.rs+++ b/crates/openhuman-core/src/desktop/notifications/schemas.rs@@ -3,6 +3,7 @@//!//! Follows the exact pattern from `crates/openhuman-core/src/cron/schemas.rs`.+use crate::core::runtime::DispatchCtx;use serde_json::{Map, Value};use crate::core::all::{ControllerFuture, RegisteredController};@@ -463,43 +464,43 @@ fn schema_unknown() -> ControllerSchema {// Handler wrappers (delegate to rpc.rs)// ─────────────────────────────────────────────────────────────────────────────-fn handle_ingest_wrap(params: Map<String, Value>) -> ControllerFuture {+fn handle_ingest_wrap(_ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {Box::pin(async move { super::rpc::handle_ingest(params).await })}-fn handle_list_wrap(params: Map<String, Value>) -> ControllerFuture {+fn handle_list_wrap(_ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {Box::pin(async move { super::rpc::handle_list(params).await })}-fn handle_mark_read_wrap(params: Map<String, Value>) -> ControllerFuture {+fn handle_mark_read_wrap(_ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {Box::pin(async move { super::rpc::handle_mark_read(params).await })}-fn handle_settings_get_wrap(params: Map<String, Value>) -> ControllerFuture {+fn handle_settings_get_wrap(_ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {Box::pin(async move { super::rpc::handle_settings_get(params).await })}-fn handle_settings_set_wrap(params: Map<String, Value>) -> ControllerFuture {+fn handle_settings_set_wrap(_ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {Box::pin(async move { super::rpc::handle_settings_set(params).await })}-fn handle_dismiss_wrap(params: Map<String, Value>) -> ControllerFuture {+fn handle_dismiss_wrap(_ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {Box::pin(async move { super::rpc::handle_dismiss(params).await })}-fn handle_mark_acted_wrap(params: Map<String, Value>) -> ControllerFuture {+fn handle_mark_acted_wrap(_ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {Box::pin(async move { super::rpc::handle_mark_acted(params).await })}-fn handle_stats_wrap(params: Map<String, Value>) -> ControllerFuture {+fn handle_stats_wrap(_ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {Box::pin(async move { super::rpc::handle_stats(params).await })}-fn handle_core_list_wrap(params: Map<String, Value>) -> ControllerFuture {+fn handle_core_list_wrap(_ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {Box::pin(async move { super::rpc::handle_core_list(params).await })}-fn handle_core_mark_read_wrap(params: Map<String, Value>) -> ControllerFuture {+fn handle_core_mark_read_wrap(_ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {Box::pin(async move { super::rpc::handle_core_mark_read(params).await })}diff --git a/crates/openhuman-core/src/mcp/server/tools/dispatch.rs b/crates/openhuman-core/src/mcp/server/tools/dispatch.rsindex 21a40ca47f..953f1dfeb3 100644--- a/crates/openhuman-core/src/mcp/server/tools/dispatch.rs+++ b/crates/openhuman-core/src/mcp/server/tools/dispatch.rs@@ -1,3 +1,4 @@+use crate::core::runtime::DispatchCtx;use serde_json::{json, Map, Value};use tinyinference_llm::tool::ToolSchema;@@ -135,7 +136,7 @@ pub async fn call_tool(params.keys().collect::<Vec<_>>());- match all::try_invoke_registered_rpc(rpc_method, params).await {+ match all::try_invoke_registered_rpc(DispatchCtx::ambient(), rpc_method, params).await {Some(Ok(value)) => {log::debug!("[mcp_server] tools/call success tool={}", spec.name);Ok(tool_success(value))diff --git a/crates/openhuman-core/src/mcp/server/write_dispatch.rs b/crates/openhuman-core/src/mcp/server/write_dispatch.rsindex efb3e9bc08..ce45f3f1f9 100644--- a/crates/openhuman-core/src/mcp/server/write_dispatch.rs+++ b/crates/openhuman-core/src/mcp/server/write_dispatch.rs@@ -4,6 +4,7 @@//! module. The public surface is consumed only by `tools::call_tool` and//! the protocol layer.+use crate::core::runtime::DispatchCtx;use serde_json::{json, Map, Value};use crate::config::rpc as config_rpc;@@ -71,7 +72,7 @@ pub(super) async fn dispatch_write_tool("[mcp_server] write dispatch invoking rpc");- match all::try_invoke_registered_rpc(rpc_method, params.clone()).await {+ match all::try_invoke_registered_rpc(DispatchCtx::ambient(), rpc_method, params.clone()).await {Some(Ok(value)) => {let item_id = extract_item_id(&value);audit_write(diff --git a/crates/openhuman-core/src/memory/schemas/handlers.rs b/crates/openhuman-core/src/memory/schemas/handlers.rsindex e6d11ec314..f8ee5779c9 100644--- a/crates/openhuman-core/src/memory/schemas/handlers.rs+++ b/crates/openhuman-core/src/memory/schemas/handlers.rs@@ -52,7 +52,7 @@ pub(super) fn engines_list(_ctx: DispatchCtx, params: Map<String, Value>) -> Con})}-pub(super) fn engine_get(params: Map<String, Value>) -> ControllerFuture {+pub(super) fn engine_get(_ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture {Box::pin(async move {parse::<EmptyParams>(params)?;to_json(ops::engine_get(&load().await?).await)diff --git a/crates/openhuman-core/src/security/credentials/tools.rs b/crates/openhuman-core/src/security/credentials/tools.rsindex cffdc84d75..5018153639 100644--- a/crates/openhuman-core/src/security/credentials/tools.rs+++ b/crates/openhuman-core/src/security/credentials/tools.rs@@ -9,6 +9,7 @@//! key storage — is intentionally NOT exposed as agent tools (exfiltration ///! auth-mutation risk). Those stay RPC-only.+use crate::core::runtime::DispatchCtx;use std::sync::Arc;use async_trait::async_trait;@@ -28,7 +29,7 @@ async fn invoke_hosted(method: &str,params: serde_json::Map<String, Value>,) -> anyhow::Result<Value> {- match crate::core::all::try_invoke_registered_rpc(method, params).await {+ match crate::core::all::try_invoke_registered_rpc(DispatchCtx::ambient(), method, params).await {Some(Ok(value)) => Ok(strip_log_envelope(value)),Some(Err(err)) => Err(anyhow::anyhow!("{err}")),None => {diff --git a/crates/openhuman-core/src/security/devices/bus.rs b/crates/openhuman-core/src/security/devices/bus.rsindex b449420add..b3ccd2fcd2 100644--- a/crates/openhuman-core/src/security/devices/bus.rs+++ b/crates/openhuman-core/src/security/devices/bus.rs@@ -7,6 +7,7 @@//! - Persisting the `PairedDevice` record after a successful handshake.//! - Publishing `DomainEvent::DevicePaired / DevicePeerOnline / DevicePeerOffline`.+use crate::core::runtime::DispatchCtx;use std::sync::{Arc, OnceLock};use crate::core::bus::BUS;@@ -604,6 +605,7 @@ async fn handle_encrypted_rpc_frame(channel_id: &str, frame_bytes: &[u8]) {);let result = crate::core::invoke::invoke_method(+ crate::core::runtime::DispatchCtx::process_default(),crate::core::invoke::default_state(),&request.method,request.params,