The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
refactor(cron): move shell authorization to callers
Steven Enamakel7dba98172dd0
diff --git a/crates/openhuman-core/src/cron/ops.rs b/crates/openhuman-core/src/cron/ops.rsindex e7358651e2..9eddeb795f 100644--- a/crates/openhuman-core/src/cron/ops.rs+++ b/crates/openhuman-core/src/cron/ops.rs@@ -42,25 +42,17 @@ pub(crate) fn try_acquire_run(job_id: &str) -> Option<ActiveRunGuard> {})}-pub async fn add_once(config: &Config, delay: &str, command: &str) -> Result<CronJob> {+pub fn add_once(config: &Config, delay: &str, command: &str) -> Result<CronJob> {let duration = parse_human_delay(delay)?;let at = chrono::Utc::now() + duration;- add_once_at(config, at, command).await+ add_once_at(config, at, command)}-pub async fn add_once_at(+pub fn add_once_at(config: &Config,at: chrono::DateTime<chrono::Utc>,command: &str,) -> Result<CronJob> {- let security = SecurityPolicy::from_config(- &config.autonomy,- &config.workspace_dir,- &config.action_dir,- );- crate::cron::scheduler::shell_job::authorize_shell_command(config, &security, command)- .await- .map_err(anyhow::Error::msg)?;let schedule = Schedule::At { at };add_shell_job(config, None, schedule, command)}diff --git a/crates/openhuman-core/src/cron/schemas.rs b/crates/openhuman-core/src/cron/schemas.rsindex 944ac9da2f..7ae80f6f14 100644--- a/crates/openhuman-core/src/cron/schemas.rs+++ b/crates/openhuman-core/src/cron/schemas.rs@@ -351,6 +351,17 @@ fn handle_add(params: Map<String, Value>) -> ControllerFuture {let job = match job_type {"shell" => {let cmd = command.ok_or("'command' is required for shell jobs")?;+ let security = crate::security::SecurityPolicy::from_config(+ &config.autonomy,+ &config.workspace_dir,+ &config.action_dir,+ );+ crate::cron::scheduler::shell_job::authorize_shell_command(+ &config,+ &security,+ &cmd,+ )+ .await?;crate::cron::store::add_shell_job(&config, name, schedule, &cmd).map_err(|e| e.to_string())?}diff --git a/crates/openhuman-core/src/tools/impl/system/schedule.rs b/crates/openhuman-core/src/tools/impl/system/schedule.rsindex 5b0610ed74..20ac18820a 100644--- a/crates/openhuman-core/src/tools/impl/system/schedule.rs+++ b/crates/openhuman-core/src/tools/impl/system/schedule.rs@@ -367,6 +367,15 @@ impl ScheduleTool {// ── Shell job (command provided) ─────────────────────────────let command = command.unwrap();+ if let Err(reason) = crate::cron::scheduler::shell_job::authorize_shell_command(+ &self.config,+ &self.security,+ command,+ )+ .await+ {+ return Ok(ToolResult::error(reason));+ }if let Some(value) = expression {let job = cron::add_job(&self.config, value, command)?;@@ -380,7 +389,7 @@ impl ScheduleTool {}if let Some(value) = delay {- let job = cron::add_once(&self.config, value, command).await?;+ let job = cron::add_once(&self.config, value, command)?;return Ok(ToolResult::success(format!("Created one-shot job {} (runs at: {}, cmd: {})",job.id,@@ -394,7 +403,7 @@ impl ScheduleTool {.map_err(|error| anyhow::anyhow!("Invalid run_at timestamp: {error}"))?.with_timezone(&Utc);- let job = cron::add_once_at(&self.config, run_at_parsed, command).await?;+ let job = cron::add_once_at(&self.config, run_at_parsed, command)?;Ok(ToolResult::success(format!("Created one-shot job {} (runs at: {}, cmd: {})",job.id,