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

Steven Enamakelfa336b98c477
diff --git a/crates/openhuman-core/src/agent/tinyagents/journal.rs b/crates/openhuman-core/src/agent/tinyagents/journal.rs
index 71933f5e3b..ef137e8730 100644
--- a/crates/openhuman-core/src/agent/tinyagents/journal.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/journal.rs
@@ -107,7 +107,9 @@ async fn resolve_workspace() -> anyhow::Result<PathBuf> {
/// ([`crate::agent::session_store::try_current`]), else the workspace's
/// `tinyagents_store/`.
async fn journal_stores() -> anyhow::Result<(Arc<dyn AppendStore>, Arc<dyn Store>)> {
- if let Some(stores) = crate::agent::session_store::try_current().map_err(|e| anyhow::anyhow!(e))? {
+ if let Some(stores) =
+ crate::agent::session_store::try_current().map_err(|e| anyhow::anyhow!(e))?
+ {
log::debug!("[journal] using the host session store");
return Ok((stores.journal, stores.kv));
}
diff --git a/crates/openhuman-core/src/storage/documents.rs b/crates/openhuman-core/src/storage/documents.rs
index ed0b7e5738..095ea5c69f 100644
--- a/crates/openhuman-core/src/storage/documents.rs
+++ b/crates/openhuman-core/src/storage/documents.rs
@@ -37,7 +37,11 @@ fn backend_addr(backend: &Arc<dyn StorageBackend>) -> usize {
/// Whether `collection` was already declared on `backend` under `scope`.
fn is_declared(backend: &Arc<dyn StorageBackend>, scope: &str, collection: &str) -> bool {
- let key = (backend_addr(backend), scope.to_string(), collection.to_string());
+ let key = (
+ backend_addr(backend),
+ scope.to_string(),
+ collection.to_string(),
+ );
DECLARED
.lock()
.unwrap_or_else(PoisonError::into_inner)
@@ -49,7 +53,11 @@ fn is_declared(backend: &Arc<dyn StorageBackend>, scope: &str, collection: &str)
/// Records that `collection` is declared on `backend` under `scope`, and
/// forgets entries whose backend is gone.
fn mark_declared(backend: &Arc<dyn StorageBackend>, scope: &str, collection: &str) {
- let key = (backend_addr(backend), scope.to_string(), collection.to_string());
+ let key = (
+ backend_addr(backend),
+ scope.to_string(),
+ collection.to_string(),
+ );
let mut declared = DECLARED.lock().unwrap_or_else(PoisonError::into_inner);
declared.retain(|_, weak| weak.strong_count() > 0);
declared.insert(key, Arc::downgrade(backend));
@@ -131,9 +139,9 @@ impl Repo {
let specs: Vec<CollectionSpec> = (self.collections)()
.into_iter()
.filter(|spec| {
- origin.as_ref().is_none_or(|origin| {
- !is_declared(&origin.backend, &origin.scope, &spec.name)
- })
+ origin
+ .as_ref()
+ .is_none_or(|origin| !is_declared(&origin.backend, &origin.scope, &spec.name))
})
.collect();
let future = op(Arc::clone(&docs));
diff --git a/crates/openhuman-core/src/storage/documents_tests.rs b/crates/openhuman-core/src/storage/documents_tests.rs
index 6c11373fb1..21ea192fca 100644
--- a/crates/openhuman-core/src/storage/documents_tests.rs
+++ b/crates/openhuman-core/src/storage/documents_tests.rs
@@ -139,8 +139,14 @@ fn a_collection_is_declared_once_per_backend_scope_and_name() {
mark_declared(&backend, "local", THINGS);
assert!(is_declared(&backend, "local", THINGS));
assert!(!is_declared(&backend, "agent-b", THINGS), "another scope");
- assert!(!is_declared(&backend, "local", "other"), "another collection");
- assert!(!is_declared(&self::backend(), "local", THINGS), "another backend");
+ assert!(
+ !is_declared(&backend, "local", "other"),
+ "another collection"
+ );
+ assert!(
+ !is_declared(&self::backend(), "local", THINGS),
+ "another backend"
+ );
}
#[test]
diff --git a/crates/openhuman-embed/src/runtime/seams.rs b/crates/openhuman-embed/src/runtime/seams.rs
index 263c672585..51f3c302a7 100644
--- a/crates/openhuman-embed/src/runtime/seams.rs
+++ b/crates/openhuman-embed/src/runtime/seams.rs
@@ -111,10 +111,11 @@ impl HostSeams {
let Some(StorageSource::Url(url)) = self.storage.take() else {
return Ok(());
};
- let backend = openhuman_core::storage::block_on(async move {
- openhuman_core::storage::open(&url).await
- })
- .map_err(|error| format!("opening the storage backend: {error}"))?;
+ let backend =
+ openhuman_core::storage::block_on(
+ async move { openhuman_core::storage::open(&url).await },
+ )
+ .map_err(|error| format!("opening the storage backend: {error}"))?;
self.storage = Some(StorageSource::Backend(backend));
Ok(())
}
@@ -284,8 +285,8 @@ impl Drop for InstalledSeams {
return;
}
if let Some((ours, previous)) = self.storage.take() {
- let still_ours = openhuman_core::storage::installed()
- .is_some_and(|now| Arc::ptr_eq(&now, &ours));
+ let still_ours =
+ openhuman_core::storage::installed().is_some_and(|now| Arc::ptr_eq(&now, &ours));
if still_ours {
match previous {
Some(previous) => {
diff --git a/crates/openhuman-rpc/src/host.rs b/crates/openhuman-rpc/src/host.rs
index 2fe2d1f32b..631b0b53f8 100644
--- a/crates/openhuman-rpc/src/host.rs
+++ b/crates/openhuman-rpc/src/host.rs
@@ -110,9 +110,7 @@ fn cli_command_uses_storage(args: &[String]) -> bool {
}
!matches!(
command,
- None | Some(
- "run" | "serve" | "help" | "-h" | "--help" | "tui" | "chat" | "sentry-test"
- )
+ None | Some("run" | "serve" | "help" | "-h" | "--help" | "tui" | "chat" | "sentry-test")
)
}
diff --git a/crates/openhuman-rpc/src/host_tests.rs b/crates/openhuman-rpc/src/host_tests.rs
index b8b28cc4e4..f42d3fe37a 100644
--- a/crates/openhuman-rpc/src/host_tests.rs
+++ b/crates/openhuman-rpc/src/host_tests.rs
@@ -100,9 +100,19 @@ fn cli_storage_is_opened_for_one_shot_commands_only() {
let args = |parts: &[&str]| parts.iter().map(|p| p.to_string()).collect::<Vec<_>>();
assert!(cli_command_uses_storage(&args(&["agent", "list"])));
assert!(cli_command_uses_storage(&args(&["cron", "list"])));
- assert!(cli_command_uses_storage(&args(&["--model", "x", "approvals", "list"])));
+ assert!(cli_command_uses_storage(&args(&[
+ "--model",
+ "x",
+ "approvals",
+ "list"
+ ])));
assert!(!cli_command_uses_storage(&args(&["serve"])));
- assert!(!cli_command_uses_storage(&args(&["--provider=a", "-m", "b", "run"])));
+ assert!(!cli_command_uses_storage(&args(&[
+ "--provider=a",
+ "-m",
+ "b",
+ "run"
+ ])));
assert!(!cli_command_uses_storage(&args(&[])));
assert!(!cli_command_uses_storage(&args(&["--help"])));
}