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(transcript_view): reformat long method chains and closures for readability
Steven Enamakel53df82b7e7a2
diff --git a/crates/openhuman-core/src/threads/transcript_view/project.rs b/crates/openhuman-core/src/threads/transcript_view/project.rsindex faaaac8b81..27dcd5f44b 100644--- a/crates/openhuman-core/src/threads/transcript_view/project.rs+++ b/crates/openhuman-core/src/threads/transcript_view/project.rs@@ -414,7 +414,9 @@ fn unwrap_tool_result(raw: &str) -> (String, Option<String>) {};let (Some(content), Some(call_id)) = (object.get("content").and_then(serde_json::Value::as_str),- object.get("tool_call_id").and_then(serde_json::Value::as_str),+ object+ .get("tool_call_id")+ .and_then(serde_json::Value::as_str),) else {return (raw.to_string(), None);};diff --git a/crates/openhuman-core/src/threads/transcript_view/subagents.rs b/crates/openhuman-core/src/threads/transcript_view/subagents.rsindex a11659c21a..b19ee3759a 100644--- a/crates/openhuman-core/src/threads/transcript_view/subagents.rs+++ b/crates/openhuman-core/src/threads/transcript_view/subagents.rs@@ -58,7 +58,11 @@ enum OwnState {/// Place every direct child of the root (`__`-once stems) into `items`./// `segments` are the root turns' `(request_id, commit unix)` pairs.-pub(super) fn attach(items: &mut Vec<DisplayItem>, sub_paths: &[PathBuf], segments: &[(String, i64)]) {+pub(super) fn attach(+ items: &mut Vec<DisplayItem>,+ sub_paths: &[PathBuf],+ segments: &[(String, i64)],+) {let children = build_children(sub_paths, None, 0);place(items, children, segments);}@@ -245,9 +249,9 @@ fn turn_range(items: &[DisplayItem], request_id: Option<&str>) -> (usize, usize)let Some(request_id) = request_id else {return (0, items.len());};- let Some(boundary) = items.iter().position(|item| {- matches!(item, DisplayItem::TurnBoundary { request_id: rid } if rid == request_id)- }) else {+ let Some(boundary) = items.iter().position(+ |item| matches!(item, DisplayItem::TurnBoundary { request_id: rid } if rid == request_id),+ ) else {return (0, items.len());};let end = items[boundary + 1..]@@ -291,13 +295,15 @@ fn call_targets_agent(name: &str, args: Option<&serde_json::Value>, agent_id: &sif name == format!("delegate_{agent}") || name == format!("delegate_to_{agent}") {return true;}- let named_in_args = args.and_then(serde_json::Value::as_object).is_some_and(|args| {- TARGET_ARG_KEYS.iter().any(|key| {- args.get(*key)- .and_then(serde_json::Value::as_str)- .is_some_and(|value| value.eq_ignore_ascii_case(&agent))- })- });+ let named_in_args = args+ .and_then(serde_json::Value::as_object)+ .is_some_and(|args| {+ TARGET_ARG_KEYS.iter().any(|key| {+ args.get(*key)+ .and_then(serde_json::Value::as_str)+ .is_some_and(|value| value.eq_ignore_ascii_case(&agent))+ })+ });if named_in_args {return true;}diff --git a/crates/openhuman-core/src/threads/transcript_view/transcript_ordering_tests.rs b/crates/openhuman-core/src/threads/transcript_view/transcript_ordering_tests.rsindex fd79c8eb40..193f13061b 100644--- a/crates/openhuman-core/src/threads/transcript_view/transcript_ordering_tests.rs+++ b/crates/openhuman-core/src/threads/transcript_view/transcript_ordering_tests.rs@@ -8,8 +8,8 @@ use super::types::{DisplayItem, SubagentStatus, ToolCallStatus};use std::path::{Path, PathBuf};use tempfile::TempDir;use tinyagents_session::transcript::{- self, read_transcript, read_transcript_display, SessionRef, TranscriptMessage,- TranscriptMeta, TranscriptToolCall, TurnUsage,+ self, read_transcript, read_transcript_display, SessionRef, TranscriptMessage, TranscriptMeta,+ TranscriptToolCall, TurnUsage,};fn meta(thread_id: &str, session_id: Option<String>, parent: Option<String>) -> TranscriptMeta {@@ -357,7 +357,9 @@ fn subagent_of_a_session_root_is_discovered_and_placed_after_its_spawning_call()let items = &projected.items;let research_call = items.iter()- .position(|item| matches!(item, DisplayItem::ToolCall { call_id, .. } if call_id == "c-research"))+ .position(+ |item| matches!(item, DisplayItem::ToolCall { call_id, .. } if call_id == "c-research"),+ ).expect("research call projected");match &items[research_call + 1] {DisplayItem::Subagent {@@ -467,8 +469,8 @@ fn generation_chain_projects_in_order_without_duplicating_retained_rows() {.unwrap();// A pre-identity root of the same thread, already adopted into g0.- let legacy = transcript::resolve_keyed_transcript_path(dir.path(), "1600000000_orchestrator")- .unwrap();+ let legacy =+ transcript::resolve_keyed_transcript_path(dir.path(), "1600000000_orchestrator").unwrap();transcript::append_transcript_turn(&legacy,&[],@@ -516,13 +518,18 @@ fn generation_chain_projects_in_order_without_duplicating_retained_rows() {Some(successor.session_id()),Some(session.session_id()),);- transcript::append_transcript_turn(&g1, &[], &retained, &g1_meta, None, Some("req-3"))- .unwrap();+ transcript::append_transcript_turn(&g1, &[], &retained, &g1_meta, None, Some("req-3")).unwrap();let (roots, _) = resolve_files(dir.path(), thread_id).expect("thread resolves");- assert_eq!(roots, vec![g0.clone(), g1.clone()], "chain order, legacy dropped");+ assert_eq!(+ roots,+ vec![g0.clone(), g1.clone()],+ "chain order, legacy dropped"+ );- let items = project_thread(dir.path(), thread_id).expect("project").items;+ let items = project_thread(dir.path(), thread_id)+ .expect("project")+ .items;let users: Vec<&str> = items.iter().filter_map(|item| match item {diff --git a/crates/openhuman-core/src/threads/transcript_view/transcript_view_tests.rs b/crates/openhuman-core/src/threads/transcript_view/transcript_view_tests.rsindex adf0285d41..4854bf932e 100644--- a/crates/openhuman-core/src/threads/transcript_view/transcript_view_tests.rs+++ b/crates/openhuman-core/src/threads/transcript_view/transcript_view_tests.rs@@ -81,7 +81,11 @@ fn projects_turn_with_tools_reasoning_and_sanitization() {match &items[2] {DisplayItem::Reasoning { text, iteration } => {assert_eq!(text, "I should call the weather tool.");- assert_eq!(*iteration, Some(1), "reasoning carries its step's iteration");+ assert_eq!(+ *iteration,+ Some(1),+ "reasoning carries its step's iteration"+ );}other => panic!("expected reasoning, got {other:?}"),}