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
style(tinymemes): rustfmt host adapter files
Steven Enamakel91a7d802abfd
diff --git a/crates/openhuman-core/src/tinymemes/callbacks.rs b/crates/openhuman-core/src/tinymemes/callbacks.rsindex 4b0a72f17c..2c3b3b00e6 100644--- a/crates/openhuman-core/src/tinymemes/callbacks.rs+++ b/crates/openhuman-core/src/tinymemes/callbacks.rs@@ -156,8 +156,7 @@ async fn search(async fn load_index(session: &Session, request: LoadIndexRequest) -> HostResult<Option<String>> {let path = session.index_path(request.kind);- match crate::core::runtime::spawn_blocking_scoped(move || std::fs::read_to_string(path)).await- {+ match crate::core::runtime::spawn_blocking_scoped(move || std::fs::read_to_string(path)).await {Ok(Ok(json)) => Ok(Some(json)),Ok(Err(error)) if error.kind() == std::io::ErrorKind::NotFound => Ok(None),Ok(Err(error)) => {diff --git a/crates/openhuman-core/src/tinymemes/callbacks_tests.rs b/crates/openhuman-core/src/tinymemes/callbacks_tests.rsindex 71a7f44d13..a26e91816f 100644--- a/crates/openhuman-core/src/tinymemes/callbacks_tests.rs+++ b/crates/openhuman-core/src/tinymemes/callbacks_tests.rs@@ -18,9 +18,13 @@ async fn an_index_saved_through_the_host_loads_back() {let dir = tempfile::tempdir().unwrap();let session = Session::new(&config_in(dir.path()));- let missing = dispatch(&session, host_methods::LOAD_INDEX, json!([{ "kind": "slang" }]))- .await- .unwrap();+ let missing = dispatch(+ &session,+ host_methods::LOAD_INDEX,+ json!([{ "kind": "slang" }]),+ )+ .await+ .unwrap();assert_eq!(decode::<Option<String>>(missing), Ok(None));let saved = dispatch(@@ -32,14 +36,25 @@ async fn an_index_saved_through_the_host_loads_back() {.unwrap();assert_eq!(decode::<()>(saved), Ok(()));- let loaded = dispatch(&session, host_methods::LOAD_INDEX, json!([{ "kind": "slang" }]))- .await- .unwrap();- assert_eq!(decode::<Option<String>>(loaded), Ok(Some("{\"terms\":1}".into())));+ let loaded = dispatch(+ &session,+ host_methods::LOAD_INDEX,+ json!([{ "kind": "slang" }]),+ )+ .await+ .unwrap();+ assert_eq!(+ decode::<Option<String>>(loaded),+ Ok(Some("{\"terms\":1}".into()))+ );// The other index is a different document.- let memes = dispatch(&session, host_methods::LOAD_INDEX, json!([{ "kind": "memes" }]))- .await- .unwrap();+ let memes = dispatch(+ &session,+ host_methods::LOAD_INDEX,+ json!([{ "kind": "memes" }]),+ )+ .await+ .unwrap();assert_eq!(decode::<Option<String>>(memes), Ok(None));assert!(dir.path()@@ -52,7 +67,9 @@ async fn without_managed_jev_evaluate_is_unsupported() {let dir = tempfile::tempdir().unwrap();let session = Session::new(&config_in(dir.path()));let request = json!([{ "body": { "questions": {}, "messages": [] } }]);- let result = dispatch(&session, host_methods::EVALUATE, request).await.unwrap();+ let result = dispatch(&session, host_methods::EVALUATE, request)+ .await+ .unwrap();assert_eq!(decode::<EvaluateEnvelope>(result),Err(HostFailure::Unsupported)@@ -103,5 +120,8 @@ async fn callbacks_answer_only_while_a_remix_runs() {assert!(active().is_none());let seen = run_with(&config, async { active().is_some() }).await;assert!(seen);- assert!(active().is_none(), "the session is cleared when the remix ends");+ assert!(+ active().is_none(),+ "the session is cleared when the remix ends"+ );}diff --git a/crates/openhuman-core/src/tinymemes/mod_tests.rs b/crates/openhuman-core/src/tinymemes/mod_tests.rsindex c1564b4ac3..f17c2255d5 100644--- a/crates/openhuman-core/src/tinymemes/mod_tests.rs+++ b/crates/openhuman-core/src/tinymemes/mod_tests.rs@@ -139,9 +139,16 @@ async fn a_remixed_reply_is_delivered_and_remembered() {async fn an_unchanged_reply_sends_the_original() {let dir = tempfile::tempdir().unwrap();let ids = store(dir.path());- for reason in [SkipReason::BelowThreshold, SkipReason::Failed, SkipReason::Timeout] {+ for reason in [+ SkipReason::BelowThreshold,+ SkipReason::Failed,+ SkipReason::Timeout,+ ] {let remixer = ScriptedRemixer::new(Ok(skipped_response("Build failed again.", reason)));- assert_eq!(run(&remixer, &ids, "req-skip", Duration::from_secs(5)).await, None);+ assert_eq!(+ run(&remixer, &ids, "req-skip", Duration::from_secs(5)).await,+ None+ );}assert!(!ids.contains(&crate::threads::store::run_reply_message_id("req-skip")));}@@ -151,7 +158,10 @@ async fn a_remix_that_returns_the_same_text_is_not_a_change() {let dir = tempfile::tempdir().unwrap();let ids = store(dir.path());let remixer = ScriptedRemixer::new(Ok(remixed_response("Build failed again. ")));- assert_eq!(run(&remixer, &ids, "req-same", Duration::from_secs(5)).await, None);+ assert_eq!(+ run(&remixer, &ids, "req-same", Duration::from_secs(5)).await,+ None+ );assert!(!ids.contains(&crate::threads::store::run_reply_message_id("req-same")));}@@ -160,7 +170,10 @@ async fn a_module_error_sends_the_original() {let dir = tempfile::tempdir().unwrap();let ids = store(dir.path());let remixer = ScriptedRemixer::new(Err("module unavailable".into()));- assert_eq!(run(&remixer, &ids, "req-err", Duration::from_secs(5)).await, None);+ assert_eq!(+ run(&remixer, &ids, "req-err", Duration::from_secs(5)).await,+ None+ );}#[tokio::test]@@ -192,8 +205,16 @@ async fn a_disabled_flag_leaves_the_task_reply_alone() {).await;assert_eq!(out, None);- remix_task_reply(&config, "thread", "req", "msg", &mut reply, "placeholder", Duration::ZERO)- .await;+ remix_task_reply(+ &config,+ "thread",+ "req",+ "msg",+ &mut reply,+ "placeholder",+ Duration::ZERO,+ )+ .await;assert_eq!(reply, "Build failed again.");}@@ -205,7 +226,12 @@ fn the_turn_line_reports_the_outcome_without_user_content() {let some = turn_line(&t, 9, "remixed", Some(&remixed_response("secret text")));assert!(some.contains("score=7") && some.contains("request_id=req-1"));assert!(!some.contains("secret text"));- let skipped = turn_line(&t, 9, "unchanged", Some(&skipped_response("x", SkipReason::BelowThreshold)));+ let skipped = turn_line(+ &t,+ 9,+ "unchanged",+ Some(&skipped_response("x", SkipReason::BelowThreshold)),+ );assert!(skipped.contains("skipped=below_threshold"));}diff --git a/crates/openhuman-core/src/tinymemes/service.rs b/crates/openhuman-core/src/tinymemes/service.rsindex 2e517e7efc..1d640fb612 100644--- a/crates/openhuman-core/src/tinymemes/service.rs+++ b/crates/openhuman-core/src/tinymemes/service.rs@@ -4,8 +4,7 @@use async_trait::async_trait;use tinybus::{CallContext, Connection, InterfaceName, MemberName, ObjectPath};use tinymemes_bus::{- RemixClient, RemixRefusal, RemixRequest, RemixResponse, HOST_INTERFACE, HOST_METHODS,- HOST_PATH,+ RemixClient, RemixRefusal, RemixRequest, RemixResponse, HOST_INTERFACE, HOST_METHODS, HOST_PATH,};use super::callbacks;@@ -83,10 +82,7 @@ pub(crate) async fn install(connection: &Connection) -> tinybus::Result<()> {/// Remix one reply through the loaded module, serving its callbacks for/// `config`'s workspace meanwhile.-pub(crate) async fn remix(- config: &Config,- request: RemixRequest,-) -> Result<RemixResponse, String> {+pub(crate) async fn remix(config: &Config, request: RemixRequest) -> Result<RemixResponse, String> {crate::modules::ensure_loaded(config, MODULE_ID).await?;let runtime = crate::modules::host::runtime().await