Skip to content

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

feat(cron): expose a unified scheduler tool

Steven Enamakeldb90a0ab307f
diff --git a/src/openhuman/cron/tools.rs b/src/openhuman/cron/tools.rs
index 709712b1f5..11ff3cd39e 100644
--- a/src/openhuman/cron/tools.rs
+++ b/src/openhuman/cron/tools.rs
@@ -1,4 +1,11 @@
+//! Agent tools for the cron scheduler.
+//!
+//! The six per-operation tools are the implementation; [`CronTool`] is what the
+//! model sees. See [`collapsed`] for why they are separate and why the six stay
+//! registered.
+
mod add;
+mod collapsed;
mod list;
mod remove;
mod run;
@@ -6,6 +13,7 @@ mod runs;
mod update;
pub use add::CronAddTool;
+pub use collapsed::{CronTool, CRON_TOOL_NAME};
pub use list::CronListTool;
pub use remove::CronRemoveTool;
pub use run::CronRunTool;
diff --git a/src/openhuman/cron/tools/add.rs b/src/openhuman/cron/tools/add.rs
index efe2e75bb1..a66178445a 100644
--- a/src/openhuman/cron/tools/add.rs
+++ b/src/openhuman/cron/tools/add.rs
@@ -1,7 +1,7 @@
use crate::openhuman::config::Config;
use crate::openhuman::cron::{self, DeliveryConfig, JobType, Schedule, SessionTarget};
use crate::openhuman::security::SecurityPolicy;
-use crate::openhuman::tools::traits::{PermissionLevel, Tool, ToolCallOptions, ToolResult};
+use crate::openhuman::tools::traits::{PermissionLevel, Tool, ToolCallOptions, ToolExposure, ToolResult};
use async_trait::async_trait;
use serde_json::json;
use std::sync::Arc;
@@ -93,6 +93,14 @@ impl CronAddTool {
#[async_trait]
impl Tool for CronAddTool {
+ /// Superseded by the `cron` tool, which dispatches every scheduler
+ /// operation on one `action` field. Kept registered and dispatchable so a
+ /// replayed transcript or a saved skill naming `cron_*` keeps working;
+ /// hidden from the wire so six schemas do not ship where one does.
+ fn exposure(&self) -> ToolExposure {
+ ToolExposure::Hidden
+ }
+
fn name(&self) -> &str {
"cron_add"
}
diff --git a/src/openhuman/cron/tools/list.rs b/src/openhuman/cron/tools/list.rs
index e9076ed40c..da4df3e9f2 100644
--- a/src/openhuman/cron/tools/list.rs
+++ b/src/openhuman/cron/tools/list.rs
@@ -1,7 +1,7 @@
use crate::openhuman::config::Config;
use crate::openhuman::cron;
use crate::openhuman::cron::CronJob;
-use crate::openhuman::tools::traits::{Tool, ToolCallOptions, ToolResult};
+use crate::openhuman::tools::traits::{Tool, ToolCallOptions, ToolExposure, ToolResult};
use async_trait::async_trait;
use serde_json::json;
use std::fmt::Write as _;
@@ -63,6 +63,14 @@ impl CronListTool {
#[async_trait]
impl Tool for CronListTool {
+ /// Superseded by the `cron` tool, which dispatches every scheduler
+ /// operation on one `action` field. Kept registered and dispatchable so a
+ /// replayed transcript or a saved skill naming `cron_*` keeps working;
+ /// hidden from the wire so six schemas do not ship where one does.
+ fn exposure(&self) -> ToolExposure {
+ ToolExposure::Hidden
+ }
+
fn name(&self) -> &str {
"cron_list"
}
diff --git a/src/openhuman/cron/tools/remove.rs b/src/openhuman/cron/tools/remove.rs
index c136a178ca..558b6ad523 100644
--- a/src/openhuman/cron/tools/remove.rs
+++ b/src/openhuman/cron/tools/remove.rs
@@ -1,6 +1,6 @@
use crate::openhuman::config::Config;
use crate::openhuman::cron;
-use crate::openhuman::tools::traits::{PermissionLevel, Tool, ToolResult};
+use crate::openhuman::tools::traits::{PermissionLevel, Tool, ToolExposure, ToolResult};
use async_trait::async_trait;
use serde_json::json;
use std::sync::Arc;
@@ -17,6 +17,14 @@ impl CronRemoveTool {
#[async_trait]
impl Tool for CronRemoveTool {
+ /// Superseded by the `cron` tool, which dispatches every scheduler
+ /// operation on one `action` field. Kept registered and dispatchable so a
+ /// replayed transcript or a saved skill naming `cron_*` keeps working;
+ /// hidden from the wire so six schemas do not ship where one does.
+ fn exposure(&self) -> ToolExposure {
+ ToolExposure::Hidden
+ }
+
fn name(&self) -> &str {
"cron_remove"
}
diff --git a/src/openhuman/cron/tools/run.rs b/src/openhuman/cron/tools/run.rs
index 104d3c7c8a..a42f2ee56c 100644
--- a/src/openhuman/cron/tools/run.rs
+++ b/src/openhuman/cron/tools/run.rs
@@ -1,6 +1,6 @@
use crate::openhuman::config::Config;
use crate::openhuman::cron;
-use crate::openhuman::tools::traits::{PermissionLevel, Tool, ToolCallOptions, ToolResult};
+use crate::openhuman::tools::traits::{PermissionLevel, Tool, ToolCallOptions, ToolExposure, ToolResult};
use async_trait::async_trait;
use chrono::Utc;
use serde_json::json;
@@ -18,6 +18,14 @@ impl CronRunTool {
#[async_trait]
impl Tool for CronRunTool {
+ /// Superseded by the `cron` tool, which dispatches every scheduler
+ /// operation on one `action` field. Kept registered and dispatchable so a
+ /// replayed transcript or a saved skill naming `cron_*` keeps working;
+ /// hidden from the wire so six schemas do not ship where one does.
+ fn exposure(&self) -> ToolExposure {
+ ToolExposure::Hidden
+ }
+
fn name(&self) -> &str {
"cron_run"
}
diff --git a/src/openhuman/cron/tools/runs.rs b/src/openhuman/cron/tools/runs.rs
index 53d70c3504..1abe455a0b 100644
--- a/src/openhuman/cron/tools/runs.rs
+++ b/src/openhuman/cron/tools/runs.rs
@@ -1,6 +1,6 @@
use crate::openhuman::config::Config;
use crate::openhuman::cron;
-use crate::openhuman::tools::traits::{Tool, ToolCallOptions, ToolResult};
+use crate::openhuman::tools::traits::{Tool, ToolCallOptions, ToolExposure, ToolResult};
use async_trait::async_trait;
use serde::Serialize;
use serde_json::json;
@@ -32,6 +32,14 @@ struct RunView {
#[async_trait]
impl Tool for CronRunsTool {
+ /// Superseded by the `cron` tool, which dispatches every scheduler
+ /// operation on one `action` field. Kept registered and dispatchable so a
+ /// replayed transcript or a saved skill naming `cron_*` keeps working;
+ /// hidden from the wire so six schemas do not ship where one does.
+ fn exposure(&self) -> ToolExposure {
+ ToolExposure::Hidden
+ }
+
fn name(&self) -> &str {
"cron_runs"
}
diff --git a/src/openhuman/cron/tools/update.rs b/src/openhuman/cron/tools/update.rs
index 1c3a2bdaa3..e3710a1f5b 100644
--- a/src/openhuman/cron/tools/update.rs
+++ b/src/openhuman/cron/tools/update.rs
@@ -1,7 +1,7 @@
use crate::openhuman::config::Config;
use crate::openhuman::cron::{self, CronJobPatch};
use crate::openhuman::security::SecurityPolicy;
-use crate::openhuman::tools::traits::{PermissionLevel, Tool, ToolCallOptions, ToolResult};
+use crate::openhuman::tools::traits::{PermissionLevel, Tool, ToolCallOptions, ToolExposure, ToolResult};
use async_trait::async_trait;
use serde_json::json;
use std::sync::Arc;
@@ -19,6 +19,14 @@ impl CronUpdateTool {
#[async_trait]
impl Tool for CronUpdateTool {
+ /// Superseded by the `cron` tool, which dispatches every scheduler
+ /// operation on one `action` field. Kept registered and dispatchable so a
+ /// replayed transcript or a saved skill naming `cron_*` keeps working;
+ /// hidden from the wire so six schemas do not ship where one does.
+ fn exposure(&self) -> ToolExposure {
+ ToolExposure::Hidden
+ }
+
fn name(&self) -> &str {
"cron_update"
}