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
chore(threads): reformat store and composio call sites
Steven Enamakele9332f48cb60
diff --git a/crates/openhuman-core/src/integrations/composio/file_store.rs b/crates/openhuman-core/src/integrations/composio/file_store.rsindex 31b1f47675..7fbe4cc54c 100644--- a/crates/openhuman-core/src/integrations/composio/file_store.rs+++ b/crates/openhuman-core/src/integrations/composio/file_store.rs@@ -30,10 +30,13 @@ async fn import_legacy(name: &'static str,) -> Result<(), String> {let marker_docs = docs.clone();- let done = crate::core::runtime::spawn_blocking_scoped(move || marker_docs.legacy_imported(name))- .await- .map_err(|error| format!("[composio:store] checking legacy {name} failed: {error}"))?- .map_err(|error| format!("[composio:store] checking legacy {name} failed: {error:#}"))?;+ let done =+ crate::core::runtime::spawn_blocking_scoped(move || marker_docs.legacy_imported(name))+ .await+ .map_err(|error| format!("[composio:store] checking legacy {name} failed: {error}"))?+ .map_err(|error| {+ format!("[composio:store] checking legacy {name} failed: {error:#}")+ })?;if done {return Ok(());}diff --git a/crates/openhuman-core/src/integrations/composio/file_store_documents.rs b/crates/openhuman-core/src/integrations/composio/file_store_documents.rsindex 7ac262a847..d8564938d1 100644--- a/crates/openhuman-core/src/integrations/composio/file_store_documents.rs+++ b/crates/openhuman-core/src/integrations/composio/file_store_documents.rs@@ -148,7 +148,12 @@ impl Docs {Err(error) => return Err(error),};match docs- .put(IMPORTED, &id, json!({ "imported": true }), Precondition::Absent)+ .put(+ IMPORTED,+ &id,+ json!({ "imported": true }),+ Precondition::Absent,+ ).await{Ok(_) => {}diff --git a/crates/openhuman-core/src/threads/store/backend.rs b/crates/openhuman-core/src/threads/store/backend.rsindex 6d0eb24958..0391254ea8 100644--- a/crates/openhuman-core/src/threads/store/backend.rs+++ b/crates/openhuman-core/src/threads/store/backend.rs@@ -18,11 +18,12 @@use std::path::{Path, PathBuf};use std::sync::Arc;+pub use tinyagents_session::threads::ConversationPurgeStats;use tinyagents_session::threads::{- ConversationError, ConversationPersistence, ConversationResult, ConversationThread, CreateConversationThread,- CrossThreadHit, DriverConversationStore, ThreadMessage, ThreadMessagePatch,+ ConversationError, ConversationPersistence, ConversationResult, ConversationThread,+ CreateConversationThread, CrossThreadHit, DriverConversationStore, ThreadMessage,+ ThreadMessagePatch,};-pub use tinyagents_session::threads::ConversationPurgeStats;use crate::storage::documents::Repo;use crate::storage::{self, Scope, StorageError};@@ -160,7 +161,11 @@ impl ConversationStore {/// Every live thread, newest first.pub fn list_threads(&self) -> Result<Vec<ConversationThread>, String> {- self.run("list_threads", NONE, |s| async move { s.list_threads().await })+ self.run(+ "list_threads",+ NONE,+ |s| async move { s.list_threads().await },+ )}/// A thread's messages in append order; empty for an unknown thread.@@ -208,7 +213,11 @@ impl ConversationStore {title: &str,updated_at: &str,) -> Result<ConversationThread, String> {- let (id, title, at) = (thread_id.to_string(), title.to_string(), updated_at.to_string());+ let (id, title, at) = (+ thread_id.to_string(),+ title.to_string(),+ updated_at.to_string(),+ );self.run("update_thread_title", thread(thread_id), |s| async move {s.update_thread_title(&id, &title, &at).await})@@ -222,9 +231,11 @@ impl ConversationStore {updated_at: &str,) -> Result<ConversationThread, String> {let (id, at) = (thread_id.to_string(), updated_at.to_string());- self.run("update_thread_working_dir", thread(thread_id), |s| async move {- s.update_thread_working_dir(&id, working_dir, &at).await- })+ self.run(+ "update_thread_working_dir",+ thread(thread_id),+ |s| async move { s.update_thread_working_dir(&id, working_dir, &at).await },+ )}/// Replaces a thread's labels.@@ -248,9 +259,11 @@ impl ConversationStore {patch: ThreadMessagePatch,) -> Result<ThreadMessage, String> {let (id, mid) = (thread_id.to_string(), message_id.to_string());- self.run("update_message", message(thread_id, message_id), |s| async move {- s.update_message(&id, &mid, patch).await- })+ self.run(+ "update_message",+ message(thread_id, message_id),+ |s| async move { s.update_message(&id, &mid, patch).await },+ )}/// Removes a message and everything after it; `None` for an unknown id.@@ -260,9 +273,11 @@ impl ConversationStore {message_id: &str,) -> Result<Option<usize>, String> {let (id, mid) = (thread_id.to_string(), message_id.to_string());- self.run("delete_messages_from", message(thread_id, message_id), |s| async move {- s.delete_messages_from(&id, &mid).await- })+ self.run(+ "delete_messages_from",+ message(thread_id, message_id),+ |s| async move { s.delete_messages_from(&id, &mid).await },+ )}/// Soft-deletes a thread; whether it existed.@@ -275,7 +290,11 @@ impl ConversationStore {/// Removes every thread.pub fn purge_threads(&self) -> Result<ConversationPurgeStats, String> {- self.run("purge_threads", NONE, |s| async move { s.purge_threads().await })+ self.run(+ "purge_threads",+ NONE,+ |s| async move { s.purge_threads().await },+ )}}diff --git a/crates/openhuman-core/src/threads/store/legacy_import.rs b/crates/openhuman-core/src/threads/store/legacy_import.rsindex a9f16d0a75..7f94028325 100644--- a/crates/openhuman-core/src/threads/store/legacy_import.rs+++ b/crates/openhuman-core/src/threads/store/legacy_import.rs@@ -100,7 +100,8 @@ fn fold_threads(root: &Path) -> Result<Vec<CreateConversationThread>> {} => match live.get_mut(&thread_id) {Some(existing) => {existing.title = title;- existing.parent_thread_id = parent_thread_id.or(existing.parent_thread_id.take());+ existing.parent_thread_id =+ parent_thread_id.or(existing.parent_thread_id.take());existing.labels = labels.or(existing.labels.take());existing.personality_id = personality_id.or(existing.personality_id.take());existing.working_dir = match working_dir {@@ -158,12 +159,13 @@ pub(super) fn import_once(let threads = fold_threads(&root)?;let mut messages = Vec::with_capacity(threads.len());for thread in &threads {- messages.push(read_jsonl::<ThreadMessage>(&messages_path(&root, &thread.id))?);+ messages.push(read_jsonl::<ThreadMessage>(&messages_path(+ &root, &thread.id,+ ))?);}let store = store.clone();- let (threads_n, messages_n) = crate::storage::block_on_anyhow(async move {- copy(&store, threads, messages).await- })?;+ let (threads_n, messages_n) =+ crate::storage::block_on_anyhow(async move { copy(&store, threads, messages).await })?;repo.run(|docs| async move {match docs.put(