1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
//! Daemon mode abstractions.
//!
//! Defines the [`DaemonAdapter`] trait that communication adapters (Telegram,
//! Slack, etc.) implement to support `ralph bot daemon`. The CLI layer creates
//! the adapter and passes a [`StartLoopFn`] callback — the adapter calls it
//! when a user sends a message that should start an orchestration loop.
use Future;
use PathBuf;
use Pin;
use async_trait;
/// Callback the adapter calls to start an orchestration loop.
///
/// Accepts a prompt string, returns `Ok(description)` on success (e.g.,
/// `"CompletionPromise"`) or `Err` on failure. The adapter doesn't need
/// to know about `TerminationReason` — it just reports the result.
pub type StartLoopFn = ;
/// A communication adapter that can run in daemon mode.
///
/// The daemon is a persistent process that listens for messages on a
/// communication platform and starts orchestration loops on demand.
///
/// Implementors handle all platform-specific concerns: authentication,
/// message polling, greeting/farewell, and idle-mode commands. When a
/// loop is running, the adapter hands off interaction to the loop's own
/// communication service (e.g., `TelegramService`) and simply awaits
/// completion.