codetether_agent/tui/app/autochat/
notify.rs1use tokio::sync::mpsc;
4
5use super::events::AutochatUiEvent;
6
7pub fn send_registry_error(ui_tx: &mpsc::UnboundedSender<AutochatUiEvent>, err: anyhow::Error) {
9 let _ = ui_tx.send(AutochatUiEvent::SystemMessage(format!(
10 "Failed to load providers for /autochat: {err}"
11 )));
12 let _ = ui_tx.send(completed(
13 "Autochat aborted: provider registry unavailable.".to_string(),
14 ));
15}
16
17pub fn send_no_provider_error(ui_tx: &mpsc::UnboundedSender<AutochatUiEvent>) {
19 let _ = ui_tx.send(completed(
20 "Autochat aborted: no providers configured.".to_string(),
21 ));
22}
23
24pub fn send_success_text(
26 ui_tx: &mpsc::UnboundedSender<AutochatUiEvent>,
27 resolved_model: String,
28 summary: String,
29) {
30 let _ = ui_tx.send(AutochatUiEvent::SystemMessage(format!(
31 "Autochat relay complete (final persona on {resolved_model})"
32 )));
33 let _ = ui_tx.send(completed(summary));
34}
35
36pub fn send_completion_error(ui_tx: &mpsc::UnboundedSender<AutochatUiEvent>, err: anyhow::Error) {
38 let _ = ui_tx.send(completed(format!("❌ Autochat execution failed: {err}")));
39}
40
41fn completed(summary: String) -> AutochatUiEvent {
42 AutochatUiEvent::Completed {
43 summary,
44 okr_id: None,
45 okr_run_id: None,
46 relay_id: None,
47 }
48}