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
refactor(storage): simplify storage import calls
Steven Enamakel4c1109fd7062
diff --git a/crates/openhuman-core/src/modules/storage_import_support.rs b/crates/openhuman-core/src/modules/storage_import_support.rsindex bd74cb730c..aef6ce6f1a 100644--- a/crates/openhuman-core/src/modules/storage_import_support.rs+++ b/crates/openhuman-core/src/modules/storage_import_support.rs@@ -74,22 +74,14 @@ where.for_scope(&claim_scope).map_err(|error| anyhow!("open claim-bound module storage: {:?}", error.kind()))?;crate::storage::block_on_anyhow(async move {- if crate::storage::import_state::host_import_done(- &scoped,- &marker_kind,- &marker_id,- )- .await?+ if crate::storage::import_state::host_import_done(&scoped, &marker_kind, &marker_id)+ .await?{return Ok(ClaimedImport::AlreadyDone);}let result = body(scoped.clone())?;- crate::storage::import_state::host_import_mark(- &scoped,- &marker_kind,- &marker_id,- )- .await?;+ crate::storage::import_state::host_import_mark(&scoped, &marker_kind, &marker_id)+ .await?;Ok(ClaimedImport::Imported(result))})},diff --git a/crates/openhuman-core/src/modules/storage_import_tinybox.rs b/crates/openhuman-core/src/modules/storage_import_tinybox.rsindex e94d01c681..302feca11a 100644--- a/crates/openhuman-core/src/modules/storage_import_tinybox.rs+++ b/crates/openhuman-core/src/modules/storage_import_tinybox.rs@@ -59,9 +59,10 @@ pub(crate) async fn import_legacy(ctx: &DispatchCtx, workspace_dir: &Path) -> Rereturn Ok(Outcome::NoSource);}let marker = support::marker_id("tinybox", &base);- let result = support::with_module_claim(ctx, MODULE_ID, MARKER_COLLECTION, &marker, move |scoped| {- crate::storage::block_on_anyhow(async move { import_into(&scoped, &base).await })- })?;+ let result =+ support::with_module_claim(ctx, MODULE_ID, MARKER_COLLECTION, &marker, move |scoped| {+ crate::storage::block_on_anyhow(async move { import_into(&scoped, &base).await })+ })?;let Some(result) = result else {return Ok(Outcome::NoBackend);};diff --git a/crates/openhuman-core/src/modules/storage_import_tinyconnectors.rs b/crates/openhuman-core/src/modules/storage_import_tinyconnectors.rsindex d78b2ed52d..119f2e06f4 100644--- a/crates/openhuman-core/src/modules/storage_import_tinyconnectors.rs+++ b/crates/openhuman-core/src/modules/storage_import_tinyconnectors.rs@@ -70,11 +70,12 @@ pub(crate) async fn import_legacy(ctx: &DispatchCtx, state_dir: &Path) -> Resultlet marker = support::marker_id("connectors", state_dir);let state_dir = state_dir.to_owned();let ctx_for_read = ctx.clone();- let result = support::with_module_claim(ctx, MODULE_ID, MARKER_COLLECTION, &marker, move |scoped| {- crate::storage::block_on_anyhow(async move {- import_into(&ctx_for_read, &scoped, &state_dir).await- })- })?;+ let result =+ support::with_module_claim(ctx, MODULE_ID, MARKER_COLLECTION, &marker, move |scoped| {+ crate::storage::block_on_anyhow(async move {+ import_into(&ctx_for_read, &scoped, &state_dir).await+ })+ })?;let Some(result) = result else {return Ok(Outcome::NoBackend);};diff --git a/crates/openhuman-core/src/modules/storage_import_tinyjuice.rs b/crates/openhuman-core/src/modules/storage_import_tinyjuice.rsindex 9d6b1fd2a0..b8d389c019 100644--- a/crates/openhuman-core/src/modules/storage_import_tinyjuice.rs+++ b/crates/openhuman-core/src/modules/storage_import_tinyjuice.rs@@ -78,11 +78,12 @@ pub(crate) async fn import_legacy(let marker = support::marker_id("ccr", root);let root = root.to_owned();let ctx_for_read = ctx.clone();- let result = support::with_module_claim(ctx, MODULE_ID, MARKER_COLLECTION, &marker, move |scoped| {- crate::storage::block_on_anyhow(async move {- import_into(&ctx_for_read, &scoped, &root, ttl, SystemTime::now()).await- })- })?;+ let result =+ support::with_module_claim(ctx, MODULE_ID, MARKER_COLLECTION, &marker, move |scoped| {+ crate::storage::block_on_anyhow(async move {+ import_into(&ctx_for_read, &scoped, &root, ttl, SystemTime::now()).await+ })+ })?;let Some(result) = result else {return Ok(Outcome::NoBackend);};diff --git a/crates/openhuman-core/src/modules/storage_import_tinyjuice_savings.rs b/crates/openhuman-core/src/modules/storage_import_tinyjuice_savings.rsindex 981dc168b5..7dad421b34 100644--- a/crates/openhuman-core/src/modules/storage_import_tinyjuice_savings.rs+++ b/crates/openhuman-core/src/modules/storage_import_tinyjuice_savings.rs@@ -69,17 +69,9 @@ where}let marker = support::marker_id("savings", file);let file = file.to_owned();- let result = support::with_module_claim(- ctx,- MODULE_ID,- MARKER_KIND,- &marker,- move |scoped| {- crate::storage::block_on_anyhow(async move {- import_into(&scoped, &file, adopt).await- })- },- )?;+ let result = support::with_module_claim(ctx, MODULE_ID, MARKER_KIND, &marker, move |scoped| {+ crate::storage::block_on_anyhow(async move { import_into(&scoped, &file, adopt).await })+ })?;let Some(result) = result else {return Ok(Outcome::NoBackend);};diff --git a/crates/openhuman-core/src/modules/storage_import_tinywallet.rs b/crates/openhuman-core/src/modules/storage_import_tinywallet.rsindex 78bb097b4c..0787fb8819 100644--- a/crates/openhuman-core/src/modules/storage_import_tinywallet.rs+++ b/crates/openhuman-core/src/modules/storage_import_tinywallet.rs@@ -57,17 +57,12 @@ pub(crate) async fn import_legacy(ctx: &DispatchCtx, workspace_dir: &Path) -> Relet marker = support::marker_id("x402", workspace_dir);let workspace_dir = workspace_dir.to_owned();let ctx_for_read = ctx.clone();- let result = support::with_module_claim(- ctx,- MODULE_ID,- MARKER_COLLECTION,- &marker,- move |scoped| {+ let result =+ support::with_module_claim(ctx, MODULE_ID, MARKER_COLLECTION, &marker, move |scoped| {crate::storage::block_on_anyhow(async move {import_into(&ctx_for_read, &scoped, &workspace_dir).await})- },- )?;+ })?;let Some(result) = result else {return Ok(Outcome::NoBackend);};