Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

feat(artifacts): add file store factory function

Steven Enamakel663b1b4b1dc2
diff --git a/crates/openhuman-core/src/artifacts/tiny_store.rs b/crates/openhuman-core/src/artifacts/tiny_store.rs
index 1c34d36088..421f745ec0 100644
--- a/crates/openhuman-core/src/artifacts/tiny_store.rs
+++ b/crates/openhuman-core/src/artifacts/tiny_store.rs
@@ -300,6 +300,14 @@ pub fn guarded_roots(roots: Vec<PathBuf>) -> tiny_artifacts::FileRoots {
tiny_artifacts::FileRoots::new(roots).with_guard(refused_path)
}
+pub(crate) fn file_store_for(
+ workspace_dir: &Path,
+ ctx: &crate::core::runtime::DispatchCtx,
+) -> Option<Arc<dyn FileStore>> {
+ crate::storage::sessions::artifact_scoped_for_in(workspace_dir, ctx)
+ .map(|scoped| Arc::new(tiny_artifacts::BlobFileStore::new(&scoped)) as Arc<dyn FileStore>)
+}
+
/// The artifact service for one workspace: OpenHuman's store and UI bridge,
/// with file artifacts allowed from [`file_roots`]. Cards are announced to
/// `chat`, the turn making the change (`None` outside a chat turn).
@@ -311,8 +319,7 @@ pub fn artifacts_service(
ctx: &crate::core::runtime::DispatchCtx,
) -> Artifacts {
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 file_store = file_store_for(workspace_dir, ctx);
let mut artifacts = Artifacts::new(Arc::new(versioned_store(workspace_dir)))
.with_observer(Arc::new(LegacyUiBridge::new(
workspace_dir,