Implement cron job management tools and types
- Added `JobType`, `SessionTarget`, `Schedule`, `DeliveryConfig`, `CronJob`, `CronRun`, and `CronJobPatch` types in `src/cron/types.rs` for cron job configuration and management. - Introduced `CronAddTool`, `CronListTool`, `CronRemoveTool`, `CronRunTool`, `CronRunsTool`, and `CronUpdateTool` in `src/tools` for adding, listing, removing, running, and updating cron jobs. - Updated the `run` function in `src/daemon/mod.rs` to conditionally start the scheduler based on the cron configuration. - Modified command-line argument parsing in `src/lib.rs` and `src/main.rs` to support new cron job commands. - Enhanced the onboarding wizard in `src/onboard/wizard.rs` to include cron configuration. - Added tests for cron job tools to ensure functionality and error handling.
This commit is contained in:
parent
0ec46ac3d1
commit
fb2d1cea0b
24 changed files with 2682 additions and 638 deletions
|
|
@ -1,6 +1,12 @@
|
|||
pub mod browser;
|
||||
pub mod browser_open;
|
||||
pub mod composio;
|
||||
pub mod cron_add;
|
||||
pub mod cron_list;
|
||||
pub mod cron_remove;
|
||||
pub mod cron_run;
|
||||
pub mod cron_runs;
|
||||
pub mod cron_update;
|
||||
pub mod delegate;
|
||||
pub mod file_read;
|
||||
pub mod file_write;
|
||||
|
|
@ -21,6 +27,12 @@ pub mod traits;
|
|||
pub use browser::{BrowserTool, ComputerUseConfig};
|
||||
pub use browser_open::BrowserOpenTool;
|
||||
pub use composio::ComposioTool;
|
||||
pub use cron_add::CronAddTool;
|
||||
pub use cron_list::CronListTool;
|
||||
pub use cron_remove::CronRemoveTool;
|
||||
pub use cron_run::CronRunTool;
|
||||
pub use cron_runs::CronRunsTool;
|
||||
pub use cron_update::CronUpdateTool;
|
||||
pub use delegate::DelegateTool;
|
||||
pub use file_read::FileReadTool;
|
||||
pub use file_write::FileWriteTool;
|
||||
|
|
@ -40,7 +52,7 @@ pub use traits::Tool;
|
|||
#[allow(unused_imports)]
|
||||
pub use traits::{ToolResult, ToolSpec};
|
||||
|
||||
use crate::config::DelegateAgentConfig;
|
||||
use crate::config::{Config, DelegateAgentConfig};
|
||||
use crate::memory::Memory;
|
||||
use crate::runtime::{NativeRuntime, RuntimeAdapter};
|
||||
use crate::security::SecurityPolicy;
|
||||
|
|
@ -67,6 +79,7 @@ pub fn default_tools_with_runtime(
|
|||
/// Create full tool registry including memory tools and optional Composio
|
||||
#[allow(clippy::implicit_hasher, clippy::too_many_arguments)]
|
||||
pub fn all_tools(
|
||||
config: Arc<Config>,
|
||||
security: &Arc<SecurityPolicy>,
|
||||
memory: Arc<dyn Memory>,
|
||||
composio_key: Option<&str>,
|
||||
|
|
@ -76,9 +89,10 @@ pub fn all_tools(
|
|||
workspace_dir: &std::path::Path,
|
||||
agents: &HashMap<String, DelegateAgentConfig>,
|
||||
fallback_api_key: Option<&str>,
|
||||
config: &crate::config::Config,
|
||||
root_config: &crate::config::Config,
|
||||
) -> Vec<Box<dyn Tool>> {
|
||||
all_tools_with_runtime(
|
||||
config,
|
||||
security,
|
||||
Arc::new(NativeRuntime::new()),
|
||||
memory,
|
||||
|
|
@ -89,13 +103,14 @@ pub fn all_tools(
|
|||
workspace_dir,
|
||||
agents,
|
||||
fallback_api_key,
|
||||
config,
|
||||
root_config,
|
||||
)
|
||||
}
|
||||
|
||||
/// Create full tool registry including memory tools and optional Composio.
|
||||
#[allow(clippy::implicit_hasher, clippy::too_many_arguments)]
|
||||
pub fn all_tools_with_runtime(
|
||||
config: Arc<Config>,
|
||||
security: &Arc<SecurityPolicy>,
|
||||
runtime: Arc<dyn RuntimeAdapter>,
|
||||
memory: Arc<dyn Memory>,
|
||||
|
|
@ -106,16 +121,22 @@ pub fn all_tools_with_runtime(
|
|||
workspace_dir: &std::path::Path,
|
||||
agents: &HashMap<String, DelegateAgentConfig>,
|
||||
fallback_api_key: Option<&str>,
|
||||
config: &crate::config::Config,
|
||||
root_config: &crate::config::Config,
|
||||
) -> Vec<Box<dyn Tool>> {
|
||||
let mut tools: Vec<Box<dyn Tool>> = vec![
|
||||
Box::new(ShellTool::new(security.clone(), runtime)),
|
||||
Box::new(FileReadTool::new(security.clone())),
|
||||
Box::new(FileWriteTool::new(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())),
|
||||
Box::new(MemoryStoreTool::new(memory.clone())),
|
||||
Box::new(MemoryRecallTool::new(memory.clone())),
|
||||
Box::new(MemoryForgetTool::new(memory)),
|
||||
Box::new(ScheduleTool::new(security.clone(), config.clone())),
|
||||
Box::new(ScheduleTool::new(security.clone(), root_config.clone())),
|
||||
Box::new(GitOperationsTool::new(
|
||||
security.clone(),
|
||||
workspace_dir.to_path_buf(),
|
||||
|
|
@ -225,6 +246,7 @@ mod tests {
|
|||
let cfg = test_config(&tmp);
|
||||
|
||||
let tools = all_tools(
|
||||
Arc::new(Config::default()),
|
||||
&security,
|
||||
mem,
|
||||
None,
|
||||
|
|
@ -262,6 +284,7 @@ mod tests {
|
|||
let cfg = test_config(&tmp);
|
||||
|
||||
let tools = all_tools(
|
||||
Arc::new(Config::default()),
|
||||
&security,
|
||||
mem,
|
||||
None,
|
||||
|
|
@ -400,6 +423,7 @@ mod tests {
|
|||
);
|
||||
|
||||
let tools = all_tools(
|
||||
Arc::new(Config::default()),
|
||||
&security,
|
||||
mem,
|
||||
None,
|
||||
|
|
@ -431,6 +455,7 @@ mod tests {
|
|||
let cfg = test_config(&tmp);
|
||||
|
||||
let tools = all_tools(
|
||||
Arc::new(Config::default()),
|
||||
&security,
|
||||
mem,
|
||||
None,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue