Skip to content

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

chore: files changed crates/openhuman-core/src/cron/client.rs,crates/openhuman-core/src/cron/store.r

Steven Enamakelab02a01570a6
diff --git a/crates/openhuman-core/src/cron/client.rs b/crates/openhuman-core/src/cron/client.rs
index 2c3d95dd0c..55c3a985d1 100644
--- a/crates/openhuman-core/src/cron/client.rs
+++ b/crates/openhuman-core/src/cron/client.rs
@@ -17,9 +17,8 @@ use chrono::{DateTime, Duration, Utc};
use serde::{de::DeserializeOwned, Serialize};
use serde_json::Value;
use tinyflows_bus::schedule::{
- members, CheckOriginRequest, CheckPatchRequest, DeliveryConfig, JobOrigin, NextRunRequest,
- RunsCloserThanRequest, Schedule, SessionTarget, StoreBackend, StoreConfig, StoreOperation,
- StoreRequest, TooFrequent, ValidateScheduleRequest,
+ members, CheckOriginRequest, DeliveryConfig, JobOrigin, RunsCloserThanRequest, Schedule,
+ SessionTarget, StoreBackend, StoreConfig, StoreOperation, StoreRequest, TooFrequent,
};
use tinyflows_bus::schedule::{CronJob, CronJobPatch};
@@ -129,47 +128,6 @@ pub(crate) async fn check_origin_requirements(
call(config, members::CHECK_ORIGIN_REQUIREMENTS, (request,)).await
}
-/// `CheckPatch`: refuse a patch no store may apply to `job`.
-pub(crate) async fn check_patch(
- config: &Config,
- job: &CronJob,
- patch: &CronJobPatch,
-) -> Result<()> {
- let request = CheckPatchRequest {
- job: job.clone(),
- patch: patch.clone(),
- };
- call(config, members::CHECK_PATCH, (request,)).await
-}
-
-/// `NextRun`: the first occurrence of `schedule` strictly after `from`.
-pub(crate) async fn next_run(
- config: &Config,
- schedule: &Schedule,
- from: DateTime<Utc>,
-) -> Result<DateTime<Utc>> {
- let request = NextRunRequest {
- schedule: schedule.clone(),
- from,
- };
- call(config, members::NEXT_RUN, (request,)).await
-}
-
-/// `ValidateSchedule`; `agent` adds the agent-job cadence floor.
-pub(crate) async fn validate_schedule(
- config: &Config,
- schedule: &Schedule,
- now: DateTime<Utc>,
- agent: bool,
-) -> Result<()> {
- let request = ValidateScheduleRequest {
- schedule: schedule.clone(),
- now,
- agent,
- };
- call(config, members::VALIDATE_SCHEDULE, (request,)).await
-}
-
/// `RunsCloserThan`: the tightest pair of consecutive runs under `min_gap`.
pub(crate) async fn runs_closer_than(
config: &Config,
@@ -185,24 +143,6 @@ pub(crate) async fn runs_closer_than(
call(config, members::RUNS_CLOSER_THAN, (request,)).await
}
-/// `NormalizeExpression`: POSIX weekdays into the `cron` crate's numbering.
-pub(crate) async fn normalize_expression(config: &Config, expression: &str) -> Result<String> {
- call(config, members::NORMALIZE_EXPRESSION, (expression,)).await
-}
-
-/// `ScheduleCronExpression`: the cron expression a schedule has, if any.
-pub(crate) async fn schedule_cron_expression(
- config: &Config,
- schedule: &Schedule,
-) -> Result<Option<String>> {
- call(config, members::SCHEDULE_CRON_EXPRESSION, (schedule,)).await
-}
-
-/// `TruncateCronOutput`: output bounded to `MAX_CRON_OUTPUT_BYTES`.
-pub(crate) async fn truncate_cron_output(config: &Config, output: &str) -> Result<String> {
- call(config, members::TRUNCATE_CRON_OUTPUT, (output,)).await
-}
-
/// [`store`] for a synchronous caller (the cron store API is synchronous). The
/// acting scope is resolved here, on the caller's task, because the bridge
/// thread the call hops to carries no task context.
diff --git a/crates/openhuman-core/src/cron/store.rs b/crates/openhuman-core/src/cron/store.rs
index ae428f9836..f21fbc04c4 100644
--- a/crates/openhuman-core/src/cron/store.rs
+++ b/crates/openhuman-core/src/cron/store.rs
@@ -26,13 +26,6 @@ use tinyflows_bus::schedule::{AgentJobSpec, StoreOperation};
use super::client::store_blocking;
use super::limits;
-/// The cron database tinyflows used to write, imported on first use.
-pub fn legacy_db_path(config: &Config) -> std::path::PathBuf {
- crate::storage::import::tinyflows::legacy_jobs_db(&crate::core::runtime::agent_scope_dir(
- config,
- ))
-}
-
pub fn add_job(config: &Config, expression: &str, command: &str) -> Result<CronJob> {
let schedule = Schedule::Cron {
expr: expression.to_string(),
@@ -66,31 +59,6 @@ pub fn add_shell_job(
)
}
-#[allow(clippy::too_many_arguments)]
-pub fn add_agent_job(
- config: &Config,
- name: Option<String>,
- schedule: Schedule,
- prompt: &str,
- session_target: SessionTarget,
- model: Option<String>,
- delivery: Option<DeliveryConfig>,
- delete_after_run: bool,
-) -> Result<CronJob> {
- add_agent_job_with_definition(
- config,
- name,
- schedule,
- prompt,
- session_target,
- model,
- delivery,
- delete_after_run,
- None,
- true,
- )
-}
-
/// Like [`add_agent_job`] but accepts an optional built-in agent definition
/// ID and the initial enabled state.
#[allow(clippy::too_many_arguments)]
@@ -189,10 +157,6 @@ pub fn dedup_named_jobs(config: &Config) -> Result<usize> {
store_blocking(config, StoreOperation::Dedup)
}
-pub fn due_jobs(config: &Config, now: DateTime<Utc>) -> Result<Vec<CronJob>> {
- store_blocking(config, StoreOperation::Due { now })
-}
-
pub fn update_job(config: &Config, job_id: &str, patch: CronJobPatch) -> Result<CronJob> {
update_job_with_origin(config, job_id, patch, None)
}
@@ -271,23 +235,6 @@ pub fn record_last_run(
.map(|_| ())
}
-pub fn reschedule_after_run(
- config: &Config,
- job: &CronJob,
- success: bool,
- output: &str,
-) -> Result<()> {
- store_blocking::<serde_json::Value>(
- config,
- StoreOperation::Reschedule {
- job: job.clone(),
- success,
- output: output.to_string(),
- },
- )
- .map(|_| ())
-}
-
pub fn record_run(
config: &Config,
job_id: &str,