Skip to content

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

feat(cron): replace inline schedule logic with tinyflows-schedule crate

Steven Enamakel2b6db08d8040
diff --git a/crates/openhuman-core/Cargo.toml b/crates/openhuman-core/Cargo.toml
index cfb3592a42..8c9cfc094f 100644
--- a/crates/openhuman-core/Cargo.toml
+++ b/crates/openhuman-core/Cargo.toml
@@ -80,6 +80,10 @@ crate-type = ["rlib"]
# Optional: exclusive to the default-ON `flows` feature (#4797). A slim build
# without `flows` drops this crate and its `jaq-*` JSON-query stack entirely.
tinyflows = { version = "0.8", features = ["mock"], optional = true }
+# Schedule model + pure next-run logic for the `cron::` domain (cron expressions,
+# time zones, active hours, cadence floor). Unconditional: the cron scheduler is
+# not behind the `flows` gate. Runtime, store and config stay in `cron::`.
+tinyflows-schedule = { path = "../../vendor/tinyflows/crates/tinyflows-schedule" }
# The saved-flow catalog and its SQLite backend, split out of this crate's
# `flows::` domain so a second host storing workflows does not have to reinvent
# them. `tinyflows-catalog` is the model (flows, revisions, runs, drafts,
@@ -425,7 +429,6 @@ futures = "0.3"
rusqlite = { version = "=0.40.2", features = ["bundled"] }
chrono = { version = "0.4", features = ["serde"] }
iana-time-zone = "0.1"
-cron = "0.12"
futures-util = "0.3"
directories = "6"
toml = "1.0"
@@ -436,7 +439,6 @@ tracing-subscriber = { version = "0.3", default-features = false, features = ["f
tracing-appender = { version = "0.2", optional = true }
urlencoding = "2.1"
thiserror = "2.0"
-chrono-tz = "0.10"
dotenvy = "0.15"
regex = "1.10"
# Multi-pattern fixed-string DFA matcher used by `routing::quality` for
diff --git a/crates/openhuman-core/src/cron/mod.rs b/crates/openhuman-core/src/cron/mod.rs
index b55a2390e7..aed59ca48b 100644
--- a/crates/openhuman-core/src/cron/mod.rs
+++ b/crates/openhuman-core/src/cron/mod.rs
@@ -11,19 +11,22 @@ pub mod scheduler_gate;
pub mod bus;
pub mod ops;
-mod schedule;
mod schemas;
pub mod seed;
mod store;
pub mod tools;
-mod types;
pub mod scheduler;
pub use ops as rpc;
pub use ops::{add_once, add_once_at, parse_human_delay, pause_job, resume_job, update_cron_job};
+// Pure scheduling logic lives in `tinyflows-schedule`; the host keeps the
+// scheduler runtime, store, config and RPC. `schedule`/`types` stay addressable
+// as `crate::cron::{schedule,types}` for the modules beneath `cron`.
+use tinyflows_schedule::{schedule, types};
+
#[allow(unused_imports)]
-pub use schedule::{
+pub use tinyflows_schedule::schedule::{
next_run_for_schedule, normalize_expression, runs_closer_than, schedule_cron_expression,
validate_agent_schedule, validate_schedule, TooFrequent, MIN_AGENT_JOB_INTERVAL,
};
@@ -38,6 +41,6 @@ pub use store::{
get_job, list_jobs, list_runs, record_last_run, record_run, remove_job, reschedule_after_run,
update_job,
};
-pub use types::{
+pub use tinyflows_schedule::types::{
ActiveHours, CronJob, CronJobPatch, CronRun, DeliveryConfig, JobType, Schedule, SessionTarget,
};