Skip to content

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

chore: reformat long lines and function signatures for readability

Steven Enamakelf52a75cfbcf6
diff --git a/crates/openhuman-core/src/agent/context_breakdown.rs b/crates/openhuman-core/src/agent/context_breakdown.rs
index 1d81bb1e85..5fec781b23 100644
--- a/crates/openhuman-core/src/agent/context_breakdown.rs
+++ b/crates/openhuman-core/src/agent/context_breakdown.rs
@@ -192,7 +192,11 @@ pub async fn context_breakdown(
report.sections.iter().map(section_from_prompt).collect();
sections.push(tools_section(&report.tools));
- if let Some(thread_id) = params.thread_id.as_deref().map(str::trim).filter(|s| !s.is_empty())
+ if let Some(thread_id) = params
+ .thread_id
+ .as_deref()
+ .map(str::trim)
+ .filter(|s| !s.is_empty())
{
if let Some(history) = history_section(thread_id).await {
sections.push(history);
diff --git a/crates/openhuman-core/src/agent/schemas.rs b/crates/openhuman-core/src/agent/schemas.rs
index ca709225db..a860c4ec09 100644
--- a/crates/openhuman-core/src/agent/schemas.rs
+++ b/crates/openhuman-core/src/agent/schemas.rs
@@ -685,9 +685,8 @@ fn handle_registry_snapshot(_params: Map<String, Value>) -> ControllerFuture {
fn handle_context_breakdown(params: Map<String, Value>) -> ControllerFuture {
Box::pin(async move {
- let p = deserialize_params::<crate::agent::context_breakdown::ContextBreakdownParams>(
- params,
- )?;
+ let p =
+ deserialize_params::<crate::agent::context_breakdown::ContextBreakdownParams>(params)?;
to_json(crate::agent::context_breakdown::context_breakdown(p).await?)
})
}
diff --git a/crates/openhuman-core/src/memory/conversations/mod.rs b/crates/openhuman-core/src/memory/conversations/mod.rs
index 7d2384508a..3f7c67dde7 100644
--- a/crates/openhuman-core/src/memory/conversations/mod.rs
+++ b/crates/openhuman-core/src/memory/conversations/mod.rs
@@ -54,8 +54,8 @@ mod store;
pub use bus::register_conversation_persistence_subscriber;
pub use store::{
append_message, delete_messages_from, delete_thread, ensure_thread, get_messages,
- is_deterministic_message_id, list_threads, purge_threads, reply_run_id,
- run_reply_message_id, update_message, update_thread_labels, update_thread_title,
- ConversationMessage, ConversationMessagePatch, ConversationPurgeStats, ConversationStore,
- ConversationThread, CreateConversationThread, CrossThreadHit,
+ is_deterministic_message_id, list_threads, purge_threads, reply_run_id, run_reply_message_id,
+ update_message, update_thread_labels, update_thread_title, ConversationMessage,
+ ConversationMessagePatch, ConversationPurgeStats, ConversationStore, ConversationThread,
+ CreateConversationThread, CrossThreadHit,
};
diff --git a/crates/openhuman-core/src/memory/conversations/store/mod.rs b/crates/openhuman-core/src/memory/conversations/store/mod.rs
index 0f7f11c95f..7eefa9d11b 100644
--- a/crates/openhuman-core/src/memory/conversations/store/mod.rs
+++ b/crates/openhuman-core/src/memory/conversations/store/mod.rs
@@ -82,8 +82,8 @@ mod tokenize;
mod types;
pub use store::{
- append_message, delete_messages_from, delete_thread, ensure_thread, get_messages,
- list_threads, purge_threads, update_message, update_thread_labels, update_thread_title,
+ append_message, delete_messages_from, delete_thread, ensure_thread, get_messages, list_threads,
+ purge_threads, update_message, update_thread_labels, update_thread_title,
ConversationPurgeStats, ConversationStore,
};
pub use types::{
diff --git a/crates/openhuman-core/src/threads/ops.rs b/crates/openhuman-core/src/threads/ops.rs
index a6349b505c..c975c2268b 100644
--- a/crates/openhuman-core/src/threads/ops.rs
+++ b/crates/openhuman-core/src/threads/ops.rs
@@ -15,9 +15,8 @@ mod turn_state_ops;
mod usage;
pub use crud::{
- delete_after, message_append, message_update, messages_list, thread_create_new,
- thread_delete, thread_update_labels, thread_update_title, thread_upsert, threads_list,
- transcript_search,
+ delete_after, message_append, message_update, messages_list, thread_create_new, thread_delete,
+ thread_update_labels, thread_update_title, thread_upsert, threads_list, transcript_search,
};
pub use edit::{
edit_message, regenerate, EditMessageRequest, EditOrRegenerateResponse, RegenerateRequest,
diff --git a/crates/openhuman-core/src/threads/ops/edit.rs b/crates/openhuman-core/src/threads/ops/edit.rs
index 96a625713a..ed7e7a226b 100644
--- a/crates/openhuman-core/src/threads/ops/edit.rs
+++ b/crates/openhuman-core/src/threads/ops/edit.rs
@@ -101,7 +101,11 @@ pub async fn edit_message(request: EditMessageRequest) -> Result<RpcOutcome<Valu
let thread_id_owned = thread_id.clone();
let cut_request_id_owned = cut_request_id.clone();
tokio::task::spawn_blocking(move || {
- truncate_transcript_before_turn(&dir_for_blocking, &thread_id_owned, &cut_request_id_owned)
+ truncate_transcript_before_turn(
+ &dir_for_blocking,
+ &thread_id_owned,
+ &cut_request_id_owned,
+ )
})
.await
.map_err(|e| ThreadsError::Message(format!("truncate transcript task: {e}")))?
@@ -150,15 +154,13 @@ pub async fn regenerate(request: RegenerateRequest) -> Result<RpcOutcome<Value>,
.map_err(ThreadsError::Message)?;
let target_request_id = match &request.message_id {
- Some(message_id) => Some(
- reply_run_id(message_id)
- .map(str::to_string)
- .ok_or_else(|| {
- ThreadsError::Message(format!(
- "message {message_id} is not a regenerable assistant reply"
- ))
- })?,
- ),
+ Some(message_id) => Some(reply_run_id(message_id).map(str::to_string).ok_or_else(
+ || {
+ ThreadsError::Message(format!(
+ "message {message_id} is not a regenerable assistant reply"
+ ))
+ },
+ )?),
None => None,
};
@@ -175,7 +177,9 @@ pub async fn regenerate(request: RegenerateRequest) -> Result<RpcOutcome<Value>,
.await
.map_err(|e| ThreadsError::Message(format!("truncate transcript task: {e}")))?
.map_err(ThreadsError::Message)?
- .ok_or_else(|| ThreadsError::Message(format!("thread {thread_id} has no turn to regenerate")))?;
+ .ok_or_else(|| {
+ ThreadsError::Message(format!("thread {thread_id} has no turn to regenerate"))
+ })?;
clear_dropped_turn_states(&dir, &thread_id, &cut_request_id).await;
super::delete_after(&thread_id, &run_reply_message_id(&cut_request_id)).await?;
@@ -235,12 +239,17 @@ async fn next_reply_request_id_after(
fn resolve_head_transcript(
workspace_dir: &std::path::Path,
thread_id: &str,
-) -> Result<(SessionRef, std::sync::Arc<dyn TranscriptLocator>, SessionTranscript), String> {
- let root_path = tinyagents_session::transcript::find_root_transcript_for_thread(
- workspace_dir,
- thread_id,
- )
- .ok_or_else(|| format!("thread {thread_id} has no session transcript"))?;
+) -> Result<
+ (
+ SessionRef,
+ std::sync::Arc<dyn TranscriptLocator>,
+ SessionTranscript,
+ ),
+ String,
+> {
+ let root_path =
+ tinyagents_session::transcript::find_root_transcript_for_thread(workspace_dir, thread_id)
+ .ok_or_else(|| format!("thread {thread_id} has no session transcript"))?;
let root_transcript = tinyagents_session::transcript::read_transcript(&root_path)
.map_err(|e| format!("read root transcript for thread {thread_id}: {e}"))?;
let agent_id = root_transcript.meta.agent_id.clone().unwrap_or_default();
@@ -288,9 +297,7 @@ fn truncate_transcript_before_turn(
.messages
.iter()
.position(|m| m.request_id.as_deref() == Some(request_id))
- .ok_or_else(|| {
- format!("no transcript row for turn {request_id} in thread {thread_id}")
- })?;
+ .ok_or_else(|| format!("no transcript row for turn {request_id} in thread {thread_id}"))?;
let seed = truncation_seed(&head, &transcript.meta);
locator
.truncate_into_next_generation(&head, TruncateCut::BeforeIndex(cut_index), seed)
diff --git a/crates/openhuman-core/src/threads/schemas/registry.rs b/crates/openhuman-core/src/threads/schemas/registry.rs
index 2784ef5b99..4ec8c4f24a 100644
--- a/crates/openhuman-core/src/threads/schemas/registry.rs
+++ b/crates/openhuman-core/src/threads/schemas/registry.rs
@@ -5,12 +5,12 @@ use crate::core::all::RegisteredController;
use crate::core::ControllerSchema;
use super::handlers::{
- handle_create_new, handle_delete, handle_edit_message, handle_generate_title,
- handle_goal_get, handle_list, handle_message_append, handle_message_update,
- handle_messages_list, handle_purge, handle_regenerate, handle_todos_get, handle_token_usage,
- handle_transcript_get, handle_turn_state_clear, handle_turn_state_get,
- handle_turn_state_get_turn, handle_turn_state_history, handle_turn_state_list,
- handle_update_labels, handle_update_title, handle_upsert,
+ handle_create_new, handle_delete, handle_edit_message, handle_generate_title, handle_goal_get,
+ handle_list, handle_message_append, handle_message_update, handle_messages_list, handle_purge,
+ handle_regenerate, handle_todos_get, handle_token_usage, handle_transcript_get,
+ handle_turn_state_clear, handle_turn_state_get, handle_turn_state_get_turn,
+ handle_turn_state_history, handle_turn_state_list, handle_update_labels, handle_update_title,
+ handle_upsert,
};
use super::schema_defs::schemas;
diff --git a/crates/openhuman-core/src/threads/turn_state/mirror_observe_tests.rs b/crates/openhuman-core/src/threads/turn_state/mirror_observe_tests.rs
index fc7420671d..9f50a3ff41 100644
--- a/crates/openhuman-core/src/threads/turn_state/mirror_observe_tests.rs
+++ b/crates/openhuman-core/src/threads/turn_state/mirror_observe_tests.rs
@@ -657,7 +657,10 @@ fn subagent_spawned_derives_source_tool_name_from_the_parent_row() {
.find(|e| e.id == "subagent:sub-1")
.cloned()
.expect("subagent row created");
- assert_eq!(entry.source_tool_name.as_deref(), Some("spawn_parallel_agents"));
+ assert_eq!(
+ entry.source_tool_name.as_deref(),
+ Some("spawn_parallel_agents")
+ );
let activity = entry.subagent.expect("subagent activity present");
assert_eq!(activity.parent_call_id.as_deref(), Some("call-parallel"));
}