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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
// SPDX-FileCopyrightText: 2026 Andrei G <bug-ops>
// SPDX-License-Identifier: MIT OR Apache-2.0
//! Channel implementations for the Zeph agent.
//!
//! This crate provides the concrete `Channel` implementations used by the
//! Zeph agent loop. Every implementation wraps a transport-specific I/O
//! mechanism and exposes a uniform async interface that the agent core uses
//! without knowing the underlying delivery medium.
//!
//! # Available channels
//!
//! | Type | Feature | Transport |
//! |------|---------|-----------|
//! | [`CliChannel`] | always | stdin / stdout |
//! | [`telegram::TelegramChannel`] | always | Telegram Bot API via teloxide |
//! | `DiscordChannel` | `discord` | Discord gateway |
//! | `SlackChannel` | `slack` | Slack Events API |
//!
//! # Runtime dispatch
//!
//! [`AnyChannel`] is an enum that implements `Channel` by delegating to the
//! active variant. The binary selects the variant at startup and passes
//! `AnyChannel` throughout; the agent core never needs to be generic over the
//! channel type.
//!
//! # Shared timeouts
//!
//! [`CONFIRM_TIMEOUT`] and [`ELICITATION_TIMEOUT`] define the deny-on-timeout
//! durations that all remote channel adapters must honour for interactive
//! dialogs. They are intentionally centralised here so that the behaviour is
//! consistent across Telegram, Discord, and Slack.
pub use AnyChannel;
pub use CliChannel;
pub use JsonCliChannel;
/// Shared timeout for interactive confirmation dialogs across all remote channels.
///
/// Used by Telegram, Discord, and Slack [`Channel::confirm`] implementations to
/// ensure consistent deny-on-timeout behaviour. When the timeout expires the
/// implementation must return `Ok(false)` (deny), not an error.
///
/// [`Channel::confirm`]: zeph_core::channel::Channel::confirm
pub const CONFIRM_TIMEOUT: Duration = from_secs;
/// Per-field timeout for interactive elicitation dialogs on remote channels.
///
/// Used by Telegram, Discord, and Slack [`Channel::elicit`] implementations.
/// Each individual field in the elicitation request resets the timer. When the
/// timeout expires the implementation must return
/// [`ElicitationResponse::Cancelled`].
///
/// [`Channel::elicit`]: zeph_core::channel::Channel::elicit
/// [`ElicitationResponse::Cancelled`]: zeph_core::channel::ElicitationResponse::Cancelled
pub const ELICITATION_TIMEOUT: Duration = from_mins;