Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

style: apply rustfmt import ordering and formatting across artifacts and document tools

Steven Enamakele5a7544e8183
diff --git a/crates/openhuman-core/src/artifacts/ops.rs b/crates/openhuman-core/src/artifacts/ops.rs
index ef5bc5af96..4d48fc2706 100644
--- a/crates/openhuman-core/src/artifacts/ops.rs
+++ b/crates/openhuman-core/src/artifacts/ops.rs
@@ -1,4 +1,4 @@
-use serde_json::{json, Value};
+use serde_json::{Value, json};
use crate::config::Config;
use crate::core::Outcome;
@@ -6,10 +6,10 @@ use crate::core::Outcome;
// Imports used only by the `documents`-gated presentation regeneration helper
// below; when the feature is off the PresentationTool is compiled out.
#[cfg(feature = "documents")]
-use crate::security::approval::ApprovalChatContext;
-#[cfg(feature = "documents")]
use crate::security::SecurityPolicy;
#[cfg(feature = "documents")]
+use crate::security::approval::ApprovalChatContext;
+#[cfg(feature = "documents")]
use crate::tools::PresentationTool;
use super::store;
diff --git a/crates/openhuman-core/src/artifacts/ops_tests.rs b/crates/openhuman-core/src/artifacts/ops_tests.rs
index 2061e83d81..de8006f45b 100644
--- a/crates/openhuman-core/src/artifacts/ops_tests.rs
+++ b/crates/openhuman-core/src/artifacts/ops_tests.rs
@@ -187,39 +187,45 @@ async fn delete_missing_id_error() {
async fn regenerate_rejects_empty_id() {
let tmp = TempDir::new().unwrap();
let config = test_config(&tmp);
- assert!(ai_regenerate(
- &crate::core::runtime::DispatchCtx::ambient(),
- &config,
- "",
- "t",
- "c"
- )
- .await
- .is_err());
+ assert!(
+ ai_regenerate(
+ &crate::core::runtime::DispatchCtx::ambient(),
+ &config,
+ "",
+ "t",
+ "c"
+ )
+ .await
+ .is_err()
+ );
}
#[tokio::test]
async fn regenerate_requires_thread_and_client() {
let tmp = TempDir::new().unwrap();
let config = test_config(&tmp);
- assert!(ai_regenerate(
- &crate::core::runtime::DispatchCtx::ambient(),
- &config,
- "id",
- "",
- "c"
- )
- .await
- .is_err());
- assert!(ai_regenerate(
- &crate::core::runtime::DispatchCtx::ambient(),
- &config,
- "id",
- "t",
- ""
- )
- .await
- .is_err());
+ assert!(
+ ai_regenerate(
+ &crate::core::runtime::DispatchCtx::ambient(),
+ &config,
+ "id",
+ "",
+ "c"
+ )
+ .await
+ .is_err()
+ );
+ assert!(
+ ai_regenerate(
+ &crate::core::runtime::DispatchCtx::ambient(),
+ &config,
+ "id",
+ "t",
+ ""
+ )
+ .await
+ .is_err()
+ );
}
#[tokio::test]
diff --git a/crates/openhuman-core/src/artifacts/preview.rs b/crates/openhuman-core/src/artifacts/preview.rs
index c13a7c5143..f89f479ec9 100644
--- a/crates/openhuman-core/src/artifacts/preview.rs
+++ b/crates/openhuman-core/src/artifacts/preview.rs
@@ -64,15 +64,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(),
- )
- .await?
- }
+ None => legacy_record(&config.workspace_dir, &files, id, file_store.as_ref()).await?,
};
let converter = DocumentConverter::for_config(config);
let display_path = match super::store::get_artifact(&config.workspace_dir, id).await {
@@ -111,7 +103,8 @@ async fn legacy_record(
size_bytes: meta.size_bytes,
media_type: None,
};
- let file_store = file_store.ok_or_else(|| "artifact file storage is unavailable".to_string())?;
+ let file_store =
+ file_store.ok_or_else(|| "artifact file storage is unavailable".to_string())?;
let parent = Path::new(&path)
.parent()
.ok_or_else(|| "legacy artifact file has no parent folder".to_string())?;
@@ -120,10 +113,13 @@ async fn legacy_record(
file_store.as_ref(),
&roots,
&legacy_ref,
- &format!("artifacts/files/{id}/v1.{}", Path::new(&path)
- .extension()
- .and_then(|ext| ext.to_str())
- .unwrap_or("bin")),
+ &format!(
+ "artifacts/files/{id}/v1.{}",
+ Path::new(&path)
+ .extension()
+ .and_then(|ext| ext.to_str())
+ .unwrap_or("bin")
+ ),
)
.await
.map_err(|e| e.to_string())?;
diff --git a/crates/openhuman-core/src/artifacts/preview_tests.rs b/crates/openhuman-core/src/artifacts/preview_tests.rs
index da311b141b..55db633e48 100644
--- a/crates/openhuman-core/src/artifacts/preview_tests.rs
+++ b/crates/openhuman-core/src/artifacts/preview_tests.rs
@@ -1,17 +1,13 @@
use std::path::Path;
-use tiny_artifacts::{ArtifactAuthor, ArtifactKind, ArtifactRecord, ArtifactVersion, FileRef, FileStore};
+use tiny_artifacts::{
+ ArtifactAuthor, ArtifactKind, ArtifactRecord, ArtifactVersion, FileRef, FileStore,
+};
use super::*;
fn file_record(key: &str, size_bytes: u64) -> ArtifactRecord {
- let mut version = ArtifactVersion::new(
- 1,
- key,
- ArtifactAuthor::Agent,
- "agent",
- 1,
- );
+ let mut version = ArtifactVersion::new(1, key, ArtifactAuthor::Agent, "agent", 1);
version.file = Some(FileRef {
key: key.to_string(),
size_bytes,
@@ -49,15 +45,12 @@ async fn a_text_kind_shows_its_newest_version() {
async fn a_text_file_is_read_from_the_scoped_file_store() {
let dir = tempfile::tempdir().unwrap();
let files = file_store(dir.path());
- files.put("artifacts/files/f-1/v1.txt", b"plain notes", None).await.unwrap();
+ files
+ .put("artifacts/files/f-1/v1.txt", b"plain notes", None)
+ .await
+ .unwrap();
let record = file_record("artifacts/files/f-1/v1.txt", 11);
- let body = body_of(
- &record,
- Some(&files),
- None,
- &DocumentConverter::none(),
- )
- .await;
+ let body = body_of(&record, Some(&files), None, &DocumentConverter::none()).await;
assert_eq!(body.kind, "file");
assert_eq!(body.body, "plain notes");
assert!(body.is_text);
@@ -67,15 +60,12 @@ async fn a_text_file_is_read_from_the_scoped_file_store() {
async fn a_blob_file_is_not_read_without_its_store() {
let elsewhere = tempfile::tempdir().unwrap();
let files = file_store(elsewhere.path());
- files.put("artifacts/files/f-1/v1.txt", b"do not read", None).await.unwrap();
+ files
+ .put("artifacts/files/f-1/v1.txt", b"do not read", None)
+ .await
+ .unwrap();
let record = file_record("artifacts/files/f-1/v1.txt", 11);
- let body = body_of(
- &record,
- None,
- None,
- &DocumentConverter::none(),
- )
- .await;
+ let body = body_of(&record, None, None, &DocumentConverter::none()).await;
// Shown as a file: its path, never its content.
assert!(!body.is_text);
assert_eq!(body.body, "v1.txt");
@@ -86,15 +76,12 @@ async fn a_file_over_the_preview_limit_is_not_read() {
let dir = tempfile::tempdir().unwrap();
let files = file_store(dir.path());
let bytes = vec![b'a'; (PREVIEW_MAX_BYTES + 1) as usize];
- files.put("artifacts/files/f-1/v1.txt", &bytes, None).await.unwrap();
+ files
+ .put("artifacts/files/f-1/v1.txt", &bytes, None)
+ .await
+ .unwrap();
let record = file_record("artifacts/files/f-1/v1.txt", bytes.len() as u64);
- let body = body_of(
- &record,
- Some(&files),
- None,
- &DocumentConverter::none(),
- )
- .await;
+ let body = body_of(&record, Some(&files), None, &DocumentConverter::none()).await;
assert!(!body.is_text);
assert_eq!(body.body, "v1.txt");
}
@@ -103,15 +90,16 @@ async fn a_file_over_the_preview_limit_is_not_read() {
async fn a_binary_file_with_no_converter_shows_as_a_file() {
let dir = tempfile::tempdir().unwrap();
let files = file_store(dir.path());
- files.put("artifacts/files/f-1/v1.docx", b"PK\x03\x04\x00\x00binary", None).await.unwrap();
+ files
+ .put(
+ "artifacts/files/f-1/v1.docx",
+ b"PK\x03\x04\x00\x00binary",
+ None,
+ )
+ .await
+ .unwrap();
let record = file_record("artifacts/files/f-1/v1.docx", 10);
- let body = body_of(
- &record,
- Some(&files),
- None,
- &DocumentConverter::none(),
- )
- .await;
+ let body = body_of(&record, Some(&files), None, &DocumentConverter::none()).await;
assert!(!body.is_text && !body.converted);
assert_eq!(body.body, "v1.docx");
}
diff --git a/crates/openhuman-core/src/artifacts/production_tests.rs b/crates/openhuman-core/src/artifacts/production_tests.rs
index 4c4904e4ff..de88fffcc0 100644
--- a/crates/openhuman-core/src/artifacts/production_tests.rs
+++ b/crates/openhuman-core/src/artifacts/production_tests.rs
@@ -1,7 +1,7 @@
use std::path::PathBuf;
-use tiny_artifacts::{ArtifactKind, ArtifactStatus as RecordStatus, ArtifactStore};
use tiny_artifacts::FileStore;
+use tiny_artifacts::{ArtifactKind, ArtifactStatus as RecordStatus, ArtifactStore};
use super::*;
use crate::artifacts::store::get_artifact;
diff --git a/crates/openhuman-core/src/artifacts/schemas.rs b/crates/openhuman-core/src/artifacts/schemas.rs
index cdd572b6d0..543d9d84ac 100644
--- a/crates/openhuman-core/src/artifacts/schemas.rs
+++ b/crates/openhuman-core/src/artifacts/schemas.rs
@@ -2,8 +2,8 @@ use crate::core::runtime::DispatchCtx;
use serde::de::DeserializeOwned;
use serde_json::{Map, Value};
-use crate::core::all::{ControllerFuture, RegisteredController};
use crate::core::Outcome;
+use crate::core::all::{ControllerFuture, RegisteredController};
use crate::core::{ControllerSchema, FieldSchema, TypeSchema};
pub fn all_controller_schemas() -> Vec<ControllerSchema> {
@@ -67,15 +67,13 @@ pub fn schemas(function: &str) -> ControllerSchema {
FieldSchema {
name: "limit",
ty: TypeSchema::Option(Box::new(TypeSchema::U64)),
- comment:
- "Maximum number of artifacts to return; defaults to 50, capped at 200.",
+ comment: "Maximum number of artifacts to return; defaults to 50, capped at 200.",
required: false,
},
FieldSchema {
name: "thread_id",
ty: TypeSchema::Option(Box::new(TypeSchema::String)),
- comment:
- "When set, return only artifacts whose meta.json was written for this \
+ comment: "When set, return only artifacts whose meta.json was written for this \
chat thread (#3226). Lets ChatFilesPanel repopulate from disk on a \
fresh redux slice / new device. Absent (or null) returns all artifacts.",
required: false,
@@ -457,7 +455,7 @@ fn handle_save_artifact_version(ctx: DispatchCtx, params: Map<String, Value>) ->
&body,
&ctx,
)
- .await?,
+ .await?,
)
})
}
@@ -485,7 +483,7 @@ fn handle_share_artifact(ctx: DispatchCtx, params: Map<String, Value>) -> Contro
return Err(format!(
"invalid 'public': expected bool, got {}",
type_name(other)
- ))
+ ));
}
};
to_json(
@@ -496,7 +494,7 @@ fn handle_share_artifact(ctx: DispatchCtx, params: Map<String, Value>) -> Contro
public,
&ctx,
)
- .await?,
+ .await?,
)
})
}
diff --git a/crates/openhuman-core/src/artifacts/tiny_store.rs b/crates/openhuman-core/src/artifacts/tiny_store.rs
index 726f076cc7..bc2d32aa79 100644
--- a/crates/openhuman-core/src/artifacts/tiny_store.rs
+++ b/crates/openhuman-core/src/artifacts/tiny_store.rs
@@ -30,8 +30,8 @@ use std::sync::Arc;
use async_trait::async_trait;
use tiny_artifacts::{
- ArtifactEvent, ArtifactEventKind, ArtifactKind, ArtifactObserver, ArtifactRecord, ArtifactStore,
- Artifacts, Author, Content, FileRef, FileStore,
+ ArtifactEvent, ArtifactEventKind, ArtifactKind, ArtifactObserver, ArtifactRecord,
+ ArtifactStore, Artifacts, Author, Content, FileRef, FileStore,
};
use super::files::FileRoots;
@@ -120,13 +120,9 @@ impl LegacyFileImportStore {
.and_then(|ext| ext.to_str())
.unwrap_or("bin");
let key = format!("artifacts/files/{}/v{}.{}", record.id, version.version, ext);
- let imported = tiny_artifacts::import_legacy_file(
- self.files.as_ref(),
- &self.roots,
- &legacy,
- &key,
- )
- .await?;
+ let imported =
+ tiny_artifacts::import_legacy_file(self.files.as_ref(), &self.roots, &legacy, &key)
+ .await?;
version.body = imported.key.clone();
version.file = Some(imported);
changed = true;
@@ -216,9 +212,10 @@ impl LegacyUiBridge {
== Some(ext.clone())
});
if let Some(owned) = owned {
- let file_store = self.file_store.as_ref().ok_or_else(|| {
- anyhow::anyhow!("artifact file storage is unavailable")
- })?;
+ let file_store = self
+ .file_store
+ .as_ref()
+ .ok_or_else(|| anyhow::anyhow!("artifact file storage is unavailable"))?;
let bytes = file_store.read(&file.key).await?;
tokio::fs::write(owned, &bytes).await?;
let size = bytes.len() as u64;
@@ -248,9 +245,10 @@ impl LegacyUiBridge {
.map_err(anyhow::Error::msg)?;
let size = if record.holds_file() {
if let Some(file) = latest.file.as_ref() {
- let file_store = self.file_store.as_ref().ok_or_else(|| {
- anyhow::anyhow!("artifact file storage is unavailable")
- })?;
+ let file_store = self
+ .file_store
+ .as_ref()
+ .ok_or_else(|| anyhow::anyhow!("artifact file storage is unavailable"))?;
let bytes = file_store.read(&file.key).await?;
tokio::fs::write(&dest, &bytes).await?;
bytes.len() as u64
@@ -445,19 +443,16 @@ pub fn registered_tools(
let service = {
let workspace_dir = workspace_dir.to_path_buf();
let action_dir = action_dir.to_path_buf();
- Arc::new(move |chat: Option<&ApprovalChatContext>, ctx: &crate::core::runtime::DispatchCtx| {
- let mut service = artifacts_service(
- &workspace_dir,
- files.clone(),
- Some(&action_dir),
- chat,
- ctx,
- );
- if let Some(publisher) = &publisher {
- service = service.with_publisher(publisher.clone());
- }
- Arc::new(service)
- })
+ Arc::new(
+ move |chat: Option<&ApprovalChatContext>, ctx: &crate::core::runtime::DispatchCtx| {
+ let mut service =
+ artifacts_service(&workspace_dir, files.clone(), Some(&action_dir), chat, ctx);
+ if let Some(publisher) = &publisher {
+ service = service.with_publisher(publisher.clone());
+ }
+ Arc::new(service)
+ },
+ )
};
let author = Author::agent(AGENT_AUTHOR_ID);
let mut tools: Vec<Box<dyn tinytools::Tool>> = Vec::new();
diff --git a/crates/openhuman-core/src/artifacts/tiny_store_tests.rs b/crates/openhuman-core/src/artifacts/tiny_store_tests.rs
index 56b165b1b8..e6babaeb4d 100644
--- a/crates/openhuman-core/src/artifacts/tiny_store_tests.rs
+++ b/crates/openhuman-core/src/artifacts/tiny_store_tests.rs
@@ -50,7 +50,13 @@ async fn legacy_path_refs_are_guarded_and_imported_as_opaque_file_keys() {
files: blobs.clone(),
roots: guarded_roots(vec![source_root]),
};
- let mut version = ArtifactVersion::new(1, source.display().to_string(), ArtifactAuthor::Agent, "agent", 1);
+ let mut version = ArtifactVersion::new(
+ 1,
+ source.display().to_string(),
+ ArtifactAuthor::Agent,
+ "agent",
+ 1,
+ );
version.file = Some(FileRef {
key: source.display().to_string(),
size_bytes: 12,
@@ -151,7 +157,13 @@ async fn an_image_filed_through_the_service_gets_a_card_and_a_copy_in_files() {
std::fs::create_dir_all(&action).unwrap();
std::fs::write(action.join("chart.png"), b"png-bytes").unwrap();
let ctx = crate::core::runtime::DispatchCtx::process_default();
- let artifacts = artifacts_service(&workspace, FileRoots::new(&files), Some(&action), None, &ctx);
+ let artifacts = artifacts_service(
+ &workspace,
+ FileRoots::new(&files),
+ Some(&action),
+ None,
+ &ctx,
+ );
let saved = artifacts
.create(
@@ -215,16 +227,20 @@ async fn deleting_an_artifact_removes_its_card() {
.await
.unwrap();
let id = saved.record.id;
- assert!(super::super::store::get_artifact(&workspace, &id)
- .await
- .is_ok());
+ assert!(
+ super::super::store::get_artifact(&workspace, &id)
+ .await
+ .is_ok()
+ );
let (removed, notice) = artifacts.delete(&id).await.unwrap();
assert!(removed);
assert!(notice.is_none(), "{notice:?}");
- assert!(super::super::store::get_artifact(&workspace, &id)
- .await
- .is_err());
+ assert!(
+ super::super::store::get_artifact(&workspace, &id)
+ .await
+ .is_err()
+ );
}
struct NoopPublisher;
@@ -309,7 +325,13 @@ async fn a_protected_file_inside_the_working_folder_is_refused() {
std::fs::create_dir_all(&ssh).unwrap();
std::fs::write(ssh.join("id_ed25519"), b"PRIVATE").unwrap();
let ctx = crate::core::runtime::DispatchCtx::process_default();
- let artifacts = artifacts_service(&workspace, FileRoots::new(&files), Some(&action), None, &ctx);
+ let artifacts = artifacts_service(
+ &workspace,
+ FileRoots::new(&files),
+ Some(&action),
+ None,
+ &ctx,
+ );
let err = artifacts
.create(
diff --git a/crates/openhuman-core/src/media/generation/artifact_tool.rs b/crates/openhuman-core/src/media/generation/artifact_tool.rs
index b726a983e5..44fb9539ae 100644
--- a/crates/openhuman-core/src/media/generation/artifact_tool.rs
+++ b/crates/openhuman-core/src/media/generation/artifact_tool.rs
@@ -29,20 +29,20 @@ use std::path::{Path, PathBuf};
use std::sync::Arc;
use async_trait::async_trait;
-use serde_json::{json, Value};
+use serde_json::{Value, json};
use tinytools::{
PermissionLevel, Tool, ToolCallOptions, ToolCategory, ToolContent, ToolPolicy, ToolResult,
ToolRunContext, ToolScope, ToolTimeout,
};
use tokio::io::AsyncWriteExt;
-use crate::artifacts::production::Production;
use crate::artifacts::ArtifactKind;
+use crate::artifacts::production::Production;
use crate::security::approval::ApprovalChatContext;
use crate::tools::host_extensions::tool_call_id;
use tinyagents_harness::tinyinference_video::ProgressFn;
-use super::progress::{video_status_observer, JobStateSlot};
+use super::progress::{JobStateSlot, video_status_observer};
const FILE_REFERENCE_FIELDS: [&str; 8] = [
"references",
@@ -569,7 +569,8 @@ impl<T: Tool> Tool for MediaArtifactTool<T> {
};
let job_state = JobStateSlot::default();
let approval = crate::agent::tinyagents::host::run_context::approval_for_tool(context);
- let dispatch_ctx = crate::agent::tinyagents::host::run_context::dispatch_ctx_for_tool(context);
+ let dispatch_ctx =
+ crate::agent::tinyagents::host::run_context::dispatch_ctx_for_tool(context);
let per_call_inner = self.per_call.as_ref().map(|build| {
build(
video_status_observer(job_state.clone()),
@@ -590,7 +591,13 @@ impl<T: Tool> Tool for MediaArtifactTool<T> {
}
let call_id = tool_call_id(context);
Ok(self
- .attach_artifacts(result, &args, call_id, approval.chat.as_ref(), &dispatch_ctx)
+ .attach_artifacts(
+ result,
+ &args,
+ call_id,
+ approval.chat.as_ref(),
+ &dispatch_ctx,
+ )
.await)
}
}
diff --git a/crates/openhuman-core/src/media/generation/artifact_tool_tests.rs b/crates/openhuman-core/src/media/generation/artifact_tool_tests.rs
index 919b67df3c..b3430b01c4 100644
--- a/crates/openhuman-core/src/media/generation/artifact_tool_tests.rs
+++ b/crates/openhuman-core/src/media/generation/artifact_tool_tests.rs
@@ -1,12 +1,12 @@
use async_trait::async_trait;
-use serde_json::{json, Value};
+use serde_json::{Value, json};
use std::path::Path;
use std::sync::Arc;
use tinyagents_harness::media::MediaOutput;
use tinystoragedrivers::BlobStore;
use tinytools::{PermissionLevel, Tool, ToolCategory, ToolContent, ToolResult};
-use super::{copy_blob_to_file, has_reusable_files_reference, MediaArtifactTool};
+use super::{MediaArtifactTool, copy_blob_to_file, has_reusable_files_reference};
use crate::artifacts::{ArtifactKind, ArtifactStatus, FileRoots};
#[test]
@@ -62,10 +62,11 @@ async fn artifact_history_refresh_failure_fails_closed_for_cached_files() {
.with_reference_allowlist(Arc::clone(&allowed));
assert!(allowed.lock().unwrap().contains(&replacement));
- assert!(tool
- .execute(json!({ "references": [replacement.to_string_lossy()] }))
- .await
- .is_err());
+ assert!(
+ tool.execute(json!({ "references": [replacement.to_string_lossy()] }))
+ .await
+ .is_err()
+ );
}
struct PartialThenFail(bool);
@@ -222,11 +223,13 @@ async fn files_a_blob_backed_generated_artifact() {
Some(format!("Saved image at {}\nCost: $0.01", canonical_file.display()).as_str())
);
assert_eq!(std::fs::read(&file).unwrap(), b"blob-media-bytes");
- assert!(blobs
- .get("generated-media/stub-0.png")
- .await
- .unwrap()
- .is_none());
+ assert!(
+ blobs
+ .get("generated-media/stub-0.png")
+ .await
+ .unwrap()
+ .is_none()
+ );
let (_, failed_file) = crate::artifacts::create_artifact_for_call(
&workspace,
@@ -289,13 +292,15 @@ async fn files_a_blob_backed_generated_artifact() {
"failed regeneration retains the previous non-empty file"
);
fresh.refresh_allowed_references().await.unwrap();
- assert!(!fresh
- .allowed_references
- .as_ref()
- .unwrap()
- .lock()
- .unwrap()
- .contains(&canonical_file));
+ assert!(
+ !fresh
+ .allowed_references
+ .as_ref()
+ .unwrap()
+ .lock()
+ .unwrap()
+ .contains(&canonical_file)
+ );
}
#[tokio::test]
@@ -433,10 +438,11 @@ async fn files_every_artifact_when_n_greater_than_one() {
.await
.expect("artifact metadata is persisted");
assert_eq!(meta.status, ArtifactStatus::Ready);
- assert!(meta
- .file
- .as_deref()
- .is_some_and(|file| std::path::Path::new(file).exists()));
+ assert!(
+ meta.file
+ .as_deref()
+ .is_some_and(|file| std::path::Path::new(file).exists())
+ );
}
}
diff --git a/crates/openhuman-core/src/tools/impl/document/mod.rs b/crates/openhuman-core/src/tools/impl/document/mod.rs
index 68c9f3d9fd..61a0f70b92 100644
--- a/crates/openhuman-core/src/tools/impl/document/mod.rs
+++ b/crates/openhuman-core/src/tools/impl/document/mod.rs
@@ -30,7 +30,7 @@ use std::sync::Arc;
use std::time::Duration;
use async_trait::async_trait;
-use serde_json::{json, Value};
+use serde_json::{Value, json};
use crate::artifacts::production::Production;
use crate::security::SecurityPolicy;
@@ -56,7 +56,7 @@ mod types;
#[path = "document_tests.rs"]
mod tests;
-use self::types::{validate_input, GenerateDocumentInput, GenerateDocumentOutput};
+use self::types::{GenerateDocumentInput, GenerateDocumentOutput, validate_input};
/// Generation timeout. `docx-rs` typically completes the full section cap
/// in well under a second; the 30 s ceiling is a defensive bound against
diff --git a/crates/openhuman-core/src/tools/impl/document/types.rs b/crates/openhuman-core/src/tools/impl/document/types.rs
index c77fd115c1..a3f033f881 100644
--- a/crates/openhuman-core/src/tools/impl/document/types.rs
+++ b/crates/openhuman-core/src/tools/impl/document/types.rs
@@ -27,8 +27,8 @@ use crate::modules::documents::DocumentCallError;
// are the same ones the module validates against, which is the whole reason
// `spec` is separable.
pub use crate::tools::implementations::document::format::spec::document::{
- DocumentSpec as GenerateDocumentInput, MAX_BULLETS_PER_SECTION, MAX_PARAGRAPHS_PER_SECTION,
- MAX_PARAGRAPH_CHARS, MAX_SECTIONS, MAX_TEXT_CHARS,
+ DocumentSpec as GenerateDocumentInput, MAX_BULLETS_PER_SECTION, MAX_PARAGRAPH_CHARS,
+ MAX_PARAGRAPHS_PER_SECTION, MAX_SECTIONS, MAX_TEXT_CHARS,
};
// `sections` is a `Vec<DocumentSection>`, so anything constructing an input
diff --git a/crates/openhuman-core/src/tools/impl/presentation/mod.rs b/crates/openhuman-core/src/tools/impl/presentation/mod.rs
index ae67f93010..ea9bcef277 100644
--- a/crates/openhuman-core/src/tools/impl/presentation/mod.rs
+++ b/crates/openhuman-core/src/tools/impl/presentation/mod.rs
@@ -33,7 +33,7 @@ use std::sync::Arc;
use std::time::Duration;
use async_trait::async_trait;
-use serde_json::{json, Value};
+use serde_json::{Value, json};
use crate::artifacts::production::Production;
use crate::artifacts::read_artifact_bytes;
@@ -50,8 +50,8 @@ mod tests;
use crate::tools::implementations::document::format::spec::SlideImage;
use self::types::{
- validate_input, GeneratePresentationInput, GeneratePresentationOutput, SlideImageRequest,
- SlideImageSource, MAX_IMAGE_BYTES,
+ GeneratePresentationInput, GeneratePresentationOutput, MAX_IMAGE_BYTES, SlideImageRequest,
+ SlideImageSource, validate_input,
};
/// Generation timeout. `ppt-rs` typically completes the full 64-slide
diff --git a/crates/openhuman-core/src/tools/impl/presentation/presentation_tests.rs b/crates/openhuman-core/src/tools/impl/presentation/presentation_tests.rs
index b0cc052280..803027817d 100644
--- a/crates/openhuman-core/src/tools/impl/presentation/presentation_tests.rs
+++ b/crates/openhuman-core/src/tools/impl/presentation/presentation_tests.rs
@@ -13,7 +13,7 @@
//! perspective.
use super::types::GeneratePresentationInput;
-use super::types::{PresentationError, MAX_BULLETS_PER_SLIDE, MAX_SLIDES, MAX_TEXT_CHARS};
+use super::types::{MAX_BULLETS_PER_SLIDE, MAX_SLIDES, MAX_TEXT_CHARS, PresentationError};
use super::*;
use std::path::Path;
@@ -222,7 +222,7 @@ async fn execute_happy_path_returns_artifact_metadata() {
/// Canonical 1×1 PNG, written to disk to exercise the File source path.
fn png_1x1() -> Vec<u8> {
- use base64::{engine::general_purpose::STANDARD, Engine as _};
+ use base64::{Engine as _, engine::general_purpose::STANDARD};
STANDARD
.decode("iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==")
.unwrap()
diff --git a/crates/openhuman-core/src/tools/impl/presentation/types.rs b/crates/openhuman-core/src/tools/impl/presentation/types.rs
index 7359b11f70..6582ec24b4 100644
--- a/crates/openhuman-core/src/tools/impl/presentation/types.rs
+++ b/crates/openhuman-core/src/tools/impl/presentation/types.rs
@@ -7,7 +7,7 @@ use crate::modules::documents::DocumentCallError;
// The size limits are the wire contract's: the tool validates against the same
// numbers the `tinydocs` module enforces, so they are defined once, there.
pub(super) use crate::tools::implementations::document::format::spec::presentation::{
- MAX_BULLETS_PER_SLIDE, MAX_IMAGES_PER_DECK, MAX_IMAGES_PER_SLIDE, MAX_IMAGE_BYTES, MAX_SLIDES,
+ MAX_BULLETS_PER_SLIDE, MAX_IMAGE_BYTES, MAX_IMAGES_PER_DECK, MAX_IMAGES_PER_SLIDE, MAX_SLIDES,
MAX_TEXT_CHARS,
};