Add experimental thread job scheduler for /loop

This commit is contained in:
Eric Traut
2026-03-30 15:30:34 -06:00
parent 716f7b0428
commit a02c2cd50c
52 changed files with 2291 additions and 113 deletions
+21
View File
@@ -26,6 +26,7 @@ use std::path::PathBuf;
use tokio::sync::Mutex;
use tokio::sync::watch;
use crate::jobs::ThreadJob;
use crate::state_db::StateDbHandle;
#[derive(Clone, Debug)]
@@ -236,6 +237,26 @@ impl CodexThread {
Ok(*guard)
}
pub async fn create_job(
&self,
cron_expression: String,
prompt: String,
run_once: bool,
) -> Result<ThreadJob, String> {
self.codex
.session
.create_job(cron_expression, prompt, run_once)
.await
}
pub async fn delete_job(&self, id: &str) -> bool {
self.codex.session.delete_job(id).await
}
pub async fn list_jobs(&self) -> Vec<ThreadJob> {
self.codex.session.list_jobs().await
}
}
fn pending_message_input_item(message: &ResponseItem) -> CodexResult<ResponseInputItem> {