huskies: merge 627_refactor_migrate_slack_discord_and_whatsapp_transports_to_services_bundle
This commit is contained in:
+3
-17
@@ -565,7 +565,6 @@ async fn main() -> Result<(), std::io::Error> {
|
||||
// bundle (AppContext + Matrix bot) and the webhook-based transports.
|
||||
let perm_rx = Arc::new(tokio::sync::Mutex::new(perm_rx));
|
||||
let perm_rx_for_whatsapp = Arc::clone(&perm_rx);
|
||||
let perm_rx_for_slack = Arc::clone(&perm_rx);
|
||||
let perm_rx_for_discord = Arc::clone(&perm_rx);
|
||||
|
||||
// Capture project root, agents Arc, and reconciliation sender before ctx
|
||||
@@ -666,30 +665,17 @@ async fn main() -> Result<(), std::io::Error> {
|
||||
let transport = Arc::new(chat::transport::slack::SlackTransport::new(
|
||||
cfg.slack_bot_token.clone().unwrap_or_default(),
|
||||
));
|
||||
let bot_name = cfg
|
||||
.display_name
|
||||
.clone()
|
||||
.unwrap_or_else(|| "Assistant".to_string());
|
||||
let root = startup_root.clone().unwrap();
|
||||
let history = chat::transport::slack::load_slack_history(&root);
|
||||
let channel_ids: std::collections::HashSet<String> =
|
||||
cfg.slack_channel_ids.iter().cloned().collect();
|
||||
Arc::new(chat::transport::slack::SlackWebhookContext {
|
||||
services: Arc::clone(&services),
|
||||
signing_secret: cfg.slack_signing_secret.clone().unwrap_or_default(),
|
||||
transport,
|
||||
project_root: root,
|
||||
agents: Arc::clone(&startup_agents),
|
||||
bot_name,
|
||||
bot_user_id: "slack-bot".to_string(),
|
||||
ambient_rooms: Arc::new(std::sync::Mutex::new(std::collections::HashSet::new())),
|
||||
history: std::sync::Arc::new(tokio::sync::Mutex::new(history)),
|
||||
history_size: cfg.history_size,
|
||||
channel_ids,
|
||||
perm_rx: perm_rx_for_slack,
|
||||
pending_perm_replies: Arc::new(tokio::sync::Mutex::new(
|
||||
std::collections::HashMap::new(),
|
||||
)),
|
||||
permission_timeout_secs: cfg.permission_timeout_secs,
|
||||
})
|
||||
});
|
||||
|
||||
@@ -744,7 +730,7 @@ async fn main() -> Result<(), std::io::Error> {
|
||||
Some(Arc::new(BotShutdownNotifier::new(
|
||||
Arc::clone(&ctx.transport) as Arc<dyn crate::chat::ChatTransport>,
|
||||
channels,
|
||||
ctx.bot_name.clone(),
|
||||
ctx.services.bot_name.clone(),
|
||||
)))
|
||||
} else if let Some(ref ctx) = discord_ctx {
|
||||
let channels: Vec<String> = ctx.channel_ids.iter().cloned().collect();
|
||||
@@ -785,7 +771,7 @@ async fn main() -> Result<(), std::io::Error> {
|
||||
}
|
||||
if let Some(ref ctx) = slack_ctx {
|
||||
let transport = Arc::clone(&ctx.transport) as Arc<dyn crate::chat::ChatTransport>;
|
||||
let bot_name = ctx.bot_name.clone();
|
||||
let bot_name = ctx.services.bot_name.clone();
|
||||
let channels: Vec<String> = ctx.channel_ids.iter().cloned().collect();
|
||||
tokio::spawn(async move {
|
||||
if channels.is_empty() {
|
||||
|
||||
Reference in New Issue
Block a user