Skip to content

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

style: apply rustfmt formatting across cron, modules, and storage code

Steven Enamakel92f6c7e8aaae
diff --git a/crates/openhuman-core/src/agent/tinyagents/host/budget_gate.rs b/crates/openhuman-core/src/agent/tinyagents/host/budget_gate.rs
index 661454e109..08ba7f8cef 100644
--- a/crates/openhuman-core/src/agent/tinyagents/host/budget_gate.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/host/budget_gate.rs
@@ -67,8 +67,8 @@ use tinyagents_harness::host::budget_gate::{
use tinyinference_llm::usage::Usage;
use crate::config::{Config, DEFAULT_MODEL};
-use crate::platform::llm_gate;
use crate::platform::cost;
+use crate::platform::llm_gate;
use tinyjuice_bus::types::AgentTokenjuiceCompression;
/// OpenHuman's [`BudgetGate`]: scheduler-gate back-pressure, cost-tracker
diff --git a/crates/openhuman-core/src/config/ops/loader.rs b/crates/openhuman-core/src/config/ops/loader.rs
index fdfc784317..04d031f277 100644
--- a/crates/openhuman-core/src/config/ops/loader.rs
+++ b/crates/openhuman-core/src/config/ops/loader.rs
@@ -8,8 +8,7 @@ mod snapshot;
pub use load::{
load_config_for_workspace_with_timeout, load_config_in, load_config_with_timeout,
- load_current_or_init, reload_config_from_paths,
- reload_config_snapshot_with_timeout,
+ load_current_or_init, reload_config_from_paths, reload_config_snapshot_with_timeout,
};
pub(crate) use paths::fallback_workspace_dir;
#[cfg(test)]
diff --git a/crates/openhuman-core/src/config/ops/mod.rs b/crates/openhuman-core/src/config/ops/mod.rs
index 92118b4bf6..304ecbed82 100644
--- a/crates/openhuman-core/src/config/ops/mod.rs
+++ b/crates/openhuman-core/src/config/ops/mod.rs
@@ -25,9 +25,8 @@ pub use loader::{
get_dashboard_settings, get_data_paths, get_data_paths_for_user, get_runtime_flags,
load_and_get_client_config_snapshot, load_and_get_config_snapshot,
load_config_for_workspace_with_timeout, load_config_in, load_config_with_timeout,
- load_current_or_init, reload_config_from_paths,
- reload_config_snapshot_with_timeout, reset_local_data, set_browser_allow_all,
- snapshot_config_json, RuntimeFlagsOut,
+ load_current_or_init, reload_config_from_paths, reload_config_snapshot_with_timeout,
+ reset_local_data, set_browser_allow_all, snapshot_config_json, RuntimeFlagsOut,
};
// expose internal helpers needed by tests (ops_tests.rs uses super::*)
#[cfg(test)]
diff --git a/crates/openhuman-core/src/cron/bus_host.rs b/crates/openhuman-core/src/cron/bus_host.rs
index 1fa13aaba1..7b6c5855e4 100644
--- a/crates/openhuman-core/src/cron/bus_host.rs
+++ b/crates/openhuman-core/src/cron/bus_host.rs
@@ -139,9 +139,8 @@ impl Binding {
/// holds the per-flow in-flight dedupe across ticks.
#[cfg(feature = "flows")]
pub(crate) fn flows(&self) -> &crate::flows::bus::FlowTriggerSubscriber {
- self.flows.get_or_init(|| {
- crate::flows::bus::FlowTriggerSubscriber::new(Arc::new(self.config()))
- })
+ self.flows
+ .get_or_init(|| crate::flows::bus::FlowTriggerSubscriber::new(Arc::new(self.config())))
}
}
diff --git a/crates/openhuman-core/src/cron/bus_host_tests.rs b/crates/openhuman-core/src/cron/bus_host_tests.rs
index 88950357d7..e6c95abebb 100644
--- a/crates/openhuman-core/src/cron/bus_host_tests.rs
+++ b/crates/openhuman-core/src/cron/bus_host_tests.rs
@@ -2,7 +2,9 @@
//! the contract's `ScheduleHost` interface, against the real (linked) module.
use super::*;
-use crate::cron::handlers::{kind_handler, register_kind, JobKindHandler, JobOutcome, JobRunContext};
+use crate::cron::handlers::{
+ kind_handler, register_kind, JobKindHandler, JobOutcome, JobRunContext,
+};
use async_trait::async_trait;
use std::sync::atomic::{AtomicUsize, Ordering};
use tempfile::TempDir;
@@ -37,7 +39,11 @@ async fn host(config: &Config, agent_only: bool) -> (HostRegistration, tinybus::
.await
.unwrap()
.connection()
- .proxy(&address.destination, &address.object_path, CALLBACK_INTERFACE)
+ .proxy(
+ &address.destination,
+ &address.object_path,
+ CALLBACK_INTERFACE,
+ )
.expect("the contract's callback interface is the one served");
(registration, proxy)
}
@@ -151,7 +157,11 @@ async fn an_agent_only_scheduler_refuses_shell_jobs_before_running_anything() {
.unwrap();
assert!(!attempt.success);
assert!(!attempt.retryable);
- assert!(attempt.output.contains("only agent cron jobs"), "{}", attempt.output);
+ assert!(
+ attempt.output.contains("only agent cron jobs"),
+ "{}",
+ attempt.output
+ );
assert_eq!(calls.load(Ordering::SeqCst), 0, "the handler never ran");
let trigger: Attempt = proxy
.call(callbacks::SCHEDULE_TRIGGER, ("some-flow", "run-d"))
@@ -192,7 +202,10 @@ async fn deliver_answers_with_the_delivery_status_string() {
.call(callbacks::DELIVER, (&job, "run-f", &attempt))
.await
.unwrap();
- assert_eq!(status, "not_requested", "delivery mode `none` sends nothing");
+ assert_eq!(
+ status, "not_requested",
+ "delivery mode `none` sends nothing"
+ );
assert!(DeliveryStatus::parse(&status).is_some());
}
diff --git a/crates/openhuman-core/src/cron/client_testing.rs b/crates/openhuman-core/src/cron/client_testing.rs
index c0ea5df353..e21bdd7809 100644
--- a/crates/openhuman-core/src/cron/client_testing.rs
+++ b/crates/openhuman-core/src/cron/client_testing.rs
@@ -1,53 +1,53 @@
//! Reading a scope's cron store straight through the module, for tests that
//! stage a backend and check what an importer or another writer left in it.
- use super::*;
- use crate::storage::{Scope, StorageBackend};
- use std::sync::Arc;
- use tinyflows_bus::schedule::types::CronRun;
+use super::*;
+use crate::storage::{Scope, StorageBackend};
+use std::sync::Arc;
+use tinyflows_bus::schedule::types::CronRun;
- fn run<T: Send + 'static>(
- backend: &Arc<dyn StorageBackend>,
- scope: &Scope,
- operation: StoreOperation,
- ) -> Result<T>
- where
- T: DeserializeOwned,
- {
- let config = Config::default();
- let scope = DocScope::on_backend(&config, Arc::clone(backend), scope.clone());
- crate::storage::block_on_anyhow(async move { store_in(&config, &scope, operation).await })
- }
+fn run<T: Send + 'static>(
+ backend: &Arc<dyn StorageBackend>,
+ scope: &Scope,
+ operation: StoreOperation,
+) -> Result<T>
+where
+ T: DeserializeOwned,
+{
+ let config = Config::default();
+ let scope = DocScope::on_backend(&config, Arc::clone(backend), scope.clone());
+ crate::storage::block_on_anyhow(async move { store_in(&config, &scope, operation).await })
+}
- pub(crate) fn list_jobs(backend: &Arc<dyn StorageBackend>, scope: &Scope) -> Result<Vec<CronJob>> {
- run(backend, scope, StoreOperation::List)
- }
+pub(crate) fn list_jobs(backend: &Arc<dyn StorageBackend>, scope: &Scope) -> Result<Vec<CronJob>> {
+ run(backend, scope, StoreOperation::List)
+}
- pub(crate) fn get_job(
- backend: &Arc<dyn StorageBackend>,
- scope: &Scope,
- job_id: &str,
- ) -> Result<CronJob> {
- run(
- backend,
- scope,
- StoreOperation::Get {
- job_id: job_id.to_string(),
- },
- )
- }
+pub(crate) fn get_job(
+ backend: &Arc<dyn StorageBackend>,
+ scope: &Scope,
+ job_id: &str,
+) -> Result<CronJob> {
+ run(
+ backend,
+ scope,
+ StoreOperation::Get {
+ job_id: job_id.to_string(),
+ },
+ )
+}
- pub(crate) fn list_runs(
- backend: &Arc<dyn StorageBackend>,
- scope: &Scope,
- job_id: &str,
- ) -> Result<Vec<CronRun>> {
- run(
- backend,
- scope,
- StoreOperation::ListRuns {
- job_id: job_id.to_string(),
- limit: 50,
- },
- )
- }
+pub(crate) fn list_runs(
+ backend: &Arc<dyn StorageBackend>,
+ scope: &Scope,
+ job_id: &str,
+) -> Result<Vec<CronRun>> {
+ run(
+ backend,
+ scope,
+ StoreOperation::ListRuns {
+ job_id: job_id.to_string(),
+ limit: 50,
+ },
+ )
+}
diff --git a/crates/openhuman-core/src/cron/client_tests.rs b/crates/openhuman-core/src/cron/client_tests.rs
index 2273ab085a..d43b603cc6 100644
--- a/crates/openhuman-core/src/cron/client_tests.rs
+++ b/crates/openhuman-core/src/cron/client_tests.rs
@@ -35,7 +35,9 @@ async fn schedules_are_validated_and_the_agent_floor_applies() {
.await
.is_err());
let past = Schedule::At { at: at(1) };
- assert!(validate_schedule(&config, &past, at(8), false).await.is_err());
+ assert!(validate_schedule(&config, &past, at(8), false)
+ .await
+ .is_err());
}
#[tokio::test]
@@ -153,7 +155,9 @@ async fn a_switched_off_component_answers_component_disabled() {
config.components.tinyflows = false;
let error = parse_human_delay(&config, "1h").await.unwrap_err();
assert!(
- error.to_string().starts_with("COMPONENT_DISABLED:tinyflows"),
+ error
+ .to_string()
+ .starts_with("COMPONENT_DISABLED:tinyflows"),
"{error}"
);
}
diff --git a/crates/openhuman-core/src/cron/cutover_tests.rs b/crates/openhuman-core/src/cron/cutover_tests.rs
index bce2dc4c0e..65b5da3e06 100644
--- a/crates/openhuman-core/src/cron/cutover_tests.rs
+++ b/crates/openhuman-core/src/cron/cutover_tests.rs
@@ -54,8 +54,12 @@ async fn a_seeded_system_job_fires_through_the_module_and_records_its_handler()
.into_iter()
.find(|job| system_jobs::system_job_name(job) == Some(BACKGROUND_JOB))
.expect("the memory background job is seeded");
- store::force_next_run_for_test(&config, &job.id, chrono::Utc::now() - chrono::Duration::seconds(1))
- .unwrap();
+ store::force_next_run_for_test(
+ &config,
+ &job.id,
+ chrono::Utc::now() - chrono::Duration::seconds(1),
+ )
+ .unwrap();
let mut dispatcher = dispatcher(&config);
assert!(dispatcher.tick(&config).await.unwrap() >= 1);
@@ -64,7 +68,10 @@ async fn a_seeded_system_job_fires_through_the_module_and_records_its_handler()
assert_eq!(calls.load(Ordering::SeqCst), 1);
let after = get_job(&config, &job.id).unwrap();
assert_eq!(after.last_status.as_deref(), Some("ok"));
- assert!(after.next_run > chrono::Utc::now(), "the recurrence moved on");
+ assert!(
+ after.next_run > chrono::Utc::now(),
+ "the recurrence moved on"
+ );
}
#[tokio::test]
@@ -104,8 +111,12 @@ async fn a_flow_schedule_row_is_answered_by_the_flow_handler_on_a_tick() {
},
)
.unwrap();
- store::force_next_run_for_test(&config, &row.id, chrono::Utc::now() - chrono::Duration::seconds(1))
- .unwrap();
+ store::force_next_run_for_test(
+ &config,
+ &row.id,
+ chrono::Utc::now() - chrono::Duration::seconds(1),
+ )
+ .unwrap();
let mut dispatcher = dispatcher(&config);
assert_eq!(dispatcher.tick(&config).await.unwrap(), 1);
dispatcher.drain().await;
diff --git a/crates/openhuman-core/src/cron/documents_port.rs b/crates/openhuman-core/src/cron/documents_port.rs
index 6f9ca7e4e5..7f4db1b5cd 100644
--- a/crates/openhuman-core/src/cron/documents_port.rs
+++ b/crates/openhuman-core/src/cron/documents_port.rs
@@ -216,9 +216,7 @@ impl DocumentsPort {
}
encode(documents.atomic_batch(ops).await?)
}
- _ => Err(StorageError::invalid_input(
- "unexpected document request",
- )),
+ _ => Err(StorageError::invalid_input("unexpected document request")),
}
}
}
diff --git a/crates/openhuman-core/src/cron/documents_port_tests.rs b/crates/openhuman-core/src/cron/documents_port_tests.rs
index 52acdee532..acebc8f220 100644
--- a/crates/openhuman-core/src/cron/documents_port_tests.rs
+++ b/crates/openhuman-core/src/cron/documents_port_tests.rs
@@ -37,13 +37,10 @@ async fn the_port_serves_the_contracts_document_interface_and_reports_capabiliti
async fn a_second_absent_write_comes_back_as_a_conflict_kind() {
let (proxy, _) = port().await;
let absent = serde_json::to_value(tinystoragedrivers::Precondition::Absent).unwrap();
- let put = json!({"op":"put","collection":"cron_jobs","id":"dup","doc":{"a":1},"precondition":absent});
+ let put =
+ json!({"op":"put","collection":"cron_jobs","id":"dup","doc":{"a":1},"precondition":absent});
// The collection must exist first; the module declares it, the port relays.
- let ensured = ask(
- &proxy,
- json!({"op":"ensure","spec":{"name":"cron_jobs"}}),
- )
- .await;
+ let ensured = ask(&proxy, json!({"op":"ensure","spec":{"name":"cron_jobs"}})).await;
assert!(ensured.get("error").is_none(), "{ensured}");
let first = ask(&proxy, put.clone()).await;
assert!(first.get("error").is_none(), "{first}");
@@ -65,14 +62,21 @@ async fn a_collection_outside_the_schedule_port_is_refused() {
]}),
] {
let reply = ask(&proxy, request.clone()).await;
- assert_eq!(reply["error"]["kind"], "invalid_input", "{request} -> {reply}");
+ assert_eq!(
+ reply["error"]["kind"], "invalid_input",
+ "{request} -> {reply}"
+ );
}
}
#[tokio::test]
async fn an_unknown_operation_is_refused_not_guessed() {
let (proxy, _) = port().await;
- let reply = ask(&proxy, json!({"op":"drop_collection","collection":"cron_jobs"})).await;
+ let reply = ask(
+ &proxy,
+ json!({"op":"drop_collection","collection":"cron_jobs"}),
+ )
+ .await;
assert_eq!(reply["error"]["kind"], "invalid_input", "{reply}");
}
diff --git a/crates/openhuman-core/src/cron/handlers.rs b/crates/openhuman-core/src/cron/handlers.rs
index 42350b4e40..ec159b9548 100644
--- a/crates/openhuman-core/src/cron/handlers.rs
+++ b/crates/openhuman-core/src/cron/handlers.rs
@@ -167,7 +167,10 @@ impl Drop for KindRegistration {
registry.kinds.remove(self.kind.as_str());
}
}
- tracing::debug!(kind = self.kind.as_str(), "[cron:handlers] kind handler restored");
+ tracing::debug!(
+ kind = self.kind.as_str(),
+ "[cron:handlers] kind handler restored"
+ );
}
}
}
@@ -182,9 +185,7 @@ impl std::fmt::Debug for KindRegistration {
/// Register `handler` for jobs of `kind`, replacing the current handler.
pub fn register_kind(kind: JobType, handler: Arc<dyn JobKindHandler>) -> KindRegistration {
- let previous = write()
- .kinds
- .insert(kind.as_str(), Arc::clone(&handler));
+ let previous = write().kinds.insert(kind.as_str(), Arc::clone(&handler));
tracing::debug!(
kind = kind.as_str(),
replaced = previous.is_some(),
diff --git a/crates/openhuman-core/src/cron/job_builder.rs b/crates/openhuman-core/src/cron/job_builder.rs
index acd9bfb6af..4818e06011 100644
--- a/crates/openhuman-core/src/cron/job_builder.rs
+++ b/crates/openhuman-core/src/cron/job_builder.rs
@@ -9,10 +9,10 @@
use crate::config::Config;
use {
- crate::cron, tinyflows_bus::schedule::types::delivery_mode, tinyflows_bus::schedule::types::CronJob,
- tinyflows_bus::schedule::types::DeliveryConfig, tinyflows_bus::schedule::types::JobOrigin,
- tinyflows_bus::schedule::types::Schedule, tinyflows_bus::schedule::types::SessionTarget,
- tinyflows_bus::schedule::AgentJobSpec,
+ crate::cron, tinyflows_bus::schedule::types::delivery_mode,
+ tinyflows_bus::schedule::types::CronJob, tinyflows_bus::schedule::types::DeliveryConfig,
+ tinyflows_bus::schedule::types::JobOrigin, tinyflows_bus::schedule::types::Schedule,
+ tinyflows_bus::schedule::types::SessionTarget, tinyflows_bus::schedule::AgentJobSpec,
};
/// What an agent job creation request carries; everything defaults.
diff --git a/crates/openhuman-core/src/cron/mod.rs b/crates/openhuman-core/src/cron/mod.rs
index 9dc5377245..aa6656ca6e 100644
--- a/crates/openhuman-core/src/cron/mod.rs
+++ b/crates/openhuman-core/src/cron/mod.rs
@@ -61,6 +61,4 @@ pub use tinyflows_bus::schedule::types::{
ActiveHours, CronJob, CronJobPatch, CronRun, DeliveryConfig, DeliveryStatus, JobOrigin,
JobType, Schedule, SessionTarget,
};
-pub use tinyflows_bus::schedule::{
- AgentJobSpec, JobPolicy, TooFrequent, MIN_AGENT_JOB_INTERVAL,
-};
+pub use tinyflows_bus::schedule::{AgentJobSpec, JobPolicy, TooFrequent, MIN_AGENT_JOB_INTERVAL};
diff --git a/crates/openhuman-core/src/cron/scheduler.rs b/crates/openhuman-core/src/cron/scheduler.rs
index 9f19a9f2ab..72a3e8d384 100644
--- a/crates/openhuman-core/src/cron/scheduler.rs
+++ b/crates/openhuman-core/src/cron/scheduler.rs
@@ -408,7 +408,10 @@ impl JobDispatcher {
// The documents of the scope this dispatcher acts in: resolved under
// its context, because the call below is made from a task that may
// not carry it.
- let scope = self.binding.within(async { DocScope::current(config) }).await?;
+ let scope = self
+ .binding
+ .within(async { DocScope::current(config) })
+ .await?;
let storage = StoreConfig {
backend: StoreBackend::Documents {
callback: crate::cron::documents_port::address(&scope).await?,
diff --git a/crates/openhuman-core/src/cron/scheduler/builtin.rs b/crates/openhuman-core/src/cron/scheduler/builtin.rs
index 34ae24a287..cd9d606f1b 100644
--- a/crates/openhuman-core/src/cron/scheduler/builtin.rs
+++ b/crates/openhuman-core/src/cron/scheduler/builtin.rs
@@ -32,8 +32,13 @@ struct ShellHandler;
#[async_trait]
impl JobKindHandler for ShellHandler {
async fn run(&self, cx: &JobRunContext, job: &CronJob, _run_id: &str) -> JobOutcome {
- let (success, output) =
- run_job_command(&cx.dispatch_ctx(), &cx.config(), cx.security().as_ref(), job).await;
+ let (success, output) = run_job_command(
+ &cx.dispatch_ctx(),
+ &cx.config(),
+ cx.security().as_ref(),
+ job,
+ )
+ .await;
JobOutcome {
success,
output,
diff --git a/crates/openhuman-core/src/cron/scheduler/executor.rs b/crates/openhuman-core/src/cron/scheduler/executor.rs
index e5fd18b836..bfe2d308a8 100644
--- a/crates/openhuman-core/src/cron/scheduler/executor.rs
+++ b/crates/openhuman-core/src/cron/scheduler/executor.rs
@@ -14,10 +14,10 @@ use super::failure_classification::{
is_api_key_unset_failure, is_budget_exhausted_failure, is_insufficient_credits_failure,
is_local_provider_unreachable_failure, is_session_expired_failure, permanent_halt_message,
};
-use crate::cron::bus_host::{kind_refusal, Binding};
-use crate::cron::handlers::{kind_handler, JobRunContext};
use crate::core::bus::BUS;
use crate::core::events::DomainEvent;
+use crate::cron::bus_host::{kind_refusal, Binding};
+use crate::cron::handlers::{kind_handler, JobRunContext};
use std::collections::HashMap;
use std::sync::Mutex;
use tinyflows_bus::schedule::types::{CronJob, JobType, SessionTarget};
@@ -341,7 +341,10 @@ pub(crate) async fn agent_job_too_frequent(
/// `agent` rejects them), so a job that trips this predates the rule. It keeps
/// running (silently skipping runs would turn its schedule into a lie) and
/// this line is the operator's signal to edit it.
-pub(crate) async fn warn_if_high_frequency_agent_job(config: &crate::config::Config, job: &CronJob) {
+pub(crate) async fn warn_if_high_frequency_agent_job(
+ config: &crate::config::Config,
+ job: &CronJob,
+) {
if let Some(too_frequent) = agent_job_too_frequent(config, job).await {
tracing::warn!(
"Cron agent job '{}' is scheduled more frequently than every 5 minutes: it \
diff --git a/crates/openhuman-core/src/cron/scheduler_frequency_tests.rs b/crates/openhuman-core/src/cron/scheduler_frequency_tests.rs
index 393811c604..2cdec04d24 100644
--- a/crates/openhuman-core/src/cron/scheduler_frequency_tests.rs
+++ b/crates/openhuman-core/src/cron/scheduler_frequency_tests.rs
@@ -1,9 +1,9 @@
use super::*;
-use tinyflows_bus::schedule::TooFrequent;
-use tinyflows_bus::schedule::MIN_AGENT_JOB_INTERVAL;
use tinyflows_bus::schedule::types::JobType;
use tinyflows_bus::schedule::types::Schedule;
+use tinyflows_bus::schedule::TooFrequent;
+use tinyflows_bus::schedule::MIN_AGENT_JOB_INTERVAL;
#[tokio::test]
async fn deliver_if_configured_empty_success_skips_chat_and_alert() {
let tmp = TempDir::new().unwrap();
diff --git a/crates/openhuman-core/src/cron/scheduler_tests.rs b/crates/openhuman-core/src/cron/scheduler_tests.rs
index 249e98c3bd..f06e88bbe3 100644
--- a/crates/openhuman-core/src/cron/scheduler_tests.rs
+++ b/crates/openhuman-core/src/cron/scheduler_tests.rs
@@ -9,7 +9,8 @@ use tinyagents_harness::agent_error::AgentError;
use tinyflows_bus::schedule::types::JobType;
use tinyflows_bus::schedule::types::SessionTarget;
use {
- crate::cron, tinyflows_bus::schedule::types::ActiveHours, tinyflows_bus::schedule::types::DeliveryConfig,
+ crate::cron, tinyflows_bus::schedule::types::ActiveHours,
+ tinyflows_bus::schedule::types::DeliveryConfig,
};
async fn test_config(tmp: &TempDir) -> Config {
diff --git a/crates/openhuman-core/src/cron/schemas.rs b/crates/openhuman-core/src/cron/schemas.rs
index 066de247c4..16908bc7a8 100644
--- a/crates/openhuman-core/src/cron/schemas.rs
+++ b/crates/openhuman-core/src/cron/schemas.rs
@@ -286,7 +286,8 @@ fn handle_add(ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture
let config = ctx.load_config().await?;
crate::core::runtime::components::require_config(&config, "tinyflows")?;
- let schedule: tinyflows_bus::schedule::types::Schedule = read_required(&params, "schedule")?;
+ let schedule: tinyflows_bus::schedule::types::Schedule =
+ read_required(&params, "schedule")?;
let name = params
.get("name")
.and_then(|v| v.as_str())
diff --git a/crates/openhuman-core/src/cron/seed.rs b/crates/openhuman-core/src/cron/seed.rs
index a460fca19a..67e6e246d8 100644
--- a/crates/openhuman-core/src/cron/seed.rs
+++ b/crates/openhuman-core/src/cron/seed.rs
@@ -21,8 +21,9 @@ use crate::config::Config;
use anyhow::Result;
use {
crate::cron::add_agent_job_with_definition, crate::cron::dedup_named_jobs,
- crate::cron::list_jobs, crate::cron::remove_job, tinyflows_bus::schedule::types::DeliveryConfig,
- tinyflows_bus::schedule::types::Schedule, tinyflows_bus::schedule::types::SessionTarget,
+ crate::cron::list_jobs, crate::cron::remove_job,
+ tinyflows_bus::schedule::types::DeliveryConfig, tinyflows_bus::schedule::types::Schedule,
+ tinyflows_bus::schedule::types::SessionTarget,
};
/// Well-known job names used to detect whether seeding has already run.
diff --git a/crates/openhuman-core/src/cron/store_tests.rs b/crates/openhuman-core/src/cron/store_tests.rs
index 2df08d4211..d55c73d810 100644
--- a/crates/openhuman-core/src/cron/store_tests.rs
+++ b/crates/openhuman-core/src/cron/store_tests.rs
@@ -189,7 +189,11 @@ fn a_patch_over_the_bus_keeps_the_agent_definition_it_does_not_mention() {
)
.unwrap();
- assert_eq!(job.agent_id.as_deref(), Some("teeny"), "the definition id is stored");
+ assert_eq!(
+ job.agent_id.as_deref(),
+ Some("teeny"),
+ "the definition id is stored"
+ );
let renamed = update_job(
&config,
&job.id,
diff --git a/crates/openhuman-core/src/cron/tools/add.rs b/crates/openhuman-core/src/cron/tools/add.rs
index d9d848de2f..29d16ae965 100644
--- a/crates/openhuman-core/src/cron/tools/add.rs
+++ b/crates/openhuman-core/src/cron/tools/add.rs
@@ -8,8 +8,9 @@ use serde_json::json;
use std::sync::Arc;
use tinytools::{PermissionLevel, Tool, ToolCallOptions, ToolExposure, ToolResult};
use {
- crate::cron, tinyflows_bus::schedule::types::DeliveryConfig, tinyflows_bus::schedule::types::JobType,
- tinyflows_bus::schedule::types::Schedule, tinyflows_bus::schedule::types::SessionTarget,
+ crate::cron, tinyflows_bus::schedule::types::DeliveryConfig,
+ tinyflows_bus::schedule::types::JobType, tinyflows_bus::schedule::types::Schedule,
+ tinyflows_bus::schedule::types::SessionTarget,
};
pub struct CronAddTool {
diff --git a/crates/openhuman-core/src/flows/ops/triggers.rs b/crates/openhuman-core/src/flows/ops/triggers.rs
index 1c32c8ba5c..74b273058b 100644
--- a/crates/openhuman-core/src/flows/ops/triggers.rs
+++ b/crates/openhuman-core/src/flows/ops/triggers.rs
@@ -93,7 +93,9 @@ pub(super) fn bind_schedule_trigger(config: &Config, flow: &Flow) {
tracing::warn!(target: "flows", flow_id = %flow.id, "[flows] schedule trigger config is missing `schedule` — cannot bind cron job");
return;
};
- let schedule: tinyflows_bus::schedule::types::Schedule = match serde_json::from_value(schedule_raw) {
+ let schedule: tinyflows_bus::schedule::types::Schedule = match serde_json::from_value(
+ schedule_raw,
+ ) {
Ok(s) => s,
Err(e) => {
tracing::warn!(target: "flows", flow_id = %flow.id, error = %e, "[flows] invalid schedule trigger config — cannot bind cron job");
diff --git a/crates/openhuman-core/src/modules/mod.rs b/crates/openhuman-core/src/modules/mod.rs
index 508dd519de..3cb2b9c1dd 100644
--- a/crates/openhuman-core/src/modules/mod.rs
+++ b/crates/openhuman-core/src/modules/mod.rs
@@ -171,7 +171,10 @@ pub use types::{LoadPolicy, ModuleRecord, ModuleSource, ModuleState, ModuleStatu
/// Imports tinymcp's legacy SQLite files under `data_dir` into the module's
/// storage, once per directory. Never fails the caller: an error is logged and
/// the import is retried at the next open.
-pub async fn import_legacy_mcp(ctx: &crate::core::runtime::DispatchCtx, data_dir: &std::path::Path) {
+pub async fn import_legacy_mcp(
+ ctx: &crate::core::runtime::DispatchCtx,
+ data_dir: &std::path::Path,
+) {
#[cfg(feature = "modules")]
match storage_import_tinymcp::import_legacy(ctx, data_dir).await {
Ok(outcome) => log::debug!("[mcp] legacy storage import: {outcome:?}"),
diff --git a/crates/openhuman-core/src/modules/registry.rs b/crates/openhuman-core/src/modules/registry.rs
index a0e02b3f02..7648098eb2 100644
--- a/crates/openhuman-core/src/modules/registry.rs
+++ b/crates/openhuman-core/src/modules/registry.rs
@@ -58,9 +58,9 @@ use records_docs_wallet::TINYWALLET;
#[cfg(feature = "modules")]
use records_extra::TINYBOX;
use records_extra::TINYCHANNELS;
-use records_flows::TINYFLOWS;
#[cfg(feature = "hosting")]
use records_extra::TINYHOSTS;
+use records_flows::TINYFLOWS;
use records_mcp_connectors::{TINYCONNECTORS, TINYMCP};
#[cfg(feature = "tinymemes")]
use records_memes::TINYMEMES;
diff --git a/crates/openhuman-core/src/modules/registry_contract_tests.rs b/crates/openhuman-core/src/modules/registry_contract_tests.rs
index cfaf1d8c00..676043859d 100644
--- a/crates/openhuman-core/src/modules/registry_contract_tests.rs
+++ b/crates/openhuman-core/src/modules/registry_contract_tests.rs
@@ -43,7 +43,11 @@ fn contract_names() -> Vec<(&'static str, &'static str, &'static str)> {
),
// The Authoring identity the module registers under; the scheduler is
// a second object on it (pinned by `the_flows_record_serves_the_schedule_object`).
- ("tinyflows", tinyflows_bus::BUS_NAME, tinyflows_bus::OBJECT_PATH),
+ (
+ "tinyflows",
+ tinyflows_bus::BUS_NAME,
+ tinyflows_bus::OBJECT_PATH,
+ ),
];
#[cfg(feature = "modules")]
names.push(("tinybox", tinybox_bus::INTERFACE, tinybox_bus::OBJECT_PATH));
diff --git a/crates/openhuman-core/src/modules/tinyflows.rs b/crates/openhuman-core/src/modules/tinyflows.rs
index c15222ffe8..fdafb4239f 100644
--- a/crates/openhuman-core/src/modules/tinyflows.rs
+++ b/crates/openhuman-core/src/modules/tinyflows.rs
@@ -77,14 +77,21 @@ mod imp {
}
}
- async fn schedule_proxy(config: &Config, timeout: std::time::Duration) -> Result<Proxy, String> {
+ async fn schedule_proxy(
+ config: &Config,
+ timeout: std::time::Duration,
+ ) -> Result<Proxy, String> {
ensure(config).await?;
let runtime = runtime::runtime()
.await
.map_err(|error| format!("the module bus is unavailable: {error}"))?;
runtime
.connection()
- .proxy(schedule::BUS_NAME, schedule::OBJECT_PATH, schedule::INTERFACE)
+ .proxy(
+ schedule::BUS_NAME,
+ schedule::OBJECT_PATH,
+ schedule::INTERFACE,
+ )
.map(|proxy| proxy.with_timeout(timeout))
.map_err(|error| format!("the tinyflows schedule object is unreachable: {error}"))
}
diff --git a/crates/openhuman-core/src/modules/tinyflows_tests.rs b/crates/openhuman-core/src/modules/tinyflows_tests.rs
index cee809599e..15cb3ba63b 100644
--- a/crates/openhuman-core/src/modules/tinyflows_tests.rs
+++ b/crates/openhuman-core/src/modules/tinyflows_tests.rs
@@ -3,7 +3,10 @@ use super::*;
#[test]
fn the_disabled_message_names_the_component_and_the_switch() {
let message = disabled_message();
- assert!(message.starts_with("COMPONENT_DISABLED:tinyflows"), "{message}");
+ assert!(
+ message.starts_with("COMPONENT_DISABLED:tinyflows"),
+ "{message}"
+ );
assert!(message.contains("[components] tinyflows = true"));
}
@@ -30,7 +33,10 @@ async fn the_schedule_object_answers_on_the_contracts_names() {
let config = Config::default();
let proxy = proxy(&config).await.expect("module attaches");
let millis: i64 = proxy
- .call(tinyflows_bus::schedule::members::PARSE_HUMAN_DELAY, ("30m",))
+ .call(
+ tinyflows_bus::schedule::members::PARSE_HUMAN_DELAY,
+ ("30m",),
+ )
.await
.unwrap();
assert_eq!(millis, 30 * 60 * 1000);
diff --git a/crates/openhuman-core/src/platform/about_app/ops_tests.rs b/crates/openhuman-core/src/platform/about_app/ops_tests.rs
index 3d2200f854..2644b0ea58 100644
--- a/crates/openhuman-core/src/platform/about_app/ops_tests.rs
+++ b/crates/openhuman-core/src/platform/about_app/ops_tests.rs
@@ -84,7 +84,11 @@ fn scheduled_job_capabilities_show_disabled_when_the_tinyflows_component_is_off(
CapabilityStatus::Disabled,
"{id}"
);
- assert_eq!(apply_components(cap, &off("flows")).status, cap.status, "{id}");
+ assert_eq!(
+ apply_components(cap, &off("flows")).status,
+ cap.status,
+ "{id}"
+ );
}
}
diff --git a/crates/openhuman-core/src/platform/mod.rs b/crates/openhuman-core/src/platform/mod.rs
index d21d415a5f..3d12d17006 100644
--- a/crates/openhuman-core/src/platform/mod.rs
+++ b/crates/openhuman-core/src/platform/mod.rs
@@ -9,8 +9,8 @@ pub mod connectivity;
pub mod cost;
pub mod doctor;
pub mod health;
-pub mod proc_metrics;
pub mod llm_gate;
+pub mod proc_metrics;
pub(crate) mod resource_admission;
pub mod service;
pub mod socket;
diff --git a/crates/openhuman-core/src/profiles/cron.rs b/crates/openhuman-core/src/profiles/cron.rs
index cbca956c3a..5ee644f690 100644
--- a/crates/openhuman-core/src/profiles/cron.rs
+++ b/crates/openhuman-core/src/profiles/cron.rs
@@ -66,22 +66,17 @@ pub async fn sweep(host: &ProfileHost, now: DateTime<Utc>) -> SweepReport {
continue;
};
let scope = DocScope::for_scope(&config, crate::storage::scope_for_profile(id.as_str()));
- let due: Vec<CronJob> = match store_in::<Vec<CronJob>>(
- &config,
- &scope,
- StoreOperation::Due { now },
- )
- .await
- {
- Ok(jobs) => jobs
- .into_iter()
- .filter(|job| matches!(job.job_type, JobType::Agent))
- .collect(),
- Err(error) => {
- log::warn!("[profiles][cron] profile={id} due jobs unreadable: {error}");
- continue;
- }
- };
+ let due: Vec<CronJob> =
+ match store_in::<Vec<CronJob>>(&config, &scope, StoreOperation::Due { now }).await {
+ Ok(jobs) => jobs
+ .into_iter()
+ .filter(|job| matches!(job.job_type, JobType::Agent))
+ .collect(),
+ Err(error) => {
+ log::warn!("[profiles][cron] profile={id} due jobs unreadable: {error}");
+ continue;
+ }
+ };
if due.is_empty() {
continue;
}
diff --git a/crates/openhuman-core/src/storage/import/tinyflows.rs b/crates/openhuman-core/src/storage/import/tinyflows.rs
index 351c1404c4..a70af0a59f 100644
--- a/crates/openhuman-core/src/storage/import/tinyflows.rs
+++ b/crates/openhuman-core/src/storage/import/tinyflows.rs
@@ -233,13 +233,10 @@ pub fn import_cron(
let mut filed_as = std::collections::HashMap::new();
for job in legacy.jobs {
let source_id = job.id.clone();
- let imported: ImportedJob = store_in(
- &config,
- &doc_scope,
- StoreOperation::ImportJob { job },
- )
- .await
- .context("import a cron job")?;
+ let imported: ImportedJob =
+ store_in(&config, &doc_scope, StoreOperation::ImportJob { job })
+ .await
+ .context("import a cron job")?;
report.wrote("jobs", imported.written);
filed_as.insert(source_id, imported.id);
}
diff --git a/crates/openhuman-core/src/storage/import/tinyflows_cron_tests.rs b/crates/openhuman-core/src/storage/import/tinyflows_cron_tests.rs
index 04a174e527..0a0ed33193 100644
--- a/crates/openhuman-core/src/storage/import/tinyflows_cron_tests.rs
+++ b/crates/openhuman-core/src/storage/import/tinyflows_cron_tests.rs
@@ -1,6 +1,6 @@
use super::*;
-use crate::storage::MemoryStorage;
use crate::cron::client::testing as cron_store;
+use crate::storage::MemoryStorage;
fn copy_tree(from: &Path, to: &Path) {
std::fs::create_dir_all(to).unwrap();
diff --git a/crates/openhuman-core/src/storage/import/tinyflows_tests.rs b/crates/openhuman-core/src/storage/import/tinyflows_tests.rs
index e7548894e4..f9096031b5 100644
--- a/crates/openhuman-core/src/storage/import/tinyflows_tests.rs
+++ b/crates/openhuman-core/src/storage/import/tinyflows_tests.rs
@@ -1,4 +1,5 @@
use super::*;
+use crate::cron::client::testing as cron_store;
use crate::storage::{MemoryStorage, Scope};
use serde_json::Value;
use sha2::Digest;
@@ -6,7 +7,6 @@ use std::collections::BTreeMap;
use tempfile::TempDir;
use tinyflows::engine::Checkpointer;
use tinyflows_drivers::catalog::FlowCatalogDocuments;
-use crate::cron::client::testing as cron_store;
use tinyflows_drivers::DriverCheckpointer;
fn fixtures() -> PathBuf {
diff --git a/crates/openhuman-core/src/tools/impl/system/schedule.rs b/crates/openhuman-core/src/tools/impl/system/schedule.rs
index f0fd3cce9d..4c7b3eb5ee 100644
--- a/crates/openhuman-core/src/tools/impl/system/schedule.rs
+++ b/crates/openhuman-core/src/tools/impl/system/schedule.rs
@@ -325,7 +325,8 @@ impl ScheduleTool {
active_hours: None,
}
} else if let Some(delay_str) = delay {
- let at = Utc::now() + crate::cron::client::parse_human_delay(&self.config, delay_str).await?;
+ let at = Utc::now()
+ + crate::cron::client::parse_human_delay(&self.config, delay_str).await?;
Schedule::At { at }
} else if let Some(at_str) = run_at {
let at: DateTime<Utc> = DateTime::parse_from_rfc3339(at_str)
diff --git a/crates/openhuman-embed/src/runtime/builder.rs b/crates/openhuman-embed/src/runtime/builder.rs
index 7180f760e8..c12d95719e 100644
--- a/crates/openhuman-embed/src/runtime/builder.rs
+++ b/crates/openhuman-embed/src/runtime/builder.rs
@@ -100,10 +100,7 @@ pub struct RuntimeBuilder {
pub(super) memory_engine: Option<Arc<dyn tinymemory_api::MemoryEngine>>,
pub(super) session_store: Option<Arc<dyn SessionStoreProvider>>,
pub(super) cron_delivery: Option<Arc<dyn openhuman_core::cron::host_delivery::CronDelivery>>,
- pub(super) cron_job_handlers: Vec<(
- crate::cron::JobKind,
- Arc<dyn crate::cron::JobKindHandler>,
- )>,
+ pub(super) cron_job_handlers: Vec<(crate::cron::JobKind, Arc<dyn crate::cron::JobKindHandler>)>,
pub(super) seams: HostSeams,
pub(super) max_agents: usize,
pub(super) agent_defaults: super::AgentDefaults,
@@ -297,7 +294,8 @@ impl RuntimeBuilder {
kind: crate::cron::JobKind,
handler: Arc<dyn crate::cron::JobKindHandler>,
) -> Self {
- self.cron_job_handlers.retain(|(existing, _)| *existing != kind);
+ self.cron_job_handlers
+ .retain(|(existing, _)| *existing != kind);
self.cron_job_handlers.push((kind, handler));
self
}
diff --git a/crates/openhuman-embed/tests/common/mod.rs b/crates/openhuman-embed/tests/common/mod.rs
index 6546a99f81..1e5181edee 100644
--- a/crates/openhuman-embed/tests/common/mod.rs
+++ b/crates/openhuman-embed/tests/common/mod.rs
@@ -68,10 +68,10 @@ pub fn link_tinyflows(runtime: &tokio::runtime::Runtime) {
openhuman_embed::modules::register_linked("tinyflows", tinyflows_module::linked_module);
let mut config = Config::default();
config.modules.allow_download = false;
- config
- .modules
- .overrides
- .push(ModuleOverride::with_source("tinyflows", ModuleSourceMode::Linked));
+ config.modules.overrides.push(ModuleOverride::with_source(
+ "tinyflows",
+ ModuleSourceMode::Linked,
+ ));
runtime
.block_on(openhuman_core::modules::ensure_loaded(&config, "tinyflows"))
.expect("the linked tinyflows module is admitted");
diff --git a/tests/storage_desktop_upgrade_e2e.rs b/tests/storage_desktop_upgrade_e2e.rs
index de82318da0..45e883f821 100644
--- a/tests/storage_desktop_upgrade_e2e.rs
+++ b/tests/storage_desktop_upgrade_e2e.rs
@@ -430,7 +430,11 @@ async fn a_desktop_upgrade_is_lossless_and_leaves_the_legacy_files_untouched(cas
// TinyAgents' run ledger imports `sessions.db` (and appends to it) with
// checked batches, which a driver without `ValidatedBatch` refuses.
let local = case.backend().for_scope(&Scope::local()).unwrap();
- if !local.documents().capabilities().contains(Capability::ValidatedBatch) {
+ if !local
+ .documents()
+ .capabilities()
+ .contains(Capability::ValidatedBatch)
+ {
// Written to the stderr handle, not with `eprintln!`, which the test
// harness captures for a passing test: the skip must show in the log.
use std::io::Write;