huskies: merge 558_story_matrix_bot_can_run_on_the_gateway_to_manage_multiple_projects_from_one_chat

This commit is contained in:
dave
2026-04-14 10:01:04 +00:00
parent 28777b0c77
commit d824dc4b73
6 changed files with 239 additions and 4 deletions
@@ -8,7 +8,7 @@ use std::collections::{HashMap, HashSet};
use std::path::PathBuf;
use std::sync::Arc;
use tokio::sync::Mutex as TokioMutex;
use tokio::sync::{mpsc, oneshot};
use tokio::sync::{RwLock, mpsc, oneshot};
use super::history::ConversationHistory;
@@ -59,6 +59,12 @@ pub struct BotContext {
pub transport: Arc<dyn ChatTransport>,
/// Persistent store for pending deferred-start timers.
pub timer_store: Arc<TimerStore>,
/// In gateway mode: the currently active project (shared with the gateway HTTP handler).
/// `None` in standalone single-project mode.
pub gateway_active_project: Option<Arc<RwLock<String>>>,
/// In gateway mode: valid project names accepted by the `switch` command.
/// Empty in standalone mode.
pub gateway_projects: Vec<String>,
}
// ---------------------------------------------------------------------------
@@ -110,6 +116,8 @@ mod tests {
timer_store: Arc::new(crate::chat::timer::TimerStore::load(
std::path::PathBuf::from("/tmp/timers.json"),
)),
gateway_active_project: None,
gateway_projects: vec![],
};
// Clone must work (required by Matrix SDK event handler injection).
let _cloned = ctx.clone();