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(storage): add conditioned repository opening
Steven Enamakele195274d6238
diff --git a/crates/openhuman-core/src/storage/documents.rs b/crates/openhuman-core/src/storage/documents.rsindex 41d8d0a4fb..dbcd915e35 100644--- a/crates/openhuman-core/src/storage/documents.rs+++ b/crates/openhuman-core/src/storage/documents.rs@@ -15,6 +15,7 @@ use std::sync::{Arc, LazyLock, Mutex, PoisonError, Weak};use anyhow::{Context, Result, anyhow};use serde_json::Value;use tinystoragedrivers::{CollectionSpec, ErrorKind, Precondition, Versioned};+use tinystoragedrivers::WriteCondition;use super::{DocumentStore, Scope, Storage, StorageBackend, StorageError, block_on, current_scope, installed,@@ -190,6 +191,32 @@ impl Repo {&self.scoped}+ pub(crate) fn origin_scope(&self) -> Option<&str> {+ self.origin.as_ref().map(|origin| origin.scope.as_str())+ }++ /// Opens the same owner scope with an additional storage-driver write+ /// condition. The backend remains responsible for composing any host+ /// profile fence with `condition` atomically.+ ///+ /// Repos made with [`Repo::over`] have no backend/scope origin and cannot+ /// be rebound safely; callers must use an explicitly opened repo for+ /// claim-bound imports.+ pub(crate) fn conditioned(&self, condition: &WriteCondition) -> Result<Self> {+ let origin = self.origin.as_ref().ok_or_else(|| {+ anyhow!("[{}] claim-bound storage requires an opened backend scope", self.domain)+ })?;+ let scope = Scope::new(&origin.scope)+ .with_context(|| format!("[{}] parse the storage scope", self.domain))?;+ let scoped = origin+ .backend+ .for_scope_conditioned(&scope, condition)+ .with_context(|| format!("[{}] bind the import claim to storage writes", self.domain))?;+ let mut repo = Self::over(&scoped, self.domain, self.collections);+ repo.origin = Some(origin.clone());+ Ok(repo)+ }+/// Runs `f` once per process for this repo's backend instance, scope and/// `key` (a legacy import keyed by its source path). Calls are serialized,/// and the run is recorded only when `f` succeeds, so a failed one is