Skip to content

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

style: apply rustfmt formatting to composio and subagent store code

Steven Enamakel4dce19dfa9df
diff --git a/crates/openhuman-core/src/agent/orchestration/running_subagents/task_ledger_documents.rs b/crates/openhuman-core/src/agent/orchestration/running_subagents/task_ledger_documents.rs
index 7c74df51ca..0b174260ea 100644
--- a/crates/openhuman-core/src/agent/orchestration/running_subagents/task_ledger_documents.rs
+++ b/crates/openhuman-core/src/agent/orchestration/running_subagents/task_ledger_documents.rs
@@ -85,7 +85,10 @@ impl DocumentTaskStore {
history.insert(record.spec.task_id.clone(), timeline);
latest.push(record);
}
- log::debug!("[running_subagents] opened document task ledger tasks={}", latest.len());
+ log::debug!(
+ "[running_subagents] opened document task ledger tasks={}",
+ latest.len()
+ );
Ok(Self {
inner: InMemoryTaskStore::from_records(latest),
repo,
@@ -111,7 +114,9 @@ impl DocumentTaskStore {
let id = task_id.as_str().to_string();
self.repo
.run(|docs| async move {
- docs.put(TASKS, &id, doc, Precondition::None).await.map(|_| ())
+ docs.put(TASKS, &id, doc, Precondition::None)
+ .await
+ .map(|_| ())
})
.map_err(|error| graph_error("write task ledger", error))
}
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 52dc239587..70bb85bdba 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
@@ -1,6 +1,6 @@
use super::*;
-use crate::agent::orchestration::subagent_sessions::types::SubagentSessionStore;
use crate::agent::orchestration::subagent_sessions::types::DurableSubagentStatus;
+use crate::agent::orchestration::subagent_sessions::types::SubagentSessionStore;
use crate::storage::{MemoryStorage, Scope, StorageBackend};
fn docs_in(storage: &MemoryStorage, scope: &str) -> Docs {
@@ -34,7 +34,10 @@ fn session(id: &str) -> DurableSubagentSession {
#[test]
fn a_missing_list_loads_empty() {
- assert!(docs_in(&MemoryStorage::new(), "local").load().unwrap().is_empty());
+ assert!(docs_in(&MemoryStorage::new(), "local")
+ .load()
+ .unwrap()
+ .is_empty());
}
#[test]
@@ -65,6 +68,9 @@ fn the_file_store_still_works_with_no_backend() {
let store = SubagentSessionStore::new(dir.path().to_path_buf());
assert!(store.load().unwrap().is_empty());
store.save(&[session("a")]).unwrap();
- assert!(dir.path().join(".openhuman/subagent_sessions.json").exists());
+ assert!(dir
+ .path()
+ .join(".openhuman/subagent_sessions.json")
+ .exists());
assert_eq!(store.load().unwrap().len(), 1);
}
diff --git a/crates/openhuman-core/src/integrations/composio/file_store.rs b/crates/openhuman-core/src/integrations/composio/file_store.rs
index 3c5eaf9320..a515f4ccf9 100644
--- a/crates/openhuman-core/src/integrations/composio/file_store.rs
+++ b/crates/openhuman-core/src/integrations/composio/file_store.rs
@@ -44,10 +44,15 @@ pub(crate) async fn load<T>(path: &Path) -> Result<T, String>
where
T: DeserializeOwned + Default,
{
- if let Some(docs) = super::file_store_documents::current().map_err(|e| format!("[composio:store] {e:#}"))? {
- return docs
- .load(path)
- .map_err(|error| format!("[composio:store] reading {} failed: {error:#}", path.display()));
+ if let Some(docs) =
+ super::file_store_documents::current().map_err(|e| format!("[composio:store] {e:#}"))?
+ {
+ return docs.load(path).map_err(|error| {
+ format!(
+ "[composio:store] reading {} failed: {error:#}",
+ path.display()
+ )
+ });
}
let bytes = match tokio::fs::read(path).await {
Ok(bytes) => bytes,
@@ -76,10 +81,15 @@ pub(crate) async fn save<T>(path: &Path, value: &T) -> Result<(), String>
where
T: Serialize,
{
- if let Some(docs) = super::file_store_documents::current().map_err(|e| format!("[composio:store] {e:#}"))? {
- return docs
- .save(path, value)
- .map_err(|error| format!("[composio:store] writing {} failed: {error:#}", path.display()));
+ if let Some(docs) =
+ super::file_store_documents::current().map_err(|e| format!("[composio:store] {e:#}"))?
+ {
+ return docs.save(path, value).map_err(|error| {
+ format!(
+ "[composio:store] writing {} failed: {error:#}",
+ path.display()
+ )
+ });
}
let bytes = serde_json::to_vec_pretty(value)
.map_err(|error| format!("[composio:store] serializing failed: {error}"))?;
diff --git a/crates/openhuman-core/src/integrations/composio/file_store_documents.rs b/crates/openhuman-core/src/integrations/composio/file_store_documents.rs
index 95de116621..ffd42824e4 100644
--- a/crates/openhuman-core/src/integrations/composio/file_store_documents.rs
+++ b/crates/openhuman-core/src/integrations/composio/file_store_documents.rs
@@ -54,7 +54,9 @@ impl Docs {
/// The value stored for the file `path` names, or `T::default()`.
pub(super) fn load<T: DeserializeOwned + Default>(&self, path: &Path) -> Result<T> {
let id = id_of(path)?;
- let stored = self.0.run(|docs| async move { docs.get(STATE, &id).await })?;
+ let stored = self
+ .0
+ .run(|docs| async move { docs.get(STATE, &id).await })?;
match stored.and_then(|stored| stored.doc.get("value").cloned()) {
Some(value) => Ok(serde_json::from_value(value)?),
None => Ok(T::default()),
diff --git a/crates/openhuman-core/src/integrations/composio/file_store_documents_tests.rs b/crates/openhuman-core/src/integrations/composio/file_store_documents_tests.rs
index 27d5da1c7e..3d1503293d 100644
--- a/crates/openhuman-core/src/integrations/composio/file_store_documents_tests.rs
+++ b/crates/openhuman-core/src/integrations/composio/file_store_documents_tests.rs
@@ -13,8 +13,9 @@ fn path() -> PathBuf {
#[test]
fn a_missing_file_loads_the_default() {
- let loaded: BTreeMap<String, u32> =
- docs_in(&MemoryStorage::new(), "local").load(&path()).unwrap();
+ let loaded: BTreeMap<String, u32> = docs_in(&MemoryStorage::new(), "local")
+ .load(&path())
+ .unwrap();
assert!(loaded.is_empty());
}