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(artifacts): update artifact store initialization logic
Steven Enamakel06f43a11d78d
diff --git a/crates/openhuman-core/src/artifacts/tiny_store.rs b/crates/openhuman-core/src/artifacts/tiny_store.rsindex d0de03703d..2ff896c8fb 100644--- a/crates/openhuman-core/src/artifacts/tiny_store.rs+++ b/crates/openhuman-core/src/artifacts/tiny_store.rs@@ -417,9 +417,14 @@ fn build_artifacts_service(publisher: Option<&super::publisher_slot::ArtifactPublisherBinder>,) -> (Artifacts, Option<Arc<dyn FileStore>>) {let roots = file_roots(workspace_dir, &files, action_dir);- let file_store = crate::storage::sessions::artifact_scoped_for_in(workspace_dir, ctx)- .map(|scoped| Arc::new(tiny_artifacts::BlobFileStore::new(&scoped)) as Arc<dyn FileStore>);- let mut records: Arc<dyn ArtifactStore> = Arc::new(versioned_store(workspace_dir));+ let scoped = crate::storage::sessions::artifact_scoped_for_in(workspace_dir, ctx);+ let file_store = scoped+ .as_ref()+ .map(|scoped| Arc::new(tiny_artifacts::BlobFileStore::new(scoped)) as Arc<dyn FileStore>);+ let mut records: Arc<dyn ArtifactStore> = Arc::new(match scoped.as_ref() {+ Some(scoped) => super::version_documents::DocumentArtifactStore::over(workspace_dir, scoped),+ None => versioned_store(workspace_dir),+ });if let Some(store) = file_store.as_ref() {records = Arc::new(LegacyFileImportStore {records,diff --git a/crates/openhuman-core/src/artifacts/version_documents.rs b/crates/openhuman-core/src/artifacts/version_documents.rsindex 20c8e50b1b..99804ed5ce 100644--- a/crates/openhuman-core/src/artifacts/version_documents.rs+++ b/crates/openhuman-core/src/artifacts/version_documents.rs@@ -31,6 +31,7 @@ use tinystoragedrivers::{CollectionSpec, Precondition, Query, Sort};use super::storage_schema::{VERSIONS, version_body, version_record};use crate::storage::DocumentStoreExt;use crate::storage::documents::Repo;+use crate::storage::ScopedStorage;use crate::storage::schema_support::key_of;const DOMAIN: &str = "artifacts::versions";@@ -43,6 +44,7 @@ fn collections() -> Vec<CollectionSpec> {#[derive(Clone, Debug)]pub struct DocumentArtifactStore {workspace_dir: PathBuf,+ scoped: Option<ScopedStorage>,}impl DocumentArtifactStore {@@ -50,6 +52,16 @@ impl DocumentArtifactStore {pub fn new(workspace_dir: impl Into<PathBuf>) -> Self {Self {workspace_dir: workspace_dir.into(),+ scoped: None,+ }+ }++ /// The version records over the same explicit tenant scope as this+ /// artifact service's file store.+ pub fn over(workspace_dir: impl Into<PathBuf>, scoped: &ScopedStorage) -> Self {+ Self {+ workspace_dir: workspace_dir.into(),+ scoped: Some(scoped.clone()),}}@@ -61,7 +73,10 @@ impl DocumentArtifactStore {/// The repo for this call (resolved here, in the caller's context, for its/// scope), after the one-time legacy import.async fn repo(&self) -> Result<Repo> {- let repo = Repo::current_for(&self.workspace_dir, DOMAIN, collections)?;+ let repo = match &self.scoped {+ Some(scoped) => Repo::over(scoped, DOMAIN, collections),+ None => Repo::current_for(&self.workspace_dir, DOMAIN, collections)?,+ };let legacy = self.legacy_dir();on_blocking(repo.clone(), move |repo| {let key = legacy.display().to_string();