The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
chore: files changed crates/openhuman-core/src/agent/turn_host.rs,crates/openhuman-core/src/channels
Steven Enamakele7d69624a727
diff --git a/crates/openhuman-core/src/agent/turn_host.rs b/crates/openhuman-core/src/agent/turn_host.rsindex 48155e1429..ec5572c93a 100644--- a/crates/openhuman-core/src/agent/turn_host.rs+++ b/crates/openhuman-core/src/agent/turn_host.rs@@ -6,7 +6,7 @@use std::{sync::Arc, time::Duration};-use tinyagents_harness::{CancellationToken, run_queue::RunQueue};+use tinyagents_harness::{run_queue::RunQueue, CancellationToken};use tokio::sync::mpsc;use crate::{@@ -15,7 +15,7 @@ use crate::{queued_turn::QueuedTurn,session_host::OpenHumanSessionHost,turn_env::HostTurnEnv,- turn_origin::{AgentTurnOrigin, with_origin},+ turn_origin::{with_origin, AgentTurnOrigin},},security::approval::ApprovalTurnContext,};diff --git a/crates/openhuman-core/src/channels/runtime/dispatch/native_runner_tests.rs b/crates/openhuman-core/src/channels/runtime/dispatch/native_runner_tests.rsindex b1ffd910ec..f6774fb15c 100644--- a/crates/openhuman-core/src/channels/runtime/dispatch/native_runner_tests.rs+++ b/crates/openhuman-core/src/channels/runtime/dispatch/native_runner_tests.rs@@ -152,13 +152,11 @@ async fn queued_terminal_delivery_does_not_leave_a_completion_entry() {shared.with("queued-request", |_| {});shared.record_delivery("queued-request", true);- assert!(- shared- .slots- .lock()- .unwrap_or_else(|poisoned| poisoned.into_inner())- .is_empty()- );+ assert!(shared+ .slots+ .lock()+ .unwrap_or_else(|poisoned| poisoned.into_inner())+ .is_empty());}#[tokio::test]@@ -168,13 +166,11 @@ async fn active_terminal_delivery_is_returned_to_its_waiting_caller() {shared.record_delivery("active-request", true);assert_eq!(shared.take_delivery("active-request"), Some(true));- assert!(- shared- .slots- .lock()- .unwrap_or_else(|poisoned| poisoned.into_inner())- .is_empty()- );+ assert!(shared+ .slots+ .lock()+ .unwrap_or_else(|poisoned| poisoned.into_inner())+ .is_empty());}#[tokio::test]diff --git a/crates/openhuman-core/src/channels/runtime/mod.rs b/crates/openhuman-core/src/channels/runtime/mod.rsindex aca5a7a8cc..9d7e462aa5 100644--- a/crates/openhuman-core/src/channels/runtime/mod.rs+++ b/crates/openhuman-core/src/channels/runtime/mod.rs@@ -5,6 +5,8 @@ pub(crate) mod session;mod startup;pub(crate) use startup::hydrate_channel_credentials;+#[cfg(test)]+pub(crate) use startup::prepare_module_runtime_for_test_in_context;pub(crate) use startup::prepare_runtime_limits;pub use startup::start_channels;pub(crate) use startup::start_channels_with_session;@@ -13,8 +15,6 @@ pub(crate) use startup::ChannelHandle;pub(crate) use startup::TestChannel;#[cfg(test)]pub(crate) use startup::{prepare_module_runtime_for_test, ModuleRuntimeTestGuard};-#[cfg(test)]-pub(crate) use startup::prepare_module_runtime_for_test_in_context;// The hosted-channel relay (`channels::providers::relay`) runs one message// through the same pipeline, with a context built from the caller's config.#[cfg(test)]diff --git a/crates/openhuman-core/src/channels/runtime/startup.rs b/crates/openhuman-core/src/channels/runtime/startup.rsindex dbd5fe4f6b..02d2cacde1 100644--- a/crates/openhuman-core/src/channels/runtime/startup.rs+++ b/crates/openhuman-core/src/channels/runtime/startup.rs@@ -296,9 +296,8 @@ impl ModuleRuntimeTestGuard {pub(crate) fn module_objects(&self,- ) -> std::sync::Arc<- std::collections::HashMap<String, tinybus::module::ModuleObjectClient>,- > {+ ) -> std::sync::Arc<std::collections::HashMap<String, tinybus::module::ModuleObjectClient>>+ {self.0.module_objects()}diff --git a/crates/openhuman-core/src/channels/runtime/test_support.rs b/crates/openhuman-core/src/channels/runtime/test_support.rsindex d6a60eba90..7b1582265a 100644--- a/crates/openhuman-core/src/channels/runtime/test_support.rs+++ b/crates/openhuman-core/src/channels/runtime/test_support.rs@@ -3,10 +3,10 @@#[allow(unused_imports)] // Used by tests/raw_coverage outside the core unit-test crate.pub use super::dispatch::test_support::build_channel_context_block_for_test;use super::dispatch::{- RuntimeChannelMessage, process_channel_message, process_channel_runtime_message,+ process_channel_message, process_channel_runtime_message, RuntimeChannelMessage,};-use crate::channels::ChannelSystemPrompt;use crate::channels::context::ChannelRuntimeContext;+use crate::channels::ChannelSystemPrompt;use crate::config::{MultimodalConfig, MultimodalFileConfig, ReliabilityConfig};use crate::core::events::DomainEvent;use crate::inference::provider::ProviderRuntimeOptions;@@ -17,8 +17,8 @@ use std::path::PathBuf;use std::sync::atomic::Ordering;use std::sync::{Arc, Mutex};use std::time::Duration;-use tinychannels_bus::CHANNEL_MESSAGE_TIMEOUT_SECS;use tinychannels_bus::ChannelMessage;+use tinychannels_bus::CHANNEL_MESSAGE_TIMEOUT_SECS;use tinyinference_llm::model::{ChatModel, ModelRequest, ModelResponse};use tinytools::{Tool, ToolResult};use wiremock::matchers::{method, path};diff --git a/crates/openhuman-core/src/channels/tests/runtime_tool_calls.rs b/crates/openhuman-core/src/channels/tests/runtime_tool_calls.rsindex e93eeb43b1..58c9e70147 100644--- a/crates/openhuman-core/src/channels/tests/runtime_tool_calls.rs+++ b/crates/openhuman-core/src/channels/tests/runtime_tool_calls.rs@@ -1,6 +1,6 @@use super::super::context::{- CHANNEL_MESSAGE_TIMEOUT_SECS, ChannelRouteSelection, ChannelRuntimeContext,- conversation_history_key,+ conversation_history_key, ChannelRouteSelection, ChannelRuntimeContext,+ CHANNEL_MESSAGE_TIMEOUT_SECS,};use super::super::runtime::process_channel_message;use super::common::{diff --git a/crates/openhuman-core/src/cron/bus_host_tests.rs b/crates/openhuman-core/src/cron/bus_host_tests.rsindex b89dfd5541..91355d42a3 100644--- a/crates/openhuman-core/src/cron/bus_host_tests.rs+++ b/crates/openhuman-core/src/cron/bus_host_tests.rs@@ -3,13 +3,13 @@use super::*;use crate::cron::handlers::{- JobKindHandler, JobOutcome, JobRunContext, kind_handler, register_kind,+ kind_handler, register_kind, JobKindHandler, JobOutcome, JobRunContext,};use async_trait::async_trait;use std::sync::atomic::{AtomicUsize, Ordering};use tempfile::TempDir;use tinyflows_bus::schedule::types::Schedule;-use tinyflows_bus::schedule::{CALLBACK_INTERFACE, callbacks};+use tinyflows_bus::schedule::{callbacks, CALLBACK_INTERFACE};fn config(tmp: &TempDir) -> Config {let config = Config {diff --git a/crates/openhuman-core/src/cron/client.rs b/crates/openhuman-core/src/cron/client.rsindex 54729b3739..941ad5d7b4 100644--- a/crates/openhuman-core/src/cron/client.rs+++ b/crates/openhuman-core/src/cron/client.rs@@ -12,14 +12,14 @@//! Every call logs `[cron:bus]` with the member (never a payload) so a failing//! call is greppable.-use anyhow::{Result, anyhow};+use anyhow::{anyhow, Result};use chrono::{DateTime, Duration, Utc};-use serde::{Serialize, de::DeserializeOwned};+use serde::{de::DeserializeOwned, Serialize};use serde_json::Value;use tinyflows_bus::schedule::{- CheckOriginRequest, CheckPatchRequest, DeliveryConfig, JobOrigin, NextRunRequest,+ members, CheckOriginRequest, CheckPatchRequest, DeliveryConfig, JobOrigin, NextRunRequest,RunsCloserThanRequest, Schedule, SessionTarget, StoreBackend, StoreConfig, StoreOperation,- StoreRequest, TooFrequent, ValidateScheduleRequest, members,+ StoreRequest, TooFrequent, ValidateScheduleRequest,};use tinyflows_bus::schedule::{CronJob, CronJobPatch};diff --git a/crates/openhuman-core/src/cron/client_tests.rs b/crates/openhuman-core/src/cron/client_tests.rsindex 9fbd63f7c2..bf06069b1d 100644--- a/crates/openhuman-core/src/cron/client_tests.rs+++ b/crates/openhuman-core/src/cron/client_tests.rs@@ -31,17 +31,13 @@ async fn schedules_are_validated_and_the_agent_floor_applies() {validate_schedule(&config, &every_minute, at(8), false).await.unwrap();- assert!(- validate_schedule(&config, &every_minute, at(8), true)- .await- .is_err()- );+ assert!(validate_schedule(&config, &every_minute, at(8), true)+ .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]@@ -51,12 +47,10 @@ async fn expressions_normalise_and_report_their_cron_form() {normalize_expression(&config, "0 9 * * 1-5").await.unwrap(),"0 0 9 * * 2-6");- assert!(- schedule_cron_expression(&config, &cron("0 9 * * *"))- .await- .unwrap()- .is_some()- );+ assert!(schedule_cron_expression(&config, &cron("0 9 * * *"))+ .await+ .unwrap()+ .is_some());assert!(schedule_cron_expression(&config, &Schedule::Every { every_ms: 1000 }).awaitdiff --git a/crates/openhuman-core/src/cron/cutover_tests.rs b/crates/openhuman-core/src/cron/cutover_tests.rsindex 08ad47ab76..65b5da3e06 100644--- a/crates/openhuman-core/src/cron/cutover_tests.rs+++ b/crates/openhuman-core/src/cron/cutover_tests.rs@@ -7,8 +7,8 @@ use super::*;use crate::config::Config;use crate::memory::lifecycle::jobs::BACKGROUND_JOB;use crate::security::SecurityPolicy;-use std::sync::Arc;use std::sync::atomic::{AtomicUsize, Ordering};+use std::sync::Arc;use tempfile::TempDir;fn config(tmp: &TempDir) -> Config {diff --git a/crates/openhuman-core/src/cron/documents_port.rs b/crates/openhuman-core/src/cron/documents_port.rsindex 87b4c943e1..4e9c801894 100644--- a/crates/openhuman-core/src/cron/documents_port.rs+++ b/crates/openhuman-core/src/cron/documents_port.rs@@ -24,7 +24,7 @@ use std::path::PathBuf;use std::sync::{Arc, LazyLock};use anyhow::{Context, Result};-use serde_json::{Value, json};+use serde_json::{json, Value};use tinybus::Result as BusResult;use tinyflows_bus::schedule::CallbackAddress;use tinystoragedrivers::{diff --git a/crates/openhuman-core/src/cron/job_builder.rs b/crates/openhuman-core/src/cron/job_builder.rsindex e3efdcb594..c198e83d14 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::AgentJobSpec, 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::types::delivery_mode,+ 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/job_builder_tests.rs b/crates/openhuman-core/src/cron/job_builder_tests.rsindex ef6166edda..4e460fe17f 100644--- a/crates/openhuman-core/src/cron/job_builder_tests.rs+++ b/crates/openhuman-core/src/cron/job_builder_tests.rs@@ -95,18 +95,14 @@ fn origin_delivery_or_current_target_without_an_origin_is_an_error() {}).unwrap(),);- assert!(- create_agent_job(&cfg, i, None)- .unwrap_err()- .contains("origin")- );+ assert!(create_agent_job(&cfg, i, None)+ .unwrap_err()+ .contains("origin"));let mut i = input();i.session_target = Some(SessionTarget::Current);- assert!(- create_agent_job(&cfg, i, None)- .unwrap_err()- .contains("current")- );+ assert!(create_agent_job(&cfg, i, None)+ .unwrap_err()+ .contains("current"));}fn announce(channel_name: &str, to: &str) -> DeliveryConfig {diff --git a/crates/openhuman-core/src/cron/limits.rs b/crates/openhuman-core/src/cron/limits.rsindex 846111673b..fc60190284 100644--- a/crates/openhuman-core/src/cron/limits.rs+++ b/crates/openhuman-core/src/cron/limits.rs@@ -9,12 +9,12 @@//! changed ([`super::store`]) and again where it runs, so a row written before//! the mode was switched on is refused too.-use anyhow::{Result, bail};+use anyhow::{bail, Result};use chrono::{Duration, Utc};use crate::config::Config;use crate::cron::{- CronJob, CronJobPatch, DeliveryConfig, JobType, Schedule, delivery_mode, list_jobs,+ delivery_mode, list_jobs, CronJob, CronJobPatch, DeliveryConfig, JobType, Schedule,};/// Whether `config` restricts cron to agent jobs.diff --git a/crates/openhuman-core/src/cron/limits_tests.rs b/crates/openhuman-core/src/cron/limits_tests.rsindex 2af9149b08..472919bb73 100644--- a/crates/openhuman-core/src/cron/limits_tests.rs+++ b/crates/openhuman-core/src/cron/limits_tests.rs@@ -1,9 +1,9 @@//! The agent-only limits: what is refused at add, update and run.use super::*;-use crate::cron::job_builder::{AgentJobInput, create_agent_job};+use crate::cron::job_builder::{create_agent_job, AgentJobInput};use crate::cron::limits;-use crate::cron::{JobOrigin, add_job, add_shell_job, get_job, update_job};+use crate::cron::{add_job, add_shell_job, get_job, update_job, JobOrigin};use tempfile::TempDir;fn limited(tmp: &TempDir) -> Config {@@ -54,16 +54,14 @@ fn shell_and_flow_jobs_are_refused() {assert!(add_shell_job(&config, None, every.clone(), "echo hi").is_err());assert!(add_job(&config, "*/10 * * * *", "echo hi").is_err());assert!(crate::cron::add_flow_schedule_job(&config, "flow", every).is_err());- assert!(- limits::check_patch(- &config,- &CronJobPatch {- command: Some("echo hi".into()),- ..CronJobPatch::default()- }- )- .is_err()- );+ assert!(limits::check_patch(+ &config,+ &CronJobPatch {+ command: Some("echo hi".into()),+ ..CronJobPatch::default()+ }+ )+ .is_err());}#[test]@@ -85,28 +83,24 @@ fn jobs_need_a_conversation_and_may_not_pick_a_destination() {}let job = create_agent_job(&config, input(600_000, None), origin()).unwrap();assert_eq!(job.delivery.mode, "origin");- assert!(- update_job(- &config,- &job.id,- CronJobPatch {- delivery: Some(delivery("announce")),- ..CronJobPatch::default()- }- )- .is_err()- );- assert!(- update_job(- &config,- &job.id,- CronJobPatch {- origin: Some(None),- ..CronJobPatch::default()- }- )- .is_err()- );+ assert!(update_job(+ &config,+ &job.id,+ CronJobPatch {+ delivery: Some(delivery("announce")),+ ..CronJobPatch::default()+ }+ )+ .is_err());+ assert!(update_job(+ &config,+ &job.id,+ CronJobPatch {+ origin: Some(None),+ ..CronJobPatch::default()+ }+ )+ .is_err());}#[test]@@ -169,27 +163,21 @@ async fn run_now_refuses_a_stored_job_that_breaks_the_limits() {let shell =add_shell_job(&config, None, Schedule::Every { every_ms: 600_000 }, "echo").unwrap();config.cron.agent_jobs_only = true;- assert!(- crate::cron::ops::run_job_now(- &crate::core::runtime::DispatchCtx::ambient(),- &config,- &shell.id- )- .await- .is_err()- );- assert!(- crate::cron::ops::cron_run(- &crate::core::runtime::DispatchCtx::ambient(),- &config,- &shell.id- )- .await- .is_err()- );- assert!(- crate::cron::list_runs(&config, &shell.id, 10)- .unwrap()- .is_empty()- );+ assert!(crate::cron::ops::run_job_now(+ &crate::core::runtime::DispatchCtx::ambient(),+ &config,+ &shell.id+ )+ .await+ .is_err());+ assert!(crate::cron::ops::cron_run(+ &crate::core::runtime::DispatchCtx::ambient(),+ &config,+ &shell.id+ )+ .await+ .is_err());+ assert!(crate::cron::list_runs(&config, &shell.id, 10)+ .unwrap()+ .is_empty());}diff --git a/crates/openhuman-core/src/cron/mod.rs b/crates/openhuman-core/src/cron/mod.rsindex 4ae6508a09..ff65343000 100644--- a/crates/openhuman-core/src/cron/mod.rs+++ b/crates/openhuman-core/src/cron/mod.rs@@ -71,4 +71,4 @@ pub use tinyflows_bus::schedule::types::{ActiveHours, CronJob, CronJobPatch, CronRun, DeliveryConfig, DeliveryStatus, JobOrigin,JobType, Schedule, SessionTarget,};-pub use tinyflows_bus::schedule::{AgentJobSpec, JobPolicy, MIN_AGENT_JOB_INTERVAL, TooFrequent};+pub use tinyflows_bus::schedule::{AgentJobSpec, JobPolicy, TooFrequent, MIN_AGENT_JOB_INTERVAL};diff --git a/crates/openhuman-core/src/cron/ops_tests.rs b/crates/openhuman-core/src/cron/ops_tests.rsindex cf6bffcd82..f25b49be45 100644--- a/crates/openhuman-core/src/cron/ops_tests.rs+++ b/crates/openhuman-core/src/cron/ops_tests.rs@@ -178,10 +178,9 @@ fn update_fails_when_no_fields_provided() {let job = make_job(&config, "*/5 * * * *", None, "echo test");let err = run_update(&config, &job.id, None, None, None, None).unwrap_err();- assert!(- err.to_string()- .contains("At least one of --expression, --tz, --command, or --name")- );+ assert!(err+ .to_string()+ .contains("At least one of --expression, --tz, --command, or --name"));}#[test]@@ -192,10 +191,9 @@ fn update_rejects_expression_for_non_cron_schedule() {let job = add_shell_job(&config, None, Schedule::At { at }, "echo test").unwrap();let err = run_update(&config, &job.id, Some("0 9 * * *"), None, None, None).unwrap_err();- assert!(- err.to_string()- .contains("Cannot update expression/tz on a non-cron schedule")- );+ assert!(err+ .to_string()+ .contains("Cannot update expression/tz on a non-cron schedule"));}// ── add_once ────────────────────────────────────────────────────@@ -617,13 +615,11 @@ async fn run_job_now_refuses_a_job_that_is_already_running() {async fn run_job_now_reports_an_unknown_job() {let tmp = TempDir::new().unwrap();let config = test_config(&tmp);- assert!(- run_job_now(- &crate::core::runtime::DispatchCtx::ambient(),- &config,- "no-such-job"- )- .await- .is_err()- );+ assert!(run_job_now(+ &crate::core::runtime::DispatchCtx::ambient(),+ &config,+ "no-such-job"+ )+ .await+ .is_err());}diff --git a/crates/openhuman-core/src/cron/origin.rs b/crates/openhuman-core/src/cron/origin.rsindex 1b80c6e00b..c0a4ccba34 100644--- a/crates/openhuman-core/src/cron/origin.rs+++ b/crates/openhuman-core/src/cron/origin.rs@@ -10,8 +10,8 @@use crate::agent::turn_origin::{self, AgentTurnOrigin};use serde_json::Value;use {- tinyflows_bus::schedule::types::CronJob, tinyflows_bus::schedule::types::JobOrigin,- tinyflows_bus::schedule::types::delivery_mode,+ tinyflows_bus::schedule::types::delivery_mode, tinyflows_bus::schedule::types::CronJob,+ tinyflows_bus::schedule::types::JobOrigin,};/// Map a live turn origin onto the origin a job created in it records.diff --git a/crates/openhuman-core/src/cron/origin_tests.rs b/crates/openhuman-core/src/cron/origin_tests.rsindex c7aebf58de..42dfe1da84 100644--- a/crates/openhuman-core/src/cron/origin_tests.rs+++ b/crates/openhuman-core/src/cron/origin_tests.rs@@ -1,5 +1,5 @@use super::*;-use crate::agent::turn_origin::{TrustedAutomationSource, with_origin};+use crate::agent::turn_origin::{with_origin, TrustedAutomationSource};use serde_json::json;use tinyflows_bus::schedule::types::{ChannelConversationIdentity, ChannelSessionIdentity, Schedule,diff --git a/crates/openhuman-core/src/cron/scheduler.rs b/crates/openhuman-core/src/cron/scheduler.rsindex ce6dfb29b3..d0e9df0605 100644--- a/crates/openhuman-core/src/cron/scheduler.rs+++ b/crates/openhuman-core/src/cron/scheduler.rs@@ -46,19 +46,19 @@ pub use delivery::deliver_job;use crate::config::Config;use crate::core::bus::BUS;use crate::core::events::DomainEvent;-use crate::cron::bus_host::{self, Binding, CLAIM_SCOPE, HostRegistration};+use crate::cron::bus_host::{self, Binding, HostRegistration, CLAIM_SCOPE};use crate::cron::documents_port::DocScope;use crate::modules::tinyflows as module;use crate::security::SecurityPolicy;-use anyhow::{Result, anyhow};-use serde_json::{Value, json};+use anyhow::{anyhow, Result};+use serde_json::{json, Value};use std::collections::{HashMap, HashSet};use std::sync::atomic::{AtomicBool, Ordering};use std::sync::{Arc, LazyLock, Mutex};use tinyflows_bus::schedule::types::CronJob;use tinyflows_bus::schedule::{- Attempt, ManualDelivery, RunJobNow, RunJobReply, StartScheduler, StoreBackend, StoreConfig,- members,+ members, Attempt, ManualDelivery, RunJobNow, RunJobReply, StartScheduler, StoreBackend,+ StoreConfig,};use tokio::time::{self, Duration};diff --git a/crates/openhuman-core/src/cron/scheduler/delivery.rs b/crates/openhuman-core/src/cron/scheduler/delivery.rsindex 36549ff15a..1a3bcb02ff 100644--- a/crates/openhuman-core/src/cron/scheduler/delivery.rs+++ b/crates/openhuman-core/src/cron/scheduler/delivery.rs@@ -10,9 +10,9 @@ use crate::core::events::DomainEvent;use anyhow::Result;use chrono::Utc;use {- tinyflows_bus::schedule::types::CronJob, tinyflows_bus::schedule::types::DeliveryConfig,- tinyflows_bus::schedule::types::DeliveryStatus, tinyflows_bus::schedule::types::JobType,- tinyflows_bus::schedule::types::delivery_mode,+ tinyflows_bus::schedule::types::delivery_mode, tinyflows_bus::schedule::types::CronJob,+ tinyflows_bus::schedule::types::DeliveryConfig, tinyflows_bus::schedule::types::DeliveryStatus,+ tinyflows_bus::schedule::types::JobType,};pub(super) const MORNING_BRIEFING_AGENT_ID: &str = "morning_briefing";diff --git a/crates/openhuman-core/src/cron/scheduler/executor.rs b/crates/openhuman-core/src/cron/scheduler/executor.rsindex 21d5355372..7bbf7e5c04 100644--- a/crates/openhuman-core/src/cron/scheduler/executor.rs+++ b/crates/openhuman-core/src/cron/scheduler/executor.rs@@ -16,12 +16,12 @@ use super::failure_classification::{};use crate::core::bus::BUS;use crate::core::events::DomainEvent;-use crate::cron::bus_host::{Binding, kind_refusal};-use crate::cron::handlers::{JobRunContext, kind_handler};+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::Attempt;use tinyflows_bus::schedule::types::{CronJob, JobType, SessionTarget};+use tinyflows_bus::schedule::Attempt;/// Run states kept before the map is cleared outright (a run whose task was/// aborted never reaches `failed`).diff --git a/crates/openhuman-core/src/cron/scheduler/origin_delivery.rs b/crates/openhuman-core/src/cron/scheduler/origin_delivery.rsindex d280f9351b..ccf4234351 100644--- a/crates/openhuman-core/src/cron/scheduler/origin_delivery.rs+++ b/crates/openhuman-core/src/cron/scheduler/origin_delivery.rs@@ -17,8 +17,8 @@ use crate::config::Config;use crate::core::runtime::DispatchCtx;#[cfg(feature = "channels")]use crate::cron::channel_bridge;-use crate::web_chat::{WebChannelEvent, publish_web_channel_event};-use anyhow::{Result, anyhow};+use crate::web_chat::{publish_web_channel_event, WebChannelEvent};+use anyhow::{anyhow, Result};use std::path::Path;use tinyflows_bus::schedule::types::{CronJob, DeliveryStatus, JobOrigin};@@ -72,8 +72,8 @@ pub(crate) async fn append_to_origin_transcript(append: &TranscriptAppend<'_>,) -> Result<(), String> {use tinyagents_session::transcript::{- BackgroundAppend, BackgroundAppendOutcome, SessionRef, TranscriptMessage,- append_background_message_in,+ append_background_message_in, BackgroundAppend, BackgroundAppendOutcome, SessionRef,+ TranscriptMessage,};let session = SessionRef::scoped(append.session_key.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.rsindex 5e773bfb6e..d67b00b437 100644--- a/crates/openhuman-core/src/cron/scheduler/origin_delivery_tests.rs+++ b/crates/openhuman-core/src/cron/scheduler/origin_delivery_tests.rs@@ -99,15 +99,13 @@ 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]@@ -184,17 +182,15 @@ 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/run_delivery.rs b/crates/openhuman-core/src/cron/scheduler/run_delivery.rsindex 015e733276..9d583b4e6a 100644--- a/crates/openhuman-core/src/cron/scheduler/run_delivery.rs+++ b/crates/openhuman-core/src/cron/scheduler/run_delivery.rs@@ -11,8 +11,8 @@use super::delivery::deliver_run;use crate::core::bus::BUS;use crate::core::events::DomainEvent;-use crate::cron::bus_host::{Binding, kind_refusal};-use crate::cron::handlers::{JobRunContext, kind_handler};+use crate::cron::bus_host::{kind_refusal, Binding};+use crate::cron::handlers::{kind_handler, JobRunContext};use anyhow::Result;use chrono::Utc;use tinyflows_bus::schedule::types::{diff --git a/crates/openhuman-core/src/cron/scheduler_classifier_and_delivery_tests.rs b/crates/openhuman-core/src/cron/scheduler_classifier_and_delivery_tests.rsindex 052be539f7..714a36b771 100644--- a/crates/openhuman-core/src/cron/scheduler_classifier_and_delivery_tests.rs+++ b/crates/openhuman-core/src/cron/scheduler_classifier_and_delivery_tests.rs@@ -13,17 +13,15 @@ async fn deliver_if_configured_skips_empty_mode() {let config = test_config(&tmp).await;let mut job = test_job("echo ok");job.delivery.mode = "".into();- assert!(- deliver_if_configured(- &crate::core::runtime::DispatchCtx::ambient(),- &config,- &job,- "output",- true- )- .await- .is_ok()- );+ assert!(deliver_if_configured(+ &crate::core::runtime::DispatchCtx::ambient(),+ &config,+ &job,+ "output",+ true+ )+ .await+ .is_ok());}#[tokio::test]@@ -81,17 +79,15 @@ async fn deliver_if_configured_proactive_mode_succeeds() {to: None,best_effort: true,};- assert!(- deliver_if_configured(- &crate::core::runtime::DispatchCtx::ambient(),- &config,- &job,- "hello",- true- )- .await- .is_ok()- );+ assert!(deliver_if_configured(+ &crate::core::runtime::DispatchCtx::ambient(),+ &config,+ &job,+ "hello",+ true+ )+ .await+ .is_ok());}// ──────────────────────────────────────────────────────────────────────@@ -652,17 +648,15 @@ async fn deliver_if_configured_failure_skips_chat_but_alerts() {let config = test_config(&tmp).await;let job = proactive_job();// Failed run (non-empty canned error): no chat injection, but still alerts.- assert!(- deliver_if_configured(- &crate::core::runtime::DispatchCtx::ambient(),- &config,- &job,- "Something went wrong.",- false- )- .await- .is_ok()- );+ assert!(deliver_if_configured(+ &crate::core::runtime::DispatchCtx::ambient(),+ &config,+ &job,+ "Something went wrong.",+ false+ )+ .await+ .is_ok());assert_eq!(cron_alerts(&config).await, 1);}@@ -672,17 +666,15 @@ async fn deliver_if_configured_empty_failure_alerts_with_fallback_body() {let config = test_config(&tmp).await;let job = proactive_job();// Empty failed run: still surfaces in /notifications with a fallback body.- assert!(- deliver_if_configured(- &crate::core::runtime::DispatchCtx::ambient(),- &config,- &job,- "",- false- )- .await- .is_ok()- );+ assert!(deliver_if_configured(+ &crate::core::runtime::DispatchCtx::ambient(),+ &config,+ &job,+ "",+ false+ )+ .await+ .is_ok());let items =crate::desktop::notifications::store::list(&config, 10, 0, Some("cron"), None).unwrap();assert_eq!(items.len(), 1);diff --git a/crates/openhuman-core/src/cron/scheduler_dispatch_tests.rs b/crates/openhuman-core/src/cron/scheduler_dispatch_tests.rsindex 91a38e8f26..8d5be7cc55 100644--- a/crates/openhuman-core/src/cron/scheduler_dispatch_tests.rs+++ b/crates/openhuman-core/src/cron/scheduler_dispatch_tests.rs@@ -3,12 +3,12 @@//! are honoured and a system job's handler result is what gets recorded.use super::*;-use crate::cron::system_job_handlers::{SystemJobContext, register};+use crate::cron::system_job_handlers::{register, SystemJobContext};use crate::cron::system_jobs::ensure_system_job;use std::sync::atomic::{AtomicUsize, Ordering};use tempfile::TempDir;-use tinyflows_bus::schedule::JobPolicy;use tinyflows_bus::schedule::types::Schedule;+use tinyflows_bus::schedule::JobPolicy;/// Stores `policy` on the job.fn set_policy(config: &Config, job_id: &str, policy: JobPolicy) -> anyhow::Result<()> {@@ -166,12 +166,10 @@ 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]@@ -286,12 +284,10 @@ 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/scheduler_frequency_tests.rs b/crates/openhuman-core/src/cron/scheduler_frequency_tests.rsindex a78f9a998b..4390b2fe1c 100644--- a/crates/openhuman-core/src/cron/scheduler_frequency_tests.rs+++ b/crates/openhuman-core/src/cron/scheduler_frequency_tests.rs@@ -1,26 +1,24 @@use super::*;-use tinyflows_bus::schedule::MIN_AGENT_JOB_INTERVAL;-use tinyflows_bus::schedule::TooFrequent;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();let config = test_config(&tmp).await;let job = proactive_job();// Successful but empty: nothing delivered anywhere.- assert!(- deliver_if_configured(- &crate::core::runtime::DispatchCtx::ambient(),- &config,- &job,- "",- true- )- .await- .is_ok()- );+ assert!(deliver_if_configured(+ &crate::core::runtime::DispatchCtx::ambient(),+ &config,+ &job,+ "",+ true+ )+ .await+ .is_ok());assert_eq!(cron_alerts(&config).await, 0);}diff --git a/crates/openhuman-core/src/cron/scheduler_halt_and_persist_tests.rs b/crates/openhuman-core/src/cron/scheduler_halt_and_persist_tests.rsindex 1cfc88d8c2..b87778bc15 100644--- a/crates/openhuman-core/src/cron/scheduler_halt_and_persist_tests.rs+++ b/crates/openhuman-core/src/cron/scheduler_halt_and_persist_tests.rs@@ -253,7 +253,8 @@ fn is_local_provider_unreachable_failure_matches_raw_no_models_loaded_body() {#[test]fn is_local_provider_unreachable_failure_checks_output_when_raw_is_generic() {- let output = "Your local inference server (e.g. LM Studio) is running but has no model loaded. \+ let output =+ "Your local inference server (e.g. LM Studio) is running but has no model loaded. \Load a model, then try again.";assert!(is_local_provider_unreachable_failure(@@ -439,13 +440,11 @@ async fn scheduler_flow_runs_active_hours_job_and_reschedules_inside_window() {let stored = cron::get_job(&config, &job.id).unwrap();assert_eq!(stored.last_status.as_deref(), Some("ok"));- assert!(- stored- .last_output- .as_deref()- .unwrap_or_default()- .contains("active-hours-fired")- );+ assert!(stored+ .last_output+ .as_deref()+ .unwrap_or_default()+ .contains("active-hours-fired"));assert_eq!(stored.schedule,Schedule::Cron {@@ -552,17 +551,15 @@ async fn deliver_if_configured_skips_non_announce_mode() {let job = test_job("echo ok");// Default delivery mode is not "announce", so nothing is published.- assert!(- deliver_if_configured(- &crate::core::runtime::DispatchCtx::ambient(),- &config,- &job,- "x",- true- )- .await- .is_ok()- );+ assert!(deliver_if_configured(+ &crate::core::runtime::DispatchCtx::ambient(),+ &config,+ &job,+ "x",+ true+ )+ .await+ .is_ok());}#[tokio::test]@@ -619,17 +616,15 @@ async fn deliver_if_configured_publishes_event_for_announce_mode() {assert_eq!(received.load(Ordering::SeqCst), 1);// Also verify the function itself succeeds.- assert!(- deliver_if_configured(- &crate::core::runtime::DispatchCtx::ambient(),- &config,- &job,- "hello",- true- )- .await- .is_ok()- );+ assert!(deliver_if_configured(+ &crate::core::runtime::DispatchCtx::ambient(),+ &config,+ &job,+ "hello",+ true+ )+ .await+ .is_ok());}#[test]diff --git a/crates/openhuman-core/src/cron/scheduler_host_agent_tests.rs b/crates/openhuman-core/src/cron/scheduler_host_agent_tests.rsindex f332c3b1ba..f043e64c3d 100644--- a/crates/openhuman-core/src/cron/scheduler_host_agent_tests.rs+++ b/crates/openhuman-core/src/cron/scheduler_host_agent_tests.rs@@ -109,13 +109,11 @@ fn a_cron_job_for_a_host_agent_builds_with_its_host_tools_and_context() {belt_builds.load(Ordering::SeqCst) > 0,"the host belt was built");- assert!(- built- .agent- .visible_tool_specs_arc()- .iter()- .any(|spec| spec.name == "cron_host_marker")- );+ assert!(built+ .agent+ .visible_tool_specs_arc()+ .iter()+ .any(|spec| spec.name == "cron_host_marker"));}#[test]@@ -136,11 +134,9 @@ fn an_id_the_host_does_not_know_falls_back_to_the_registries() {host_agents::clear_if(&installed);let built = built.expect("the orchestrator builds from the registries");assert!(built.context.is_none());- assert!(- !built- .agent- .visible_tool_specs_arc()- .iter()- .any(|spec| spec.name == "cron_host_marker")- );+ assert!(!built+ .agent+ .visible_tool_specs_arc()+ .iter()+ .any(|spec| spec.name == "cron_host_marker"));}diff --git a/crates/openhuman-core/src/cron/scheduler_tests.rs b/crates/openhuman-core/src/cron/scheduler_tests.rsindex 15438c2c4e..d21da4a22d 100644--- a/crates/openhuman-core/src/cron/scheduler_tests.rs+++ b/crates/openhuman-core/src/cron/scheduler_tests.rs@@ -1,4 +1,4 @@-use super::agent_run::{EMPTY_AGENT_OUTPUT, build_agent_for_cron_job, run_agent_job};+use super::agent_run::{build_agent_for_cron_job, run_agent_job, EMPTY_AGENT_OUTPUT};use super::*;use crate::config::Config;use crate::security::SecurityPolicy;diff --git a/crates/openhuman-core/src/cron/schemas.rs b/crates/openhuman-core/src/cron/schemas.rsindex e168452cfa..16908bc7a8 100644--- a/crates/openhuman-core/src/cron/schemas.rs+++ b/crates/openhuman-core/src/cron/schemas.rs@@ -2,8 +2,8 @@ use crate::core::runtime::DispatchCtx;use serde::de::DeserializeOwned;use serde_json::{Map, Value};-use crate::core::Outcome;use crate::core::all::{ControllerFuture, RegisteredController};+use crate::core::Outcome;use crate::core::{ControllerSchema, FieldSchema, TypeSchema};use tinyflows_bus::schedule::types::{CronJobPatch, DeliveryConfig};diff --git a/crates/openhuman-core/src/cron/store_tests.rs b/crates/openhuman-core/src/cron/store_tests.rsindex 021e7aadb1..d55c73d810 100644--- a/crates/openhuman-core/src/cron/store_tests.rs+++ b/crates/openhuman-core/src/cron/store_tests.rs@@ -147,11 +147,9 @@ 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/cron/tools.rs b/crates/openhuman-core/src/cron/tools.rsindex 4de3e16a36..16b3ca473c 100644--- a/crates/openhuman-core/src/cron/tools.rs+++ b/crates/openhuman-core/src/cron/tools.rs@@ -13,7 +13,7 @@ mod runs;mod update;pub use add::CronAddTool;-pub use collapsed::{CRON_TOOL_NAME, CronTool};+pub use collapsed::{CronTool, CRON_TOOL_NAME};pub use list::CronListTool;pub use remove::CronRemoveTool;pub use run::CronRunTool;diff --git a/crates/openhuman-core/src/cron/tools/add.rs b/crates/openhuman-core/src/cron/tools/add.rsindex d10bae7c27..29d16ae965 100644--- a/crates/openhuman-core/src/cron/tools/add.rs+++ b/crates/openhuman-core/src/cron/tools/add.rs@@ -1,5 +1,5 @@use crate::config::Config;-use crate::cron::job_builder::{AgentJobInput, create_agent_job};+use crate::cron::job_builder::{create_agent_job, AgentJobInput};use crate::cron::origin::{current_job_origin, current_turn_may_skip_approval};use crate::security::SecurityPolicy;use crate::tools::schema_cache::static_schema;diff --git a/crates/openhuman-core/src/cron/tools/collapsed.rs b/crates/openhuman-core/src/cron/tools/collapsed.rsindex bb7752a45b..b690235484 100644--- a/crates/openhuman-core/src/cron/tools/collapsed.rs+++ b/crates/openhuman-core/src/cron/tools/collapsed.rs@@ -36,8 +36,8 @@ use super::{use crate::config::Config;use crate::security::policy::SecurityPolicy;use tinytools::collapse::{- CollapsedAction, any_external_effect, args_without_action, merge_action_schemas, resolve,- strictest_permission, unknown_action_message,+ any_external_effect, args_without_action, merge_action_schemas, resolve, strictest_permission,+ unknown_action_message, CollapsedAction,};use tinytools::{PermissionLevel, Tool, ToolCallOptions, ToolResult};