add temporal service to builds. (#2842)

This commit is contained in:
Max Novich
2025-06-10 08:17:45 -07:00
committed by GitHub
parent f23fc192e4
commit cb6a819de4
44 changed files with 5145 additions and 180 deletions
+4 -4
View File
@@ -1,5 +1,5 @@
use goose::agents::Agent;
use goose::scheduler::Scheduler;
use goose::scheduler_trait::SchedulerTrait;
use std::sync::Arc;
use tokio::sync::Mutex;
@@ -9,7 +9,7 @@ pub type AgentRef = Arc<Agent>;
pub struct AppState {
agent: Option<AgentRef>,
pub secret_key: String,
pub scheduler: Arc<Mutex<Option<Arc<Scheduler>>>>,
pub scheduler: Arc<Mutex<Option<Arc<dyn SchedulerTrait>>>>,
}
impl AppState {
@@ -27,12 +27,12 @@ impl AppState {
.ok_or_else(|| anyhow::anyhow!("Agent needs to be created first."))
}
pub async fn set_scheduler(&self, sched: Arc<Scheduler>) {
pub async fn set_scheduler(&self, sched: Arc<dyn SchedulerTrait>) {
let mut guard = self.scheduler.lock().await;
*guard = Some(sched);
}
pub async fn scheduler(&self) -> Result<Arc<Scheduler>, anyhow::Error> {
pub async fn scheduler(&self) -> Result<Arc<dyn SchedulerTrait>, anyhow::Error> {
self.scheduler
.lock()
.await