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 line wrapping

Steven Enamakelcb0ed38e78bb
diff --git a/crates/openhuman-core/src/agent/subagent_host/ops/graph_failed_run_tests.rs b/crates/openhuman-core/src/agent/subagent_host/ops/graph_failed_run_tests.rs
index af1404d98b..24f56b560b 100644
--- a/crates/openhuman-core/src/agent/subagent_host/ops/graph_failed_run_tests.rs
+++ b/crates/openhuman-core/src/agent/subagent_host/ops/graph_failed_run_tests.rs
@@ -80,8 +80,7 @@ async fn failed_subagent_run_keeps_its_unanswered_round_out_of_history() {
let mut history = vec![TranscriptMessage::user("please echo twice")];
let workspace = tempfile::TempDir::new().expect("temp workspace");
let stem = "root-session__failed_run";
- let locator =
- crate::storage::sessions::transcripts_or_files("orchestrator", workspace.path());
+ let locator = crate::storage::sessions::transcripts_or_files("orchestrator", workspace.path());
let mut run_context = crate::agent::tinyagents::host::OpenHumanRunContext::new();
run_context.transcripts = Some(locator.clone());
diff --git a/crates/openhuman-core/src/agent/subagent_host/ops/graph_tests.rs b/crates/openhuman-core/src/agent/subagent_host/ops/graph_tests.rs
index 0e34e9c47a..dd9865240b 100644
--- a/crates/openhuman-core/src/agent/subagent_host/ops/graph_tests.rs
+++ b/crates/openhuman-core/src/agent/subagent_host/ops/graph_tests.rs
@@ -117,8 +117,7 @@ fn a_saas_subagent_without_a_context_or_tree_store_is_kept_in_memory() {
#[test]
fn subagent_transcript_keeps_cumulative_spend_separate_from_unknown_last_call() {
let workspace = tempfile::tempdir().unwrap();
- let locator =
- crate::storage::sessions::transcripts_or_files("orchestrator", workspace.path());
+ let locator = crate::storage::sessions::transcripts_or_files("orchestrator", workspace.path());
let usage = AggregatedUsage {
input_tokens: 120,
output_tokens: 30,
@@ -253,8 +252,7 @@ fn parallel_worker_without_thread_keeps_parent_transcript_affinity() {
#[tokio::test]
async fn explicit_worker_thread_replaces_parent_for_model_run_and_transcript() {
let workspace = tempfile::tempdir().expect("workspace");
- let locator =
- crate::storage::sessions::transcripts_or_files("orchestrator", workspace.path());
+ let locator = crate::storage::sessions::transcripts_or_files("orchestrator", workspace.path());
let mut parent = crate::agent::tinyagents::host::OpenHumanRunContext::new();
parent.thread_id = Some("parent-thread".to_owned());
parent.transcripts = Some(locator.clone());
diff --git a/crates/openhuman-core/src/artifacts/artifact_wiring.rs b/crates/openhuman-core/src/artifacts/artifact_wiring.rs
index 69b559ba8a..c73627ffde 100644
--- a/crates/openhuman-core/src/artifacts/artifact_wiring.rs
+++ b/crates/openhuman-core/src/artifacts/artifact_wiring.rs
@@ -15,8 +15,8 @@ use std::path::Path;
use std::sync::Arc;
use crate::agent::harness::tool_result_artifacts::{HostArtifactStore, new_tool_result_store};
-use crate::storage::sessions::artifact_blobs_for;
use crate::security::policy::tool_result_artifacts_dir;
+use crate::storage::sessions::artifact_blobs_for;
use tinystoragedrivers::{MemoryStorage, Scope, StorageBackend};
/// How long a tool-result artifact survives: the blob lifetime handed to
diff --git a/crates/openhuman-core/src/core/runtime/bootstrap.rs b/crates/openhuman-core/src/core/runtime/bootstrap.rs
index 3e2930661e..2ed2b86b62 100644
--- a/crates/openhuman-core/src/core/runtime/bootstrap.rs
+++ b/crates/openhuman-core/src/core/runtime/bootstrap.rs
@@ -21,7 +21,7 @@ pub(crate) async fn bootstrap_core_runtime(
domains: crate::core::runtime::DomainSet,
ctx: &DispatchCtx,
) {
- use crate::platform::socket::{set_global_socket_manager, SocketManager};
+ use crate::platform::socket::{SocketManager, set_global_socket_manager};
use std::sync::Arc;
// `embedded_core` derived from host_kind so the rest of the function (which
// already keys behavior off the boolean) stays unchanged.
@@ -129,10 +129,9 @@ pub(crate) async fn bootstrap_core_runtime(
// rendering as perpetual "running" timeline entries on thread reopen.
if agent_enabled {
if !crate::storage::installed_is_shared() {
- match crate::storage::sessions::with_ledger(
- &cfg.workspace_dir,
- |ledger| async move { ledger.interrupt_orphaned_agent_runs().await },
- ) {
+ match crate::storage::sessions::with_ledger(&cfg.workspace_dir, |ledger| async move {
+ ledger.interrupt_orphaned_agent_runs().await
+ }) {
Ok(0) => {}
Ok(count) => {
log::info!("[runtime] settled {count} orphaned agent run(s) on startup")
diff --git a/crates/openhuman-core/src/cron/scheduler/origin_delivery.rs b/crates/openhuman-core/src/cron/scheduler/origin_delivery.rs
index cb6d484adf..580bf4bccb 100644
--- a/crates/openhuman-core/src/cron/scheduler/origin_delivery.rs
+++ b/crates/openhuman-core/src/cron/scheduler/origin_delivery.rs
@@ -14,8 +14,8 @@
use super::delivery::strip_openhuman_link_markup;
use crate::config::Config;
use crate::core::runtime::DispatchCtx;
-use crate::web_chat::{publish_web_channel_event, WebChannelEvent};
-use anyhow::{anyhow, Result};
+use crate::web_chat::{WebChannelEvent, publish_web_channel_event};
+use anyhow::{Result, anyhow};
use std::path::Path;
use {
crate::cron::channel_bridge, tinyflows_schedule::types::CronJob,
@@ -72,8 +72,8 @@ pub(crate) async fn append_to_origin_transcript(
append: &TranscriptAppend<'_>,
) -> Result<(), String> {
use tinyagents_session::transcript::{
- append_background_message_in, BackgroundAppend, BackgroundAppendOutcome, SessionRef,
- TranscriptMessage,
+ BackgroundAppend, BackgroundAppendOutcome, SessionRef, TranscriptMessage,
+ append_background_message_in,
};
let session = SessionRef::scoped(append.thread_id.to_string(), append.agent_id.to_string());
let options = BackgroundAppend::new(
diff --git a/crates/openhuman-core/src/cron/scheduler/origin_delivery_tests.rs b/crates/openhuman-core/src/cron/scheduler/origin_delivery_tests.rs
index f7134b2a57..c71188808a 100644
--- a/crates/openhuman-core/src/cron/scheduler/origin_delivery_tests.rs
+++ b/crates/openhuman-core/src/cron/scheduler/origin_delivery_tests.rs
@@ -99,13 +99,15 @@ async fn no_reply_is_suppressed_without_writing_anything() {
.await
.unwrap();
assert_eq!(status, DeliveryStatus::Suppressed);
- assert!(conversations::get_messages(
- &crate::core::runtime::DispatchCtx::ambient(),
- cfg.workspace_dir.clone(),
- "t-1"
- )
- .unwrap()
- .is_empty());
+ assert!(
+ conversations::get_messages(
+ &crate::core::runtime::DispatchCtx::ambient(),
+ cfg.workspace_dir.clone(),
+ "t-1"
+ )
+ .unwrap()
+ .is_empty()
+ );
}
#[tokio::test]
@@ -182,15 +184,17 @@ async fn web_delivery_to_a_missing_thread_fails() {
async fn origin_mode_without_an_origin_is_an_error() {
let tmp = tempfile::TempDir::new().unwrap();
let cfg = config(&tmp);
- assert!(deliver_to_origin(
- &crate::core::runtime::DispatchCtx::ambient(),
- &cfg,
- &job(None),
- "run-1",
- "hi"
- )
- .await
- .is_err());
+ assert!(
+ deliver_to_origin(
+ &crate::core::runtime::DispatchCtx::ambient(),
+ &cfg,
+ &job(None),
+ "run-1",
+ "hi"
+ )
+ .await
+ .is_err()
+ );
}
fn meta() -> TranscriptMeta {
diff --git a/crates/openhuman-core/src/cron/scheduler_dispatch_tests.rs b/crates/openhuman-core/src/cron/scheduler_dispatch_tests.rs
index 3d8305ac12..c4f38cfb23 100644
--- a/crates/openhuman-core/src/cron/scheduler_dispatch_tests.rs
+++ b/crates/openhuman-core/src/cron/scheduler_dispatch_tests.rs
@@ -3,13 +3,13 @@
//! are honoured and a system job's handler result is what gets recorded.
use super::*;
-use crate::cron::system_job_handlers::{register, SystemJobContext};
+use crate::cron::system_job_handlers::{SystemJobContext, register};
use crate::cron::system_jobs::ensure_system_job;
use std::sync::atomic::{AtomicUsize, Ordering};
use std::time::Duration;
use tempfile::TempDir;
-use tinyflows_schedule::types::Schedule;
use tinyflows_schedule::JobPolicy;
+use tinyflows_schedule::types::Schedule;
/// Stores `policy` on the job.
fn set_policy(config: &Config, job_id: &str, policy: JobPolicy) -> anyhow::Result<()> {
@@ -182,10 +182,12 @@ async fn dispatch_claims_the_slot_so_a_running_job_is_not_due_again() {
dispatcher.dispatch(vec![job.clone()]).await.unwrap();
let stored = cron::get_job(&config, &job.id).unwrap();
assert!(stored.next_run > Utc::now(), "the running slot is claimed");
- assert!(cron::due_jobs(&config, Utc::now())
- .unwrap()
- .iter()
- .all(|due| due.id != job.id));
+ assert!(
+ cron::due_jobs(&config, Utc::now())
+ .unwrap()
+ .iter()
+ .all(|due| due.id != job.id)
+ );
release.notify_one();
dispatcher.drain().await;
}
@@ -342,10 +344,12 @@ async fn a_system_job_handler_error_is_recorded_as_the_run_result() {
dispatcher.drain().await;
let stored = cron::get_job(&config, &job.id).unwrap();
assert_eq!(stored.last_status.as_deref(), Some("error"));
- assert!(stored
- .last_output
- .unwrap_or_default()
- .contains("handler failed"));
+ assert!(
+ stored
+ .last_output
+ .unwrap_or_default()
+ .contains("handler failed")
+ );
}
#[tokio::test]
@@ -463,10 +467,12 @@ async fn a_flow_schedule_job_fires_through_the_trigger_sink() {
let stored = cron::get_job(&config, &job.id).unwrap();
assert_eq!(stored.last_status.as_deref(), Some("ok"));
- assert!(stored
- .last_output
- .unwrap_or_default()
- .contains("flow schedule tick emitted for flow flow-missing-for-sink"));
+ assert!(
+ stored
+ .last_output
+ .unwrap_or_default()
+ .contains("flow schedule tick emitted for flow flow-missing-for-sink")
+ );
assert!(stored.next_run > Utc::now(), "the recurrence moved on");
}
diff --git a/crates/openhuman-core/src/cron/store_tests.rs b/crates/openhuman-core/src/cron/store_tests.rs
index 737ad8c18d..6ca731f81b 100644
--- a/crates/openhuman-core/src/cron/store_tests.rs
+++ b/crates/openhuman-core/src/cron/store_tests.rs
@@ -147,9 +147,11 @@ fn a_legacy_jobs_db_is_imported_by_the_storage_importer_and_left_untouched() {
let jobs = list_jobs(&config).unwrap();
assert_eq!(jobs.len(), 3);
assert!(jobs.iter().any(|job| job.name.as_deref() == Some("inbox")));
- assert!(find_flow_schedule_job(&config, "flow-beta")
- .unwrap()
- .is_some());
+ assert!(
+ find_flow_schedule_job(&config, "flow-beta")
+ .unwrap()
+ .is_some()
+ );
assert_eq!(
std::fs::read(&legacy).unwrap(),
before,
diff --git a/crates/openhuman-core/src/desktop/notifications/store_documents.rs b/crates/openhuman-core/src/desktop/notifications/store_documents.rs
index 4804e014bf..d1636ca7c1 100644
--- a/crates/openhuman-core/src/desktop/notifications/store_documents.rs
+++ b/crates/openhuman-core/src/desktop/notifications/store_documents.rs
@@ -29,7 +29,7 @@ use std::sync::Arc;
use anyhow::{Context, Result};
use chrono::{DateTime, Duration, Utc};
-use serde_json::{json, Map, Value};
+use serde_json::{Map, Value, json};
use sha2::{Digest, Sha256};
use tinystoragedrivers::{
CollectionSpec, ErrorKind, Filter, IndexSpec, Precondition, Query, Sort, Versioned,
@@ -40,7 +40,7 @@ use super::types::{
NotificationStatus,
};
use crate::config::Config;
-use crate::storage::documents::{compare_and_swap, text, Repo, CAS_ATTEMPTS};
+use crate::storage::documents::{CAS_ATTEMPTS, Repo, compare_and_swap, text};
use crate::storage::{DocumentStore, DocumentStoreExt, StorageError};
pub(super) const NOTIFICATIONS: &str = "integration_notifications";
diff --git a/crates/openhuman-core/src/desktop/notifications/store_import.rs b/crates/openhuman-core/src/desktop/notifications/store_import.rs
index 14a8ee16b8..0d29715df1 100644
--- a/crates/openhuman-core/src/desktop/notifications/store_import.rs
+++ b/crates/openhuman-core/src/desktop/notifications/store_import.rs
@@ -23,9 +23,9 @@ use serde_json::json;
mod store_rows;
use store_rows::rows_to_notifications;
-use super::store_documents::{core_id, to_doc, CORE, LOCAL_WORKSPACE, NOTIFICATIONS, SETTINGS};
+use super::store_documents::{CORE, LOCAL_WORKSPACE, NOTIFICATIONS, SETTINGS, core_id, to_doc};
use crate::config::Config;
-use crate::storage::import::{table_exists, ImportDoc};
+use crate::storage::import::{ImportDoc, table_exists};
/// SQL schema of the legacy database, applied on every `with_connection` call.
const SCHEMA: &str = "
diff --git a/crates/openhuman-core/src/desktop/notifications/store_import_tests.rs b/crates/openhuman-core/src/desktop/notifications/store_import_tests.rs
index ec62a87c8b..bb0bc7d1d7 100644
--- a/crates/openhuman-core/src/desktop/notifications/store_import_tests.rs
+++ b/crates/openhuman-core/src/desktop/notifications/store_import_tests.rs
@@ -3,7 +3,7 @@ use crate::desktop::notifications::store as live;
use crate::desktop::notifications::types::{
CoreNotificationCategory, CoreNotificationEvent, IntegrationNotification, NotificationStatus,
};
-use crate::storage::import::{run_with, Outcome};
+use crate::storage::import::{Outcome, run_with};
use chrono::{Duration, Utc};
use tempfile::TempDir;
diff --git a/crates/openhuman-core/src/integrations/task_sources/store_documents.rs b/crates/openhuman-core/src/integrations/task_sources/store_documents.rs
index 44b8cda1ea..115e85a346 100644
--- a/crates/openhuman-core/src/integrations/task_sources/store_documents.rs
+++ b/crates/openhuman-core/src/integrations/task_sources/store_documents.rs
@@ -17,18 +17,18 @@
//! fields (`created_ms`, `ingested_ms`) carry the ordering. Removing a source
//! removes its ledger entries, which the SQL schema did with a cascade.
-use anyhow::{anyhow, Context, Result};
+use anyhow::{Context, Result, anyhow};
use chrono::{DateTime, Utc};
-use serde_json::{json, Map, Value};
+use serde_json::{Map, Value, json};
use tinystoragedrivers::{CollectionSpec, Filter, IndexSpec, Precondition, Query, Sort, Versioned};
-use super::store::{apply_patch, content_hash, IngestedTaskRef};
+use super::store::{IngestedTaskRef, apply_patch, content_hash};
use super::types::{
FetchReason, FilterSpec, ProviderSlug, SourceTarget, TaskSource, TaskSourcePatch,
};
use crate::config::Config;
use crate::integrations::composio::contract::NormalizedTask;
-use crate::storage::documents::{compare_and_swap, text, Repo};
+use crate::storage::documents::{Repo, compare_and_swap, text};
use crate::storage::{DocumentStoreExt, StorageError};
pub(super) const SOURCES: &str = "task_sources";
@@ -216,11 +216,7 @@ impl Docs {
.await?;
docs.delete(SOURCES, &key, Precondition::None).await
})?;
- if removed {
- Ok(())
- } else {
- Err(not_found(id))
- }
+ if removed { Ok(()) } else { Err(not_found(id)) }
}
pub(super) fn record_fetch(
diff --git a/crates/openhuman-core/src/integrations/task_sources/store_import.rs b/crates/openhuman-core/src/integrations/task_sources/store_import.rs
index 4f13818412..5274654ca2 100644
--- a/crates/openhuman-core/src/integrations/task_sources/store_import.rs
+++ b/crates/openhuman-core/src/integrations/task_sources/store_import.rs
@@ -15,11 +15,11 @@ use std::time::Duration;
use anyhow::{Context, Result};
use chrono::DateTime;
use rusqlite::Connection;
-use serde_json::{json, Map, Value};
+use serde_json::{Map, Value, json};
-use super::store_documents::{ingested_id, to_doc, INGESTED, SOURCES};
+use super::store_documents::{INGESTED, SOURCES, ingested_id, to_doc};
use crate::config::Config;
-use crate::storage::import::{table_exists, ImportDoc};
+use crate::storage::import::{ImportDoc, table_exists};
/// Reads every legacy row, after bringing an old schema forward (on the
/// importer's scratch copy of the file).
@@ -101,7 +101,7 @@ fn read_rows(conn: &Connection) -> Result<Vec<ImportDoc>> {
#[path = "store_import_rows.rs"]
mod store_rows;
-use store_rows::{map_source_row, SELECT_SOURCE_COLUMNS};
+use store_rows::{SELECT_SOURCE_COLUMNS, map_source_row};
/// Tracks which task_sources database files have already had their schema DDL
/// (the `CREATE TABLE`/`CREATE INDEX` batch plus the `add_column_if_missing`
diff --git a/crates/openhuman-core/src/integrations/task_sources/store_import_tests.rs b/crates/openhuman-core/src/integrations/task_sources/store_import_tests.rs
index f127924657..64463941b0 100644
--- a/crates/openhuman-core/src/integrations/task_sources/store_import_tests.rs
+++ b/crates/openhuman-core/src/integrations/task_sources/store_import_tests.rs
@@ -2,7 +2,7 @@ use super::*;
use crate::integrations::composio::contract::NormalizedTask;
use crate::integrations::task_sources::store as live;
use crate::integrations::task_sources::types::{FilterSpec, SourceTarget};
-use crate::storage::import::{run_with, Outcome};
+use crate::storage::import::{Outcome, run_with};
use crate::storage::rusqlite::params;
use serde_json::json;
use tempfile::TempDir;
@@ -124,13 +124,15 @@ fn legacy_sources_and_ledger_are_imported_once_and_the_file_is_left_alone() {
assert_eq!(got.last_status.as_deref(), Some("periodic: ok"));
assert!(live::was_ingested(&config, "src-1", "t-1").unwrap());
assert!(live::was_ingested(&config, "src-2", "t-1").unwrap());
- assert!(live::is_ingested(
- &config,
- "src-1",
- "t-1",
- &live::content_hash(&task("t-1", "First"))
- )
- .unwrap());
+ assert!(
+ live::is_ingested(
+ &config,
+ "src-1",
+ "t-1",
+ &live::content_hash(&task("t-1", "First"))
+ )
+ .unwrap()
+ );
let titles: Vec<_> = live::list_ingested(&config, "src-1", 10)
.unwrap()
.into_iter()
diff --git a/crates/openhuman-core/src/lib.rs b/crates/openhuman-core/src/lib.rs
index e183b8c417..fe71ea01e1 100644
--- a/crates/openhuman-core/src/lib.rs
+++ b/crates/openhuman-core/src/lib.rs
@@ -82,8 +82,8 @@ pub mod profiles;
pub mod sandbox;
pub mod search;
pub mod security;
-pub mod skills;
pub mod sessions;
+pub mod skills;
pub mod storage;
#[cfg(feature = "e2e-test-support")]
pub mod test_support;
diff --git a/crates/openhuman-core/src/security/approval/store_documents.rs b/crates/openhuman-core/src/security/approval/store_documents.rs
index a8d017fd49..40ab9abe4f 100644
--- a/crates/openhuman-core/src/security/approval/store_documents.rs
+++ b/crates/openhuman-core/src/security/approval/store_documents.rs
@@ -23,13 +23,13 @@
use std::sync::Arc;
-use anyhow::{anyhow, Context, Result};
+use anyhow::{Context, Result, anyhow};
use chrono::{DateTime, Utc};
-use serde_json::{json, Value};
+use serde_json::{Value, json};
use crate::config::Config;
use crate::storage::local;
-use crate::storage::{block_on, DocumentStore, DocumentStoreExt, ScopedStorage, StorageError};
+use crate::storage::{DocumentStore, DocumentStoreExt, ScopedStorage, StorageError, block_on};
use tinystoragedrivers::{
CollectionSpec, ErrorKind, Filter, IndexSpec, Precondition, Query, Sort, Versioned,
};
diff --git a/crates/openhuman-core/src/security/approval/store_import.rs b/crates/openhuman-core/src/security/approval/store_import.rs
index 71cd5ecbcc..3fd4d96b65 100644
--- a/crates/openhuman-core/src/security/approval/store_import.rs
+++ b/crates/openhuman-core/src/security/approval/store_import.rs
@@ -8,14 +8,14 @@
//! expiry key, optional columns left out when NULL. The legacy file is only
//! ever opened here, by the storage importer, on a scratch copy of it.
-use crate::storage::rusqlite::{params, Connection};
+use crate::storage::rusqlite::{Connection, params};
use anyhow::{Context, Result};
use chrono::{DateTime, Utc};
-use serde_json::{json, Map, Value};
+use serde_json::{Map, Value, json};
-use super::store_documents::{expiry_key, rfc3339, trust_id, APPROVALS, FLOW_TRUST};
+use super::store_documents::{APPROVALS, FLOW_TRUST, expiry_key, rfc3339, trust_id};
use crate::config::Config;
-use crate::storage::import::{table_exists, ImportDoc};
+use crate::storage::import::{ImportDoc, table_exists};
/// SQL schema of the legacy database, applied on every `with_connection` call.
///
diff --git a/crates/openhuman-core/src/security/approval/store_import_tests.rs b/crates/openhuman-core/src/security/approval/store_import_tests.rs
index 3d4e5f6da2..4868396915 100644
--- a/crates/openhuman-core/src/security/approval/store_import_tests.rs
+++ b/crates/openhuman-core/src/security/approval/store_import_tests.rs
@@ -1,7 +1,7 @@
use super::*;
use crate::security::approval::store as live;
use crate::security::approval::types::{ApprovalDecision, ApprovalSourceContext};
-use crate::storage::import::{run_with, Outcome};
+use crate::storage::import::{Outcome, run_with};
use crate::storage::rusqlite;
use chrono::{Duration, Utc};
use tempfile::TempDir;
diff --git a/crates/openhuman-core/src/security/devices/store_documents.rs b/crates/openhuman-core/src/security/devices/store_documents.rs
index 9e8f7bd143..4a94b79c4b 100644
--- a/crates/openhuman-core/src/security/devices/store_documents.rs
+++ b/crates/openhuman-core/src/security/devices/store_documents.rs
@@ -13,13 +13,13 @@
use anyhow::Result;
use chrono::Utc;
-use serde_json::{json, Value};
+use serde_json::{Value, json};
use tinystoragedrivers::{CollectionSpec, Filter, IndexSpec, Precondition, Query, Sort, Versioned};
use crate::config::Config;
use crate::security::devices::types::PairedDevice;
-use crate::storage::documents::{compare_and_swap, text, Repo};
use crate::storage::DocumentStoreExt;
+use crate::storage::documents::{Repo, compare_and_swap, text};
pub(super) const DEVICES: &str = "paired_devices";
const DOMAIN: &str = "devices::store";
diff --git a/crates/openhuman-core/src/security/devices/store_import.rs b/crates/openhuman-core/src/security/devices/store_import.rs
index b903ceb407..f14111c959 100644
--- a/crates/openhuman-core/src/security/devices/store_import.rs
+++ b/crates/openhuman-core/src/security/devices/store_import.rs
@@ -8,11 +8,11 @@
use crate::storage::rusqlite;
use anyhow::{Context, Result};
use rusqlite::Connection;
-use serde_json::{json, Value};
+use serde_json::{Value, json};
use super::store_documents::DEVICES;
use crate::config::Config;
-use crate::storage::import::{table_exists, ImportDoc};
+use crate::storage::import::{ImportDoc, table_exists};
/// The legacy database, `<workspace>/devices/devices.db`.
pub(crate) fn db_path(config: &Config) -> std::path::PathBuf {
diff --git a/crates/openhuman-core/src/security/devices/store_import_tests.rs b/crates/openhuman-core/src/security/devices/store_import_tests.rs
index fb482e1b9f..5923e00685 100644
--- a/crates/openhuman-core/src/security/devices/store_import_tests.rs
+++ b/crates/openhuman-core/src/security/devices/store_import_tests.rs
@@ -1,6 +1,6 @@
use super::*;
use crate::security::devices::store as live;
-use crate::storage::import::{run_with, Outcome};
+use crate::storage::import::{Outcome, run_with};
use tempfile::TempDir;
fn workspace() -> (TempDir, Config) {
diff --git a/crates/openhuman-core/src/storage/import/mod.rs b/crates/openhuman-core/src/storage/import/mod.rs
index 5078a66f92..fa29afea71 100644
--- a/crates/openhuman-core/src/storage/import/mod.rs
+++ b/crates/openhuman-core/src/storage/import/mod.rs
@@ -40,9 +40,9 @@
//! with `tinyflows-import`; see [`tinyflows`].
pub mod live;
+mod schemas;
pub mod sessions;
mod snapshot;
-mod schemas;
pub mod tinyflows;
pub use schemas::{
@@ -52,14 +52,14 @@ pub use schemas::{
use std::path::Path;
use std::sync::Arc;
-use anyhow::{anyhow, Context, Result};
+use anyhow::{Context, Result, anyhow};
use serde_json::json;
use sha2::Digest;
use tinystoragedrivers::{CollectionSpec, ErrorKind, Precondition};
use super::documents::Repo;
use super::rusqlite;
-use super::{block_on, Scope, StorageBackend};
+use super::{Scope, StorageBackend, block_on};
use crate::config::Config;
use rusqlite::Connection;
use serde_json::Value;
diff --git a/crates/openhuman-core/src/storage/import/sessions.rs b/crates/openhuman-core/src/storage/import/sessions.rs
index adf2501936..abcc83807c 100644
--- a/crates/openhuman-core/src/storage/import/sessions.rs
+++ b/crates/openhuman-core/src/storage/import/sessions.rs
@@ -32,17 +32,17 @@ use std::path::{Path, PathBuf};
use std::sync::Arc;
use anyhow::{Context, Result};
+use tinyagents_session::DriverSessionStores;
use tinyagents_session::legacy::{
- import_transcripts, import_turn_states, QuiescentSource, SourceOwner,
+ QuiescentSource, SourceOwner, import_transcripts, import_turn_states,
};
-use tinyagents_session::transcript::{session_stem, SessionRef};
-use tinyagents_session::DriverSessionStores;
+use tinyagents_session::transcript::{SessionRef, session_stem};
use super::tinyflows::{finish, marked};
use super::{Outcome, Report, Snapshot};
-use crate::storage::sessions::DEFAULT_AGENT;
use crate::config::Config;
use crate::storage::StorageBackend;
+use crate::storage::sessions::DEFAULT_AGENT;
/// The marker name of the session import.
pub const SESSIONS_DOMAIN: &str = "sessions";
diff --git a/crates/openhuman-core/src/storage/mod.rs b/crates/openhuman-core/src/storage/mod.rs
index 0e8d2d2148..fdf2fd0703 100644
--- a/crates/openhuman-core/src/storage/mod.rs
+++ b/crates/openhuman-core/src/storage/mod.rs
@@ -60,8 +60,8 @@ pub use tinystoragedrivers::{
ScopedStorage, StorageBackend, StorageConfig as StorageUrl, StorageError,
};
-use crate::config::schema::storage::redact_url;
use crate::config::Config;
+use crate::config::schema::storage::redact_url;
/// The environment variable that overrides `[storage] url`.
pub const STORAGE_URL_VAR: &str = "OPENHUMAN_STORAGE_URL";
diff --git a/crates/openhuman-core/src/storage/rebind.rs b/crates/openhuman-core/src/storage/rebind.rs
index c80e5c6b44..f67708f1f0 100644
--- a/crates/openhuman-core/src/storage/rebind.rs
+++ b/crates/openhuman-core/src/storage/rebind.rs
@@ -21,8 +21,8 @@ use std::sync::Arc;
use anyhow::{Context, Result};
-use super::import;
use super::StorageBackend;
+use super::import;
use crate::config::Config;
/// What a rebind did.
diff --git a/crates/openhuman-core/src/storage/sessions/workspace_tests.rs b/crates/openhuman-core/src/storage/sessions/workspace_tests.rs
index 6226b9e481..2208b1d069 100644
--- a/crates/openhuman-core/src/storage/sessions/workspace_tests.rs
+++ b/crates/openhuman-core/src/storage/sessions/workspace_tests.rs
@@ -104,8 +104,7 @@ fn an_unusable_workspace_degrades_to_an_in_memory_store() {
.expect("the in-memory fallback opens an agent");
assert!(
- artifact_blobs_for(&unusable).is_none()
- || crate::storage::sessions::installed().is_some()
+ artifact_blobs_for(&unusable).is_none() || crate::storage::sessions::installed().is_some()
);
assert!(
current_documents_for(&unusable).is_none()
diff --git a/crates/openhuman-core/src/threads/ops/crud.rs b/crates/openhuman-core/src/threads/ops/crud.rs
index 36d8c4365e..7801b3efb0 100644
--- a/crates/openhuman-core/src/threads/ops/crud.rs
+++ b/crates/openhuman-core/src/threads/ops/crud.rs
@@ -5,11 +5,11 @@ use super::support::{
counts, envelope, message_to_record, record_to_message, run_to_completion, thread_to_summary,
workspace_dir,
};
-use crate::core::runtime::DispatchCtx;
use crate::core::Outcome;
+use crate::core::runtime::DispatchCtx;
+use crate::threads::ThreadsError;
use crate::threads::store as conversations;
use crate::threads::store::{ConversationMessagePatch, CrossThreadHit};
-use crate::threads::ThreadsError;
use crate::threads::{
ApiEnvelope, AppendConversationMessageRequest, ConversationMessageRecord,
ConversationMessagesRequest, ConversationMessagesResponse, ConversationThreadSummary,
diff --git a/crates/openhuman-core/src/threads/ops/edit.rs b/crates/openhuman-core/src/threads/ops/edit.rs
index 2c0c512362..c850a26232 100644
--- a/crates/openhuman-core/src/threads/ops/edit.rs
+++ b/crates/openhuman-core/src/threads/ops/edit.rs
@@ -39,19 +39,19 @@
//! turn.
use serde::{Deserialize, Serialize};
-use serde_json::{json, Value};
+use serde_json::{Value, json};
use tinyagents_session::transcript::{
SessionRef, SessionTranscript, TranscriptLocator, TranscriptMessage, TranscriptMeta,
TruncateCut,
};
-use crate::core::runtime::DispatchCtx;
use crate::core::Outcome;
-use crate::threads::store::{self as conversations, reply_run_id, run_reply_message_id};
+use crate::core::runtime::DispatchCtx;
use crate::threads::ThreadsError;
+use crate::threads::store::{self as conversations, reply_run_id, run_reply_message_id};
-use super::support::{transcript_store, workspace_dir, TranscriptStore};
+use super::support::{TranscriptStore, transcript_store, workspace_dir};
#[derive(Debug, Clone, Deserialize)]
#[serde(deny_unknown_fields)]
diff --git a/crates/openhuman-core/src/threads/ops/edit_turn_state_tests.rs b/crates/openhuman-core/src/threads/ops/edit_turn_state_tests.rs
index dcc76c3c5d..6d5b0e916b 100644
--- a/crates/openhuman-core/src/threads/ops/edit_turn_state_tests.rs
+++ b/crates/openhuman-core/src/threads/ops/edit_turn_state_tests.rs
@@ -6,7 +6,7 @@
//! truncation tests do.
use super::*;
-use crate::threads::store::{self as conversations, run_reply_message_id, ConversationMessage};
+use crate::threads::store::{self as conversations, ConversationMessage, run_reply_message_id};
use serde_json::json;
use std::sync::Arc;
use tempfile::TempDir;
diff --git a/crates/openhuman-core/src/threads/ops/purge.rs b/crates/openhuman-core/src/threads/ops/purge.rs
index 8b32e0c25d..92f26cae7c 100644
--- a/crates/openhuman-core/src/threads/ops/purge.rs
+++ b/crates/openhuman-core/src/threads/ops/purge.rs
@@ -1,8 +1,8 @@
//! Workspace-wide conversation purge.
use super::support::{envelope, run_to_completion, workspace_dir};
-use crate::core::runtime::DispatchCtx;
use crate::core::Outcome;
+use crate::core::runtime::DispatchCtx;
use crate::threads::store as conversations;
use crate::threads::{ApiEnvelope, EmptyRequest, PurgeConversationThreadsResponse};
use std::path::PathBuf;
diff --git a/crates/openhuman-core/src/threads/ops/support.rs b/crates/openhuman-core/src/threads/ops/support.rs
index e6172c8b5a..aa6b60a335 100644
--- a/crates/openhuman-core/src/threads/ops/support.rs
+++ b/crates/openhuman-core/src/threads/ops/support.rs
@@ -3,11 +3,11 @@
//! store-type <-> wire-type conversions every handler needs.
use crate::config::Config;
-use crate::core::runtime::context::CoreContext;
use crate::core::runtime::DispatchCtx;
+use crate::core::runtime::context::CoreContext;
+use crate::threads::THREAD_TITLE_LOG_PREFIX;
use crate::threads::store as conversations;
use crate::threads::store::{ConversationMessage, ConversationThread};
-use crate::threads::THREAD_TITLE_LOG_PREFIX;
use crate::threads::{ConversationMessageRecord, ConversationThreadSummary};
use std::path::PathBuf;
use tinyagents_harness::title::{title_from_user_message, title_log_fingerprint};
diff --git a/crates/openhuman-core/src/threads/ops/turn_state_ops.rs b/crates/openhuman-core/src/threads/ops/turn_state_ops.rs
index 2a107d7046..0555962ae0 100644
--- a/crates/openhuman-core/src/threads/ops/turn_state_ops.rs
+++ b/crates/openhuman-core/src/threads/ops/turn_state_ops.rs
@@ -1,8 +1,8 @@
//! RPC accessors over persisted in-flight turn snapshots.
use super::support::{counts, envelope, workspace_dir};
-use crate::storage::sessions::turn_states_for;
use crate::core::Outcome;
+use crate::storage::sessions::turn_states_for;
use crate::threads::turn_state::{
ClearTurnStateRequest, ClearTurnStateResponse, GetTurnStateForRequestRequest,
GetTurnStateRequest, GetTurnStateResponse, ListTurnStatesResponse,
diff --git a/crates/openhuman-core/src/web_chat/run_task.rs b/crates/openhuman-core/src/web_chat/run_task.rs
index da2c806e54..6bd34c2ad0 100644
--- a/crates/openhuman-core/src/web_chat/run_task.rs
+++ b/crates/openhuman-core/src/web_chat/run_task.rs
@@ -12,8 +12,8 @@ use crate::agent::progress::AgentProgress;
use super::ops::BudgetCorrelation;
use super::progress_bridge::spawn_progress_bridge;
use super::session::{
- checkin_session_agent, checkout_session_agent, normalize_model_override, CheckedOutSession,
- CheckoutPolicy,
+ CheckedOutSession, CheckoutPolicy, checkin_session_agent, checkout_session_agent,
+ normalize_model_override,
};
use super::types::{ChatRequestMetadata, WebChatTaskResult};
use super::web_errors::{
diff --git a/crates/openhuman-core/src/web_chat/turn_close.rs b/crates/openhuman-core/src/web_chat/turn_close.rs
index 1fac2bf72a..7648c5ae3e 100644
--- a/crates/openhuman-core/src/web_chat/turn_close.rs
+++ b/crates/openhuman-core/src/web_chat/turn_close.rs
@@ -292,8 +292,7 @@ async fn read_snapshot(
let (thread_id, request_id) = (thread_id.to_string(), request_id.to_string());
let read = ctx
.spawn_blocking(move || {
- crate::storage::sessions::turn_states_for(&workspace)
- .get_turn(&thread_id, &request_id)
+ crate::storage::sessions::turn_states_for(&workspace).get_turn(&thread_id, &request_id)
})
.await;
match read {