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): simplify document artifact store creation
Steven Enamakel19ebb025c6a6
diff --git a/crates/openhuman-core/src/artifacts/tiny_store.rs b/crates/openhuman-core/src/artifacts/tiny_store.rsindex 2ff896c8fb..119d324cc2 100644--- a/crates/openhuman-core/src/artifacts/tiny_store.rs+++ b/crates/openhuman-core/src/artifacts/tiny_store.rs@@ -422,7 +422,9 @@ fn build_artifacts_service(.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),+ Some(scoped) => {+ super::version_documents::DocumentArtifactStore::over(workspace_dir, scoped)+ }None => versioned_store(workspace_dir),});if let Some(store) = file_store.as_ref() {diff --git a/crates/openhuman-core/src/artifacts/tiny_store_tests.rs b/crates/openhuman-core/src/artifacts/tiny_store_tests.rsindex c7b7814303..807575f538 100644--- a/crates/openhuman-core/src/artifacts/tiny_store_tests.rs+++ b/crates/openhuman-core/src/artifacts/tiny_store_tests.rs@@ -92,6 +92,71 @@ async fn legacy_path_refs_are_guarded_and_imported_as_opaque_file_keys() {assert!(importing.get("a-outside").await.is_err());}+#[tokio::test]+async fn explicit_artifact_context_binds_records_and_blobs_to_the_same_profile() {+ use crate::core::runtime::{ContextOverlay, CoreContext, DispatchCtx, DomainSet};++ let (workspace, files) = temp_dirs();+ let source = files.join("deck.pptx");+ std::fs::write(&source, b"profile-a-bytes").unwrap();+ let context_for = |profile: &'static str| {+ let overlay = ContextOverlay::new(+ crate::config::Config::default(),+ DomainSet::kernel(),+ crate::tools::toolpacks::ToolGroups::none(),+ )+ .profile(profile);+ CoreContext::for_test(DomainSet::full(), None).derive_with(overlay)+ };+ let context_a = DispatchCtx::new(context_for("artifact-a"));+ let context_b = DispatchCtx::new(context_for("ambient-b"));++ CoreContext::scope(context_for("ambient-b"), async {+ let (artifacts_a, files_a) = artifacts_service_with_file_store(+ &workspace,+ FileRoots::new(&files),+ None,+ None,+ &context_a,+ );+ let created = artifacts_a+ .create(+ ArtifactKind::File,+ "Deck",+ Content::File(source.display().to_string()),+ &Author::agent("agent-a"),+ None,+ )+ .await+ .unwrap();+ let id = created.record.id;+ let file = created.record.latest().unwrap().file.as_ref().unwrap();+ assert_eq!(+ files_a.as_ref().unwrap().read(&file.key).await.unwrap(),+ b"profile-a-bytes"+ );++ let (artifacts_b, files_b) = artifacts_service_with_file_store(+ &workspace,+ FileRoots::new(&files),+ None,+ None,+ &context_b,+ );+ assert!(artifacts_b.get(&id).await.unwrap().is_none());+ assert!(+ files_b+ .as_ref()+ .unwrap()+ .metadata(&file.key)+ .await+ .unwrap()+ .is_none()+ );+ })+ .await;+}+#[tokio::test]async fn an_edit_is_appended_as_an_operator_version_and_written_to_the_file() {let (workspace, files) = temp_dirs();diff --git a/crates/openhuman-core/src/artifacts/version_documents.rs b/crates/openhuman-core/src/artifacts/version_documents.rsindex 99804ed5ce..7679436488 100644--- a/crates/openhuman-core/src/artifacts/version_documents.rs+++ b/crates/openhuman-core/src/artifacts/version_documents.rs@@ -30,8 +30,8 @@ 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::documents::Repo;use crate::storage::schema_support::key_of;const DOMAIN: &str = "artifacts::versions";