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
test(core): update artifact retrieval to use ambient context
Steven Enamakel5dc24236d794
diff --git a/crates/openhuman-core/src/artifacts/ops_tests.rs b/crates/openhuman-core/src/artifacts/ops_tests.rsindex 4c247a931c..5a27df060b 100644--- a/crates/openhuman-core/src/artifacts/ops_tests.rs+++ b/crates/openhuman-core/src/artifacts/ops_tests.rs@@ -454,7 +454,7 @@ async fn get_returns_the_files_folder_path() {.await.unwrap();- let value = ai_get_artifact(&config, &meta.id)+ let value = ai_get_artifact(&crate::core::runtime::DispatchCtx::ambient(), &config, &meta.id).await.unwrap().into_cli_compatible_json()@@ -489,7 +489,9 @@ async fn get_reports_a_ready_file_removed_outside_openhuman() {.unwrap();std::fs::remove_file(&path).unwrap();- let err = ai_get_artifact(&config, &meta.id).await.unwrap_err();+ let err = ai_get_artifact(&crate::core::runtime::DispatchCtx::ambient(), &config, &meta.id)+ .await+ .unwrap_err();assert!(err.contains("file missing"), "{err}");}@@ -526,10 +528,22 @@ async fn get_and_delete_refuse_a_record_rooted_outside_the_files_folder() {.await.unwrap();- let err = ai_get_artifact(&config, "claims-home").await.unwrap_err();+ let err = ai_get_artifact(+ &crate::core::runtime::DispatchCtx::ambient(),+ &config,+ "claims-home",+ )+ .await+ .unwrap_err();assert!(err.contains("not a files folder"), "{err}");- ai_delete_artifact(&config, "claims-home").await.unwrap();+ ai_delete_artifact(+ &crate::core::runtime::DispatchCtx::ambient(),+ &config,+ "claims-home",+ )+ .await+ .unwrap();assert!(private.exists(),"the file outside the files folder is left alone"diff --git a/crates/openhuman-core/src/artifacts/publisher_slot_tests.rs b/crates/openhuman-core/src/artifacts/publisher_slot_tests.rsindex f6fcc3fdcc..062e193d5b 100644--- a/crates/openhuman-core/src/artifacts/publisher_slot_tests.rs+++ b/crates/openhuman-core/src/artifacts/publisher_slot_tests.rs@@ -30,3 +30,32 @@ fn the_first_factory_that_answers_serves_sharing() {assert!(unregister_artifact_publisher("answers"));assert!(artifact_publisher(&Config::default()).is_none());}++#[tokio::test]+async fn publisher_lookup_uses_the_carried_context_not_the_ambient_profile() {+ use crate::core::runtime::{ContextOverlay, CoreContext, DispatchCtx, DomainSet};+ use crate::tools::toolpacks::ToolGroups;++ let root = CoreContext::for_test(DomainSet::full(), None);+ let overlay = |profile: &'static str| {+ ContextOverlay::new(Config::default(), DomainSet::kernel(), ToolGroups::none())+ .profile(profile)+ };+ let core_a = root.derive_with(overlay("publisher-a"));+ let core_b = root.derive_with(overlay("publisher-b"));+ let ctx_a = DispatchCtx::new(core_a.clone());+ let ctx_b = DispatchCtx::new(core_b.clone());+ let binder: ArtifactPublisherBinder = Arc::new(|_files| Arc::new(FixedPublisher));+ register_artifact_publisher_in(core_a.extensions(), "publisher-context-a", move |_| {+ Some(binder.clone())+ });+ register_artifact_publisher_in(core_b.extensions(), "publisher-context-b-declines", |_| {+ None+ });++ CoreContext::scope(core_b, async {+ assert!(artifact_publisher_in(&Config::default(), &ctx_a).is_some());+ assert!(artifact_publisher_in(&Config::default(), &ctx_b).is_none());+ })+ .await;+}diff --git a/crates/openhuman-core/src/config/ops_files_dir_tests.rs b/crates/openhuman-core/src/config/ops_files_dir_tests.rsindex f41414ec55..357399af30 100644--- a/crates/openhuman-core/src/config/ops_files_dir_tests.rs+++ b/crates/openhuman-core/src/config/ops_files_dir_tests.rs@@ -220,7 +220,11 @@ async fn files_made_before_a_folder_change_keep_resolving() {"{:?}",cfg.files_dir_history);- let value = crate::artifacts::ops::ai_get_artifact(&cfg, &meta.id)+ let value = crate::artifacts::ops::ai_get_artifact(+ &crate::core::runtime::DispatchCtx::ambient(),+ &cfg,+ &meta.id,+ ).await.expect("an artifact from the previous folder still resolves").into_cli_compatible_json()