Fixing build/test errors in master/
This commit is contained in:
File diff suppressed because it is too large
Load Diff
+35
-47
@@ -4,12 +4,12 @@
|
|||||||
|
|
||||||
mod agent_log;
|
mod agent_log;
|
||||||
mod agents;
|
mod agents;
|
||||||
|
mod chat;
|
||||||
mod config;
|
mod config;
|
||||||
mod http;
|
mod http;
|
||||||
mod io;
|
mod io;
|
||||||
mod llm;
|
mod llm;
|
||||||
pub mod log_buffer;
|
pub mod log_buffer;
|
||||||
mod chat;
|
|
||||||
pub mod rebuild;
|
pub mod rebuild;
|
||||||
mod state;
|
mod state;
|
||||||
mod store;
|
mod store;
|
||||||
@@ -17,6 +17,7 @@ mod workflow;
|
|||||||
mod worktree;
|
mod worktree;
|
||||||
|
|
||||||
use crate::agents::AgentPool;
|
use crate::agents::AgentPool;
|
||||||
|
use crate::chat::transport::whatsapp::WhatsAppConversationHistory;
|
||||||
use crate::http::build_routes;
|
use crate::http::build_routes;
|
||||||
use crate::http::context::AppContext;
|
use crate::http::context::AppContext;
|
||||||
use crate::http::{remove_port_file, resolve_port, write_port_file};
|
use crate::http::{remove_port_file, resolve_port, write_port_file};
|
||||||
@@ -116,17 +117,11 @@ async fn main() -> Result<(), std::io::Error> {
|
|||||||
// directory. We do not create directories from the command line.
|
// directory. We do not create directories from the command line.
|
||||||
if let Some(ref path) = explicit_path {
|
if let Some(ref path) = explicit_path {
|
||||||
if !path.exists() {
|
if !path.exists() {
|
||||||
eprintln!(
|
eprintln!("error: path does not exist: {}", path.display());
|
||||||
"error: path does not exist: {}",
|
|
||||||
path.display()
|
|
||||||
);
|
|
||||||
std::process::exit(1);
|
std::process::exit(1);
|
||||||
}
|
}
|
||||||
if !path.is_dir() {
|
if !path.is_dir() {
|
||||||
eprintln!(
|
eprintln!("error: path is not a directory: {}", path.display());
|
||||||
"error: path is not a directory: {}",
|
|
||||||
path.display()
|
|
||||||
);
|
|
||||||
std::process::exit(1);
|
std::process::exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -276,24 +271,23 @@ async fn main() -> Result<(), std::io::Error> {
|
|||||||
.filter(|cfg| cfg.transport == "whatsapp")
|
.filter(|cfg| cfg.transport == "whatsapp")
|
||||||
.map(|cfg| {
|
.map(|cfg| {
|
||||||
let provider = cfg.whatsapp_provider.clone();
|
let provider = cfg.whatsapp_provider.clone();
|
||||||
let transport: Arc<dyn crate::chat::ChatTransport> =
|
let transport: Arc<dyn crate::chat::ChatTransport> = if provider == "twilio" {
|
||||||
if provider == "twilio" {
|
Arc::new(chat::transport::whatsapp::TwilioWhatsAppTransport::new(
|
||||||
Arc::new(chat::transport::whatsapp::TwilioWhatsAppTransport::new(
|
cfg.twilio_account_sid.clone().unwrap_or_default(),
|
||||||
cfg.twilio_account_sid.clone().unwrap_or_default(),
|
cfg.twilio_auth_token.clone().unwrap_or_default(),
|
||||||
cfg.twilio_auth_token.clone().unwrap_or_default(),
|
cfg.twilio_whatsapp_number.clone().unwrap_or_default(),
|
||||||
cfg.twilio_whatsapp_number.clone().unwrap_or_default(),
|
))
|
||||||
))
|
} else {
|
||||||
} else {
|
let template_name = cfg
|
||||||
let template_name = cfg
|
.whatsapp_notification_template
|
||||||
.whatsapp_notification_template
|
.clone()
|
||||||
.clone()
|
.unwrap_or_else(|| "pipeline_notification".to_string());
|
||||||
.unwrap_or_else(|| "pipeline_notification".to_string());
|
Arc::new(chat::transport::whatsapp::WhatsAppTransport::new(
|
||||||
Arc::new(chat::transport::whatsapp::WhatsAppTransport::new(
|
cfg.whatsapp_phone_number_id.clone().unwrap_or_default(),
|
||||||
cfg.whatsapp_phone_number_id.clone().unwrap_or_default(),
|
cfg.whatsapp_access_token.clone().unwrap_or_default(),
|
||||||
cfg.whatsapp_access_token.clone().unwrap_or_default(),
|
template_name,
|
||||||
template_name,
|
))
|
||||||
))
|
};
|
||||||
};
|
|
||||||
let bot_name = cfg
|
let bot_name = cfg
|
||||||
.display_name
|
.display_name
|
||||||
.clone()
|
.clone()
|
||||||
@@ -363,17 +357,16 @@ async fn main() -> Result<(), std::io::Error> {
|
|||||||
// • WhatsApp: active senders are tracked at runtime in ambient_rooms.
|
// • WhatsApp: active senders are tracked at runtime in ambient_rooms.
|
||||||
// We keep the WhatsApp context Arc so we can read the rooms at shutdown.
|
// We keep the WhatsApp context Arc so we can read the rooms at shutdown.
|
||||||
// • Matrix: the bot task manages its own announcement via matrix_shutdown_tx.
|
// • Matrix: the bot task manages its own announcement via matrix_shutdown_tx.
|
||||||
let bot_shutdown_notifier: Option<Arc<BotShutdownNotifier>> =
|
let bot_shutdown_notifier: Option<Arc<BotShutdownNotifier>> = if let Some(ref ctx) = slack_ctx {
|
||||||
if let Some(ref ctx) = slack_ctx {
|
let channels: Vec<String> = ctx.channel_ids.iter().cloned().collect();
|
||||||
let channels: Vec<String> = ctx.channel_ids.iter().cloned().collect();
|
Some(Arc::new(BotShutdownNotifier::new(
|
||||||
Some(Arc::new(BotShutdownNotifier::new(
|
Arc::clone(&ctx.transport) as Arc<dyn crate::chat::ChatTransport>,
|
||||||
Arc::clone(&ctx.transport) as Arc<dyn crate::chat::ChatTransport>,
|
channels,
|
||||||
channels,
|
ctx.bot_name.clone(),
|
||||||
ctx.bot_name.clone(),
|
)))
|
||||||
)))
|
} else {
|
||||||
} else {
|
None
|
||||||
None
|
};
|
||||||
};
|
|
||||||
// Retain a reference to the WhatsApp context for shutdown notifications.
|
// Retain a reference to the WhatsApp context for shutdown notifications.
|
||||||
// At shutdown time we read ambient_rooms to get the current set of active senders.
|
// At shutdown time we read ambient_rooms to get the current set of active senders.
|
||||||
let whatsapp_ctx_for_shutdown: Option<Arc<chat::transport::whatsapp::WhatsAppWebhookContext>> =
|
let whatsapp_ctx_for_shutdown: Option<Arc<chat::transport::whatsapp::WhatsAppWebhookContext>> =
|
||||||
@@ -391,14 +384,13 @@ async fn main() -> Result<(), std::io::Error> {
|
|||||||
if let Some(ref ctx) = whatsapp_ctx {
|
if let Some(ref ctx) = whatsapp_ctx {
|
||||||
let transport = Arc::clone(&ctx.transport);
|
let transport = Arc::clone(&ctx.transport);
|
||||||
let bot_name = ctx.bot_name.clone();
|
let bot_name = ctx.bot_name.clone();
|
||||||
let history = Arc::clone(&ctx.history);
|
let history: WhatsAppConversationHistory = Arc::clone(&ctx.history);
|
||||||
tokio::spawn(async move {
|
tokio::spawn(async move {
|
||||||
let senders: Vec<String> = history.lock().await.keys().cloned().collect();
|
let senders: Vec<String> = history.lock().await.keys().cloned().collect();
|
||||||
if senders.is_empty() {
|
if senders.is_empty() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let notifier =
|
let notifier = crate::rebuild::BotShutdownNotifier::new(transport, senders, bot_name);
|
||||||
crate::rebuild::BotShutdownNotifier::new(transport, senders, bot_name);
|
|
||||||
notifier.notify_startup().await;
|
notifier.notify_startup().await;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -410,8 +402,7 @@ async fn main() -> Result<(), std::io::Error> {
|
|||||||
if channels.is_empty() {
|
if channels.is_empty() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let notifier =
|
let notifier = crate::rebuild::BotShutdownNotifier::new(transport, channels, bot_name);
|
||||||
crate::rebuild::BotShutdownNotifier::new(transport, channels, bot_name);
|
|
||||||
notifier.notify_startup().await;
|
notifier.notify_startup().await;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -591,10 +582,7 @@ name = "coder"
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn classify_help_short() {
|
fn classify_help_short() {
|
||||||
assert_eq!(
|
assert_eq!(classify_cli_args(&["-h".to_string()]), CliDirective::Help);
|
||||||
classify_cli_args(&["-h".to_string()]),
|
|
||||||
CliDirective::Help
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
Reference in New Issue
Block a user