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: files changed crates/openhuman-core/src/tinymemes/callbacks_tests.rs,crates/openhuman-core/sr
Steven Enamakelf9fa83f3e869
diff --git a/crates/openhuman-core/src/tinymemes/callbacks_tests.rs b/crates/openhuman-core/src/tinymemes/callbacks_tests.rsindex ebe04e985c..f6d3d04432 100644--- a/crates/openhuman-core/src/tinymemes/callbacks_tests.rs+++ b/crates/openhuman-core/src/tinymemes/callbacks_tests.rs@@ -16,7 +16,7 @@ fn decode<T: DeserializeOwned>(value: Value) -> HostResult<T> {#[tokio::test]async fn an_index_saved_through_the_host_loads_back_per_kind() {let dir = tempfile::tempdir().unwrap();- let session = Session::new(&config_in(dir.path()));+ let session = Session::new(&crate::core::runtime::DispatchCtx::host_default(), &config_in(dir.path()));let missing = dispatch(&session,@@ -60,7 +60,7 @@ async fn an_index_saved_through_the_host_loads_back_per_kind() {#[tokio::test]async fn without_managed_jev_evaluate_is_unsupported() {let dir = tempfile::tempdir().unwrap();- let session = Session::new(&config_in(dir.path()));+ let session = Session::new(&crate::core::runtime::DispatchCtx::host_default(), &config_in(dir.path()));let request = json!([{ "body": { "questions": {}, "messages": [] } }]);let result = dispatch(&session, host_methods::EVALUATE, request).await@@ -76,7 +76,7 @@ async fn search_switched_off_is_unsupported() {let dir = tempfile::tempdir().unwrap();let mut config = config_in(dir.path());config.search.enabled = Some(false);- let session = Session::new(&config);+ let session = Session::new(&crate::core::runtime::DispatchCtx::host_default(), &config);let result = dispatch(&session,host_methods::SEARCH,@@ -93,7 +93,7 @@ async fn search_switched_off_is_unsupported() {#[tokio::test]async fn deliver_is_acknowledged_and_unknown_members_are_refused() {let dir = tempfile::tempdir().unwrap();- let session = Session::new(&config_in(dir.path()));+ let session = Session::new(&crate::core::runtime::DispatchCtx::host_default(), &config_in(dir.path()));let delivered = dispatch(&session,host_methods::DELIVER,@@ -112,8 +112,8 @@ async fn deliver_is_acknowledged_and_unknown_members_are_refused() {fn registrations_are_independent_and_forgotten_on_drop() {let dir = tempfile::tempdir().unwrap();let config = config_in(dir.path());- let a = register(&config);- let b = register(&config);+ let a = register(&crate::core::runtime::DispatchCtx::host_default(), &config);+ let b = register(&crate::core::runtime::DispatchCtx::host_default(), &config);assert_ne!(a.correlation(), b.correlation());assert!(session(a.correlation()).is_some() && session(b.correlation()).is_some());let a_id = a.correlation().to_owned();@@ -129,7 +129,7 @@ fn registrations_are_independent_and_forgotten_on_drop() {#[test]fn a_kept_registration_lives_until_the_module_reports_the_end() {let dir = tempfile::tempdir().unwrap();- let registration = register(&config_in(dir.path()));+ let registration = register(&crate::core::runtime::DispatchCtx::host_default(), &config_in(dir.path()));let id = registration.correlation().to_owned();registration.keep_for_background();assert!(diff --git a/crates/openhuman-core/src/tinymemes/e2e_tests.rs b/crates/openhuman-core/src/tinymemes/e2e_tests.rsindex 22ec357742..56ba381dfc 100644--- a/crates/openhuman-core/src/tinymemes/e2e_tests.rs+++ b/crates/openhuman-core/src/tinymemes/e2e_tests.rs@@ -67,7 +67,7 @@ async fn the_real_module_fails_open_and_reads_its_documents_through_the_host() {let config = config_in(dir.path(), &artifact);write_legacy(&config, "remixed.json", "[\"old-1\"]");- let response = service::remix(&config, request("That's done."))+ let response = service::remix(&crate::core::runtime::DispatchCtx::host_default(), &config, request("That's done.")).await.expect("the module answered");assert!(!response.remixed, "{response:?}");@@ -94,7 +94,7 @@ async fn a_disabled_request_passes_through_without_a_callback() {write_legacy(&config, "remixed.json", "[\"untouched\"]");let mut disabled = request("hello");disabled.enabled = false;- let response = service::remix(&config, disabled).await.unwrap();+ let response = service::remix(&crate::core::runtime::DispatchCtx::host_default(), &config, disabled).await.unwrap();assert_eq!(response.reply, "hello");assert_eq!(response.skipped, Some(SkipReason::Disabled));assert_eq!(@@ -121,9 +121,10 @@ async fn concurrent_remixes_for_two_workspaces_stay_in_their_own_documents() {write_legacy(&a, "remixed.json", "[\"from-a\"]");write_legacy(&b, "remixed.json", "[\"from-b\"]");+ let host = crate::core::runtime::DispatchCtx::host_default();let (ra, rb) = tokio::join!(- service::remix(&a, request("reply a")),- service::remix(&b, request("reply b"))+ service::remix(&host, &a, request("reply a")),+ service::remix(&host, &b, request("reply b")));assert_eq!(ra.unwrap().reply, "reply a");assert_eq!(rb.unwrap().reply, "reply b");diff --git a/crates/openhuman-core/src/tinymemes/inference_tests.rs b/crates/openhuman-core/src/tinymemes/inference_tests.rsindex 147fd67271..31861c771c 100644--- a/crates/openhuman-core/src/tinymemes/inference_tests.rs+++ b/crates/openhuman-core/src/tinymemes/inference_tests.rs@@ -24,5 +24,5 @@ fn the_model_label_never_fails() {config.workspace_dir = dir.path().join("workspace");config.secrets.encrypt = false;// Either the resolved model id or an `unavailable (...)` label.- assert!(!resolved_model(&config).trim().is_empty());+ assert!(!resolved_model(&crate::core::runtime::DispatchCtx::host_default(), &config).trim().is_empty());}diff --git a/crates/openhuman-core/src/tinymemes/mod_tests.rs b/crates/openhuman-core/src/tinymemes/mod_tests.rsindex 232455b2a3..e293c1b4e1 100644--- a/crates/openhuman-core/src/tinymemes/mod_tests.rs+++ b/crates/openhuman-core/src/tinymemes/mod_tests.rs@@ -292,7 +292,7 @@ async fn component_off_refuses_the_remix_before_any_module_load() {reply_id: None,options: RemixOptions::default(),};- let err = service::remix(&config, request).await.unwrap_err();+ let err = service::remix(&crate::core::runtime::DispatchCtx::host_default(), &config, request).await.unwrap_err();assert!(err.contains("component is off"), "{err}");}diff --git a/crates/openhuman-core/src/tinymemes/search_tests.rs b/crates/openhuman-core/src/tinymemes/search_tests.rsindex cabe0cb642..eb142aeee1 100644--- a/crates/openhuman-core/src/tinymemes/search_tests.rs+++ b/crates/openhuman-core/src/tinymemes/search_tests.rs@@ -4,7 +4,7 @@ use super::*;fn search_switched_off_in_settings_is_unavailable() {let mut config = Config::default();config.search.enabled = Some(false);- assert!(OpenHumanSearch::available(&config).is_none());+ assert!(OpenHumanSearch::available(&crate::core::runtime::DispatchCtx::host_default(), &config).is_none());}#[test]@@ -13,7 +13,7 @@ fn availability_follows_the_configured_providers() {// when search is on; it never panics on a default config.let mut config = Config::default();config.search.enabled = Some(true);- if let Some(search) = OpenHumanSearch::available(&config) {+ if let Some(search) = OpenHumanSearch::available(&crate::core::runtime::DispatchCtx::host_default(), &config) {assert!(search.config.search.is_enabled());}}diff --git a/crates/openhuman-core/src/tinymemes/service_tests.rs b/crates/openhuman-core/src/tinymemes/service_tests.rsindex 411f41a9e1..9305605065 100644--- a/crates/openhuman-core/src/tinymemes/service_tests.rs+++ b/crates/openhuman-core/src/tinymemes/service_tests.rs@@ -60,7 +60,7 @@ fn decode<T: serde::de::DeserializeOwned>(value: Value) -> HostResult<T> {async fn only_the_module_may_call_back_and_only_for_a_live_remix() {let dir = tempfile::tempdir().unwrap();let bus = bus().await;- let registration = callbacks::register(&config_in(dir.path()));+ let registration = callbacks::register(&crate::core::runtime::DispatchCtx::host_default(), &config_in(dir.path()));let correlation = registration.correlation().to_owned();let deliver = json!({ "correlation": correlation, "reply": "hi", "remixed": true });@@ -108,8 +108,8 @@ async fn a_direct_call_without_the_brokers_context_is_unauthenticated() {async fn remixes_for_different_workspaces_are_served_at_once_each_for_its_own() {let (dir_a, dir_b) = (tempfile::tempdir().unwrap(), tempfile::tempdir().unwrap());let bus = bus().await;- let a = callbacks::register(&config_in(dir_a.path()));- let b = callbacks::register(&config_in(dir_b.path()));+ let a = callbacks::register(&crate::core::runtime::DispatchCtx::host_default(), &config_in(dir_a.path()));+ let b = callbacks::register(&crate::core::runtime::DispatchCtx::host_default(), &config_in(dir_b.path()));assert_ne!(a.correlation(), b.correlation());// Both are live together: neither waits for the other.@@ -140,7 +140,7 @@ async fn remixes_for_different_workspaces_are_served_at_once_each_for_its_own()async fn end_retires_the_remix_and_is_harmless_when_repeated_or_unknown() {let dir = tempfile::tempdir().unwrap();let bus = bus().await;- let registration = callbacks::register(&config_in(dir.path()));+ let registration = callbacks::register(&crate::core::runtime::DispatchCtx::host_default(), &config_in(dir.path()));let correlation = registration.correlation().to_owned();registration.keep_for_background();@@ -175,7 +175,7 @@ async fn end_retires_the_remix_and_is_harmless_when_repeated_or_unknown() {}// A stranger cannot end somebody else's remix.let dir2 = tempfile::tempdir().unwrap();- let live = callbacks::register(&config_in(dir2.path()));+ let live = callbacks::register(&crate::core::runtime::DispatchCtx::host_default(), &config_in(dir2.path()));let refused = bus.call(&bus.intruder,@@ -191,7 +191,7 @@ async fn end_retires_the_remix_and_is_harmless_when_repeated_or_unknown() {async fn an_unavailable_capability_is_reported_not_faked() {let dir = tempfile::tempdir().unwrap();let bus = bus().await;- let registration = callbacks::register(&config_in(dir.path()));+ let registration = callbacks::register(&crate::core::runtime::DispatchCtx::host_default(), &config_in(dir.path()));let reply = bus.call(&bus.module,@@ -212,7 +212,7 @@ async fn component_off_refuses_before_any_module_load() {config.components.memes = false;let request: RemixRequest =serde_json::from_str(r#"{"conversation":[],"reply":"hi"}"#).unwrap();- let error = remix(&config, request).await.unwrap_err();+ let error = remix(&crate::core::runtime::DispatchCtx::host_default(), &config, request).await.unwrap_err();assert!(error.contains("component is off"), "{error}");}