Skip to content

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

chore: files changed crates/openhuman-core/src/agent/artifacts/store.rs,crates/openhuman-core/src/ag

Steven Enamakelbceef3b935fa
diff --git a/crates/openhuman-core/src/agent/artifacts/store.rs b/crates/openhuman-core/src/agent/artifacts/store.rs
index 2011d3f8e5..2d4f7e6cae 100644
--- a/crates/openhuman-core/src/agent/artifacts/store.rs
+++ b/crates/openhuman-core/src/agent/artifacts/store.rs
@@ -40,7 +40,8 @@ async fn on_docs<T: Send + 'static>(
/// The first call that finds it empty imports the workspace's legacy
/// `meta.json` / `args.json` files.
async fn documents(workspace_dir: &Path) -> Result<Option<Docs>, String> {
- let Some(docs) = store_documents::current().map_err(|e| format!("[artifacts] storage: {e:#}"))?
+ let Some(docs) =
+ store_documents::current().map_err(|e| format!("[artifacts] storage: {e:#}"))?
else {
return Ok(None);
};
@@ -49,7 +50,9 @@ async fn documents(workspace_dir: &Path) -> Result<Option<Docs>, String> {
let scope = crate::storage::current_scope().map_err(|e| format!("[artifacts] storage: {e}"))?;
let key = format!("{scope}|{}", workspace_dir.display());
let first = {
- let mut seen = IMPORTED.lock().unwrap_or_else(std::sync::PoisonError::into_inner);
+ let mut seen = IMPORTED
+ .lock()
+ .unwrap_or_else(std::sync::PoisonError::into_inner);
if seen.contains(&key) {
false
} else {
@@ -59,7 +62,10 @@ async fn documents(workspace_dir: &Path) -> Result<Option<Docs>, String> {
};
if first {
let legacy = workspace_dir.join(ARTIFACTS_SUBDIR);
- on_docs(docs.clone(), move |docs| docs.import_legacy(&legacy).map(|_| ())).await?;
+ on_docs(docs.clone(), move |docs| {
+ docs.import_legacy(&legacy).map(|_| ())
+ })
+ .await?;
}
Ok(Some(docs))
}
diff --git a/crates/openhuman-core/src/agent/artifacts/store_documents.rs b/crates/openhuman-core/src/agent/artifacts/store_documents.rs
index ef86e9d5ea..4ac519fe3c 100644
--- a/crates/openhuman-core/src/agent/artifacts/store_documents.rs
+++ b/crates/openhuman-core/src/agent/artifacts/store_documents.rs
@@ -137,7 +137,9 @@ impl Docs {
pub(super) fn get_args(&self, id: &str) -> Result<Option<Value>> {
let id = id.to_string();
- let stored = self.0.run(|docs| async move { docs.get(ARGS, &id).await })?;
+ let stored = self
+ .0
+ .run(|docs| async move { docs.get(ARGS, &id).await })?;
Ok(stored.and_then(|stored| stored.doc.get("args").cloned()))
}
diff --git a/crates/openhuman-core/src/agent/artifacts/store_documents_tests.rs b/crates/openhuman-core/src/agent/artifacts/store_documents_tests.rs
index c4066cb43c..9719b07e70 100644
--- a/crates/openhuman-core/src/agent/artifacts/store_documents_tests.rs
+++ b/crates/openhuman-core/src/agent/artifacts/store_documents_tests.rs
@@ -35,7 +35,12 @@ fn records_round_trip_newest_first() {
docs.put_meta(&meta("a", 1, None)).unwrap();
docs.put_meta(&meta("c", 3, None)).unwrap();
docs.put_meta(&meta("b", 2, None)).unwrap();
- let ids: Vec<_> = docs.list_meta().unwrap().into_iter().map(|m| m.id).collect();
+ let ids: Vec<_> = docs
+ .list_meta()
+ .unwrap()
+ .into_iter()
+ .map(|m| m.id)
+ .collect();
assert_eq!(ids, ["c", "b", "a"]);
assert_eq!(docs.get_meta("b").unwrap().unwrap().title, "title b");
assert!(docs.get_meta("missing").unwrap().is_none());
@@ -56,7 +61,9 @@ fn args_and_delete() {
#[test]
fn scopes_do_not_see_each_others_artifacts() {
let storage = MemoryStorage::new();
- docs_in(&storage, "alice").put_meta(&meta("a", 1, None)).unwrap();
+ docs_in(&storage, "alice")
+ .put_meta(&meta("a", 1, None))
+ .unwrap();
assert!(docs_in(&storage, "bob").list_meta().unwrap().is_empty());
assert_eq!(docs_in(&storage, "alice").list_meta().unwrap().len(), 1);
}
@@ -66,8 +73,11 @@ fn the_legacy_files_are_imported_once_into_an_empty_collection() {
let dir = tempfile::tempdir().unwrap();
let a = dir.path().join("a");
std::fs::create_dir_all(&a).unwrap();
- std::fs::write(a.join("meta.json"), serde_json::to_string(&meta("a", 1, Some("t"))).unwrap())
- .unwrap();
+ std::fs::write(
+ a.join("meta.json"),
+ serde_json::to_string(&meta("a", 1, Some("t"))).unwrap(),
+ )
+ .unwrap();
std::fs::write(a.join("args.json"), r#"{"x":2}"#).unwrap();
let bad = dir.path().join("bad");
std::fs::create_dir_all(&bad).unwrap();
@@ -75,7 +85,10 @@ fn the_legacy_files_are_imported_once_into_an_empty_collection() {
let docs = docs_in(&MemoryStorage::new(), "local");
assert_eq!(docs.import_legacy(dir.path()).unwrap(), 1);
- assert_eq!(docs.get_meta("a").unwrap().unwrap().thread_id.as_deref(), Some("t"));
+ assert_eq!(
+ docs.get_meta("a").unwrap().unwrap().thread_id.as_deref(),
+ Some("t")
+ );
assert_eq!(docs.get_args("a").unwrap().unwrap()["x"], 2);
// A non-empty collection is not imported over.
assert_eq!(docs.import_legacy(dir.path()).unwrap(), 0);
@@ -90,8 +103,12 @@ async fn the_store_dispatches_to_documents_when_a_backend_is_pinned() {
let ws = workspace.path();
store_documents::TEST_OVERRIDE.with(|slot| *slot.borrow_mut() = Some(docs.clone()));
- save_artifact_meta(ws, &meta("a", 1, Some("t1"))).await.unwrap();
- save_artifact_meta(ws, &meta("b", 2, Some("t2"))).await.unwrap();
+ save_artifact_meta(ws, &meta("a", 1, Some("t1")))
+ .await
+ .unwrap();
+ save_artifact_meta(ws, &meta("b", 2, Some("t2")))
+ .await
+ .unwrap();
assert_eq!(get_artifact(ws, "a").await.unwrap().id, "a");
assert!(get_artifact(ws, "zz").await.is_err());
let (page, total) = list_artifacts(ws, 0, 10, Some("t1")).await.unwrap();
@@ -99,11 +116,15 @@ async fn the_store_dispatches_to_documents_when_a_backend_is_pinned() {
let (all, _) = list_artifacts(ws, 0, 10, None).await.unwrap();
assert_eq!(all[0].id, "b");
- save_artifact_args(ws, "a", &serde_json::json!({ "n": 1 })).await.unwrap();
+ save_artifact_args(ws, "a", &serde_json::json!({ "n": 1 }))
+ .await
+ .unwrap();
assert_eq!(read_artifact_args(ws, "a").await.unwrap()["n"], 1);
assert!(read_artifact_args(ws, "b").await.is_err());
- delete_artifact(ws, FileRoots::from(ws.to_path_buf()), "a").await.unwrap();
+ delete_artifact(ws, FileRoots::from(ws.to_path_buf()), "a")
+ .await
+ .unwrap();
store_documents::TEST_OVERRIDE.with(|slot| *slot.borrow_mut() = None);
assert!(docs.get_meta("a").unwrap().is_none());
diff --git a/crates/openhuman-core/src/agent/orchestration/subagent_sessions/store_documents_tests.rs b/crates/openhuman-core/src/agent/orchestration/subagent_sessions/store_documents_tests.rs
index 8420b1eb5a..d0b6c41e1c 100644
--- a/crates/openhuman-core/src/agent/orchestration/subagent_sessions/store_documents_tests.rs
+++ b/crates/openhuman-core/src/agent/orchestration/subagent_sessions/store_documents_tests.rs
@@ -133,6 +133,9 @@ fn a_stale_snapshot_does_not_revert_a_newer_session() {
let loaded = docs.load().unwrap();
assert_eq!(loaded.len(), 2);
- let a = loaded.iter().find(|s| s.subagent_session_id == "a").unwrap();
+ let a = loaded
+ .iter()
+ .find(|s| s.subagent_session_id == "a")
+ .unwrap();
assert_eq!(a.status, DurableSubagentStatus::Failed);
}
diff --git a/crates/openhuman-core/src/integrations/composio/file_store.rs b/crates/openhuman-core/src/integrations/composio/file_store.rs
index 1fbdc1058f..49a1103b18 100644
--- a/crates/openhuman-core/src/integrations/composio/file_store.rs
+++ b/crates/openhuman-core/src/integrations/composio/file_store.rs
@@ -97,8 +97,18 @@ where
let owned = path.to_path_buf();
return tokio::task::spawn_blocking(move || docs.update(&owned, change))
.await
- .map_err(|error| format!("[composio:store] updating {} failed: {error}", path.display()))?
- .map_err(|error| format!("[composio:store] updating {} failed: {error:#}", path.display()));
+ .map_err(|error| {
+ format!(
+ "[composio:store] updating {} failed: {error}",
+ path.display()
+ )
+ })?
+ .map_err(|error| {
+ format!(
+ "[composio:store] updating {} failed: {error:#}",
+ path.display()
+ )
+ });
}
let _guard = lock().await;
let mut value: T = load(path).await?;