Skip to content

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

refactor(cron): extract cron tool registration into a helper

Steven Enamakeld09d02ae8cfc
diff --git a/crates/openhuman-core/src/cron/tools.rs b/crates/openhuman-core/src/cron/tools.rs
index 11ff3cd39e..16b3ca473c 100644
--- a/crates/openhuman-core/src/cron/tools.rs
+++ b/crates/openhuman-core/src/cron/tools.rs
@@ -19,3 +19,19 @@ pub use remove::CronRemoveTool;
pub use run::CronRunTool;
pub use runs::CronRunsTool;
pub use update::CronUpdateTool;
+
+/// Register the advertised scheduler and its replay-compatible operation aliases.
+pub(crate) fn tools(
+ config: std::sync::Arc<crate::config::Config>,
+ security: &std::sync::Arc<crate::security::SecurityPolicy>,
+) -> Vec<Box<dyn tinytools::Tool>> {
+ vec![
+ Box::new(CronTool::new(config.clone(), security.clone())),
+ Box::new(CronAddTool::new(config.clone(), security.clone())),
+ Box::new(CronListTool::new(config.clone())),
+ Box::new(CronRemoveTool::new(config.clone())),
+ Box::new(CronUpdateTool::new(config.clone(), security.clone())),
+ Box::new(CronRunTool::new(config.clone())),
+ Box::new(CronRunsTool::new(config)),
+ ]
+}
diff --git a/crates/openhuman-core/src/tools/mod.rs b/crates/openhuman-core/src/tools/mod.rs
index faf89a4252..8323186741 100644
--- a/crates/openhuman-core/src/tools/mod.rs
+++ b/crates/openhuman-core/src/tools/mod.rs
@@ -21,7 +21,6 @@ pub use crate::agent::orchestration::tools::*;
pub use crate::agent::tools::*;
pub use crate::config::tools::*;
pub use crate::config::workspace::tools::*;
-pub use crate::cron::tools::*;
#[cfg(feature = "modules")]
pub use crate::desktop::control::tools::*;
pub use crate::desktop::dashboard::tools::*;
diff --git a/crates/openhuman-core/src/tools/ops.rs b/crates/openhuman-core/src/tools/ops.rs
index 120572df8b..6be4ed35fd 100644
--- a/crates/openhuman-core/src/tools/ops.rs
+++ b/crates/openhuman-core/src/tools/ops.rs
@@ -175,16 +175,9 @@ pub fn all_tools_with_runtime(
Box::new(ResolveTimeTool::new()),
Box::new(DetectToolsTool::new()),
Box::new(InstallToolTool::new(security.clone())),
- // The compact, advertised scheduler surface. Keep the six legacy
- // tools registered below as hidden aliases so saved transcripts and
- // skills remain replayable.
- Box::new(CronTool::new(config.clone(), security.clone())),
- Box::new(CronAddTool::new(config.clone(), security.clone())),
- Box::new(CronListTool::new(config.clone())),
- Box::new(CronRemoveTool::new(config.clone())),
- Box::new(CronUpdateTool::new(config.clone(), security.clone())),
- Box::new(CronRunTool::new(config.clone())),
- Box::new(CronRunsTool::new(config.clone())),
+ ];
+ tools.extend(crate::cron::tools::tools(config.clone(), security));
+ tools.extend(vec![
// Agent-first Workflow authoring (issue B4): validates a candidate
// graph and returns a proposal summary — never creates/enables a
// flow itself. Only the chat UI's WorkflowProposalCard "Save &
@@ -309,7 +302,7 @@ pub fn all_tools_with_runtime(
Box::new(FlowMemoryRecallTool::new()),
#[cfg(feature = "flows")]
Box::new(FlowMemoryRememberTool::new(security.clone())),
- ];
+ ]);
#[cfg(feature = "web3")]
tools.extend(crate::web3::wallet::registration::tools());
tools.extend(vec![