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
refactor(artifacts): clean up artifact operations and API usage
Steven Enamakel3e07ce13025a
diff --git a/crates/openhuman-core/src/artifacts/mod.rs b/crates/openhuman-core/src/artifacts/mod.rsindex 63db5f05be..e4d0e8245f 100644--- a/crates/openhuman-core/src/artifacts/mod.rs+++ b/crates/openhuman-core/src/artifacts/mod.rs@@ -19,8 +19,8 @@ pub use files::{resolve_ready_file, FileRoots};pub use migrate::{migrate_legacy_artifacts, MigrationReport};pub use publisher_slot::{artifact_publisher, artifact_publisher_in, register_artifact_publisher,- register_artifact_publisher_in,- unregister_artifact_publisher, ArtifactPublisherBinder, ArtifactPublisherFactory,+ register_artifact_publisher_in, unregister_artifact_publisher, ArtifactPublisherBinder,+ ArtifactPublisherFactory,};pub use schemas::{all_controller_schemas as all_artifacts_controller_schemas,diff --git a/crates/openhuman-core/src/artifacts/ops.rs b/crates/openhuman-core/src/artifacts/ops.rsindex 60b5442816..0b9b829a41 100644--- a/crates/openhuman-core/src/artifacts/ops.rs+++ b/crates/openhuman-core/src/artifacts/ops.rs@@ -96,7 +96,11 @@ pub async fn ai_get_artifact(// OpenHuman is an error rather than a path that points at nothing.let roots = super::files::FileRoots::from_config(config);let resolved = ctx- .enter(super::files::resolve_file(&config.workspace_dir, &meta, &roots))+ .enter(super::files::resolve_file(+ &config.workspace_dir,+ &meta,+ &roots,+ )).await?;if matches!(meta.status, super::types::ArtifactStatus::Ready)&& !tokio::fs::try_exists(&resolved).await.unwrap_or(false)@@ -220,7 +224,10 @@ async fn regenerate_presentation(client_id: &str,) -> Result<Outcome<Value>, String> {let args = ctx- .enter(store::read_artifact_args(&config.workspace_dir, artifact_id))+ .enter(store::read_artifact_args(+ &config.workspace_dir,+ artifact_id,+ )).await?;// A fresh policy from the live config — cheap, sync, and mirrors howdiff --git a/crates/openhuman-core/src/artifacts/ops_tests.rs b/crates/openhuman-core/src/artifacts/ops_tests.rsindex 5a27df060b..f5bedccccc 100644--- a/crates/openhuman-core/src/artifacts/ops_tests.rs+++ b/crates/openhuman-core/src/artifacts/ops_tests.rs@@ -125,8 +125,8 @@ async fn list_with_thread_filter_returns_only_matching_thread() {None,Some("thread-a"),)- .await- .unwrap();+ .await+ .unwrap();let value = outcome.into_cli_compatible_json().unwrap();assert_eq!(value["total"], 2, "only two artifacts belong to thread-a");let ids: Vec<&str> = value["artifacts"]@@ -182,8 +182,8 @@ async fn list_with_thread_filter_unknown_thread_returns_zero() {None,Some("thread-missing"),)- .await- .unwrap();+ .await+ .unwrap();let value = outcome.into_cli_compatible_json().unwrap();assert_eq!(value["total"], 0);assert_eq!(value["artifacts"].as_array().unwrap().len(), 0);@@ -454,11 +454,15 @@ async fn get_returns_the_files_folder_path() {.await.unwrap();- let value = ai_get_artifact(&crate::core::runtime::DispatchCtx::ambient(), &config, &meta.id)- .await- .unwrap()- .into_cli_compatible_json()- .unwrap();+ let value = ai_get_artifact(+ &crate::core::runtime::DispatchCtx::ambient(),+ &config,+ &meta.id,+ )+ .await+ .unwrap()+ .into_cli_compatible_json()+ .unwrap();assert_eq!(value["absolute_path"],@@ -489,9 +493,13 @@ async fn get_reports_a_ready_file_removed_outside_openhuman() {.unwrap();std::fs::remove_file(&path).unwrap();- let err = ai_get_artifact(&crate::core::runtime::DispatchCtx::ambient(), &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}");}diff --git a/crates/openhuman-core/src/artifacts/preview.rs b/crates/openhuman-core/src/artifacts/preview.rsindex c66206bb6f..e82760d8b3 100644--- a/crates/openhuman-core/src/artifacts/preview.rs+++ b/crates/openhuman-core/src/artifacts/preview.rs@@ -63,16 +63,7 @@ pub async fn read_body(Some(record) => record,// An artifact made before versioning has only its legacy record: show// the file that record vouches for.- None => {- legacy_record(- &config.workspace_dir,- &files,- id,- file_store.as_ref(),- ctx,- )- .await?- }+ None => legacy_record(&config.workspace_dir, &files, id, file_store.as_ref(), ctx).await?,};let converter = DocumentConverter::for_config(config);let display_path = ctxdiff --git a/crates/openhuman-core/src/artifacts/production.rs b/crates/openhuman-core/src/artifacts/production.rsindex c03d53ab06..fab60b7430 100644--- a/crates/openhuman-core/src/artifacts/production.rs+++ b/crates/openhuman-core/src/artifacts/production.rs@@ -144,8 +144,8 @@ impl Production {scoped,None,);- let file_store = file_store- .ok_or_else(|| "artifact tenant storage is unavailable".to_string())?;+ let file_store =+ file_store.ok_or_else(|| "artifact tenant storage is unavailable".to_string())?;let (meta, path) = ctx.enter(super::store::create_artifact_regenerating(workspace_dir,diff --git a/crates/openhuman-core/src/artifacts/schemas.rs b/crates/openhuman-core/src/artifacts/schemas.rsindex 649e94c7d8..e7aff566b6 100644--- a/crates/openhuman-core/src/artifacts/schemas.rs+++ b/crates/openhuman-core/src/artifacts/schemas.rs@@ -445,9 +445,7 @@ fn handle_get_artifact(ctx: DispatchCtx, params: Map<String, Value>) -> ControllBox::pin(async move {let config = ctx.load_config().await?;let artifact_id = read_required::<String>(¶ms, "artifact_id")?;- to_json(- crate::artifacts::ops::ai_get_artifact(&ctx, &config, artifact_id.trim()).await?,- )+ to_json(crate::artifacts::ops::ai_get_artifact(&ctx, &config, artifact_id.trim()).await?)})}@@ -511,9 +509,7 @@ fn handle_delete_artifact(ctx: DispatchCtx, params: Map<String, Value>) -> ContrBox::pin(async move {let config = ctx.load_config().await?;let artifact_id = read_required::<String>(¶ms, "artifact_id")?;- to_json(- crate::artifacts::ops::ai_delete_artifact(&ctx, &config, artifact_id.trim()).await?,- )+ to_json(crate::artifacts::ops::ai_delete_artifact(&ctx, &config, artifact_id.trim()).await?)})}diff --git a/crates/openhuman-core/src/artifacts/tiny_store_tests.rs b/crates/openhuman-core/src/artifacts/tiny_store_tests.rsindex a27323df11..33579c4d51 100644--- a/crates/openhuman-core/src/artifacts/tiny_store_tests.rs+++ b/crates/openhuman-core/src/artifacts/tiny_store_tests.rs@@ -384,9 +384,9 @@ fn share_artifact_is_offered_only_with_a_publisher() {&workspace,publisher_available,)- .iter()- .map(|t| t.name().to_string())- .collect::<Vec<_>>()+ .iter()+ .map(|t| t.name().to_string())+ .collect::<Vec<_>>()};let without = names(false);assert!(