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
30
src/main.rs
30
src/main.rs
|
|
@ -136,9 +136,9 @@ enum Commands {
|
|||
#[arg(long)]
|
||||
model: Option<String>,
|
||||
|
||||
/// Temperature (0.0 - 2.0); defaults to config default_temperature
|
||||
#[arg(short, long)]
|
||||
temperature: Option<f64>,
|
||||
/// Temperature (0.0 - 2.0)
|
||||
#[arg(short, long, default_value = "0.7")]
|
||||
temperature: f64,
|
||||
|
||||
/// Attach a peripheral (board:path, e.g. nucleo-f401re:/dev/ttyACM0)
|
||||
#[arg(long)]
|
||||
|
|
@ -250,6 +250,23 @@ enum CronCommands {
|
|||
Add {
|
||||
/// Cron expression
|
||||
expression: String,
|
||||
/// Optional IANA timezone (e.g. America/Los_Angeles)
|
||||
#[arg(long)]
|
||||
tz: Option<String>,
|
||||
/// Command to run
|
||||
command: String,
|
||||
},
|
||||
/// Add a one-shot scheduled task at an RFC3339 timestamp
|
||||
AddAt {
|
||||
/// One-shot timestamp in RFC3339 format
|
||||
at: String,
|
||||
/// Command to run
|
||||
command: String,
|
||||
},
|
||||
/// Add a fixed-interval scheduled task
|
||||
AddEvery {
|
||||
/// Interval in milliseconds
|
||||
every_ms: u64,
|
||||
/// Command to run
|
||||
command: String,
|
||||
},
|
||||
|
|
@ -412,10 +429,9 @@ async fn main() -> Result<()> {
|
|||
model,
|
||||
temperature,
|
||||
peripheral,
|
||||
} => {
|
||||
let temp = temperature.unwrap_or(config.default_temperature);
|
||||
agent::run(config, message, provider, model, temp, peripheral).await
|
||||
}
|
||||
} => agent::run(config, message, provider, model, temperature, peripheral)
|
||||
.await
|
||||
.map(|_| ()),
|
||||
|
||||
Commands::Gateway { port, host } => {
|
||||
if port == 0 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue