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
feat(modules): add storage import support for tinymcp
Steven Enamakel8906f0c69441
diff --git a/crates/openhuman-core/src/channels/runtime/startup/delivery_import.rs b/crates/openhuman-core/src/channels/runtime/startup/delivery_import.rsindex 0161797d63..46ac3d4d1d 100644--- a/crates/openhuman-core/src/channels/runtime/startup/delivery_import.rs+++ b/crates/openhuman-core/src/channels/runtime/startup/delivery_import.rs@@ -68,7 +68,7 @@ pub(super) async fn import_legacy_delivery(workspace: &Path) -> anyhow::Result<Olet Some(backend) = crate::storage::installed() else {return Ok(Outcome::NoBackend);};- let scope = crate::modules::storage_host::current_module_scope(MODULE_ID)+ let scope = crate::modules::storage_host::current_module_scope(&crate::core::runtime::DispatchCtx::ambient(), MODULE_ID).map_err(|error| anyhow::anyhow!("resolve the module scope: {:?}", error.kind()))?;let scoped = backend.for_scope(&scope)diff --git a/crates/openhuman-core/src/modules/mod.rs b/crates/openhuman-core/src/modules/mod.rsindex c68471d981..3b6aebf22a 100644--- a/crates/openhuman-core/src/modules/mod.rs+++ b/crates/openhuman-core/src/modules/mod.rs@@ -237,7 +237,7 @@ whereF: std::future::Future<Output = anyhow::Result<T>>,T: std::fmt::Debug + Settled,{- let scope = match storage_host::current_module_scope(module_id) {+ let scope = match storage_host::current_module_scope(&crate::core::runtime::DispatchCtx::ambient(), module_id) {Ok(scope) => format!("{scope:?}"),Err(error) => {log::warn!("[{kind}] legacy storage import skipped: {:?}", error.kind());@@ -327,7 +327,7 @@ pub(crate) fn expiring_blob_module_scopes() -> Vec<crate::storage::Scope> {{[storage_grant_tinyjuice::MODULE_ID].into_iter()- .filter_map(|id| storage_host::current_module_scope(id).ok())+ .filter_map(|id| storage_host::current_module_scope(&crate::core::runtime::DispatchCtx::ambient(), id).ok()).collect()}// Without the loader no module holds blobs.diff --git a/crates/openhuman-core/src/modules/storage_host.rs b/crates/openhuman-core/src/modules/storage_host.rsindex 0f0eb0a978..3c1ac0b362 100644--- a/crates/openhuman-core/src/modules/storage_host.rs+++ b/crates/openhuman-core/src/modules/storage_host.rs@@ -530,11 +530,14 @@ impl BindError {////// When the acting scope cannot be resolved (SaaS mode with no profile) or the/// module id is not a plain name under a profile.-pub(crate) fn current_module_scope(module_id: &str) -> Result<Scope, StorageError> {+pub(crate) fn current_module_scope(+ ctx: &crate::core::runtime::DispatchCtx,+ module_id: &str,+) -> Result<Scope, StorageError> {let saas = crate::core::runtime::mode::is_saas();// A module call arrives on the module bus, outside any turn, so with no// tenant the host's default scope applies (refused in SaaS mode).- let tenant = crate::core::runtime::current_tenant().unwrap_or_default();+ let tenant = ctx.tenant().unwrap_or_default();let base =crate::storage::scope_from(tenant.profile.as_deref(), tenant.agent.as_deref(), saas)?;module_scope(tenant.profile.as_deref(), &base, module_id)@@ -567,7 +570,8 @@ impl Environment for Live {}fn module_scope(&self, module_id: &str) -> Result<Scope, StorageError> {- current_module_scope(module_id)+ // A module's bus call carries no context of its own: it acts as the calling task.+ current_module_scope(&crate::core::runtime::DispatchCtx::ambient(), module_id)}fn grant(&self, module_id: &str) -> Option<StorageGrant> {diff --git a/crates/openhuman-core/src/modules/storage_import_support.rs b/crates/openhuman-core/src/modules/storage_import_support.rsindex 83875a200b..c4b55dc8f3 100644--- a/crates/openhuman-core/src/modules/storage_import_support.rs+++ b/crates/openhuman-core/src/modules/storage_import_support.rs@@ -20,7 +20,7 @@ pub(super) fn module_scope(module_id: &str) -> Result<Option<ScopedStorage>> {let Some(backend) = crate::storage::installed() else {return Ok(None);};- let scope = super::storage_host::current_module_scope(module_id)+ let scope = super::storage_host::current_module_scope(&crate::core::runtime::DispatchCtx::ambient(), module_id).map_err(|error| anyhow!("resolve the module scope: {:?}", error.kind()))?;let scoped = backend.for_scope(&scope)diff --git a/crates/openhuman-core/src/modules/storage_import_tinymcp.rs b/crates/openhuman-core/src/modules/storage_import_tinymcp.rsindex b7c36bf1e3..db517d7bdf 100644--- a/crates/openhuman-core/src/modules/storage_import_tinymcp.rs+++ b/crates/openhuman-core/src/modules/storage_import_tinymcp.rs@@ -73,7 +73,7 @@ pub(crate) async fn import_legacy(data_dir: &Path) -> Result<Outcome> {let Some(backend) = crate::storage::installed() else {return Ok(Outcome::NoBackend);};- let scope = super::storage_host::current_module_scope(MODULE_ID)+ let scope = super::storage_host::current_module_scope(&crate::core::runtime::DispatchCtx::ambient(), MODULE_ID).map_err(|error| anyhow!("resolve the module scope: {:?}", error.kind()))?;let scoped = backend.for_scope(&scope)