WIP Telegram: modulo akode-telegram (API e impostazioni), in pausa

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
andrea.difonzo
2026-11-12 08:21:25 +01:00
parent 9636b74c7d
commit 28bddb1b0c
41 changed files with 4216 additions and 4 deletions

View File

@@ -0,0 +1,30 @@
//! Telegram control of running aKode sessions.
//!
//! The bridge runs inside the app-server that hosts the sessions: the shared daemon, or a
//! `--no-daemon` process. Telegram allows one `getUpdates` poller per bot token, so every
//! process takes [`lock::PollLock`] in `AKODE_HOME` first and only the holder polls; the
//! others retry later and take over when the holder exits.
//!
//! The bridge is an ordinary app-server client (an internal connection): it subscribes to
//! the loaded threads, answers approvals through the same JSON-RPC responses the TUI sends
//! (the first answer wins, the other side receives `serverRequest/resolved`) and starts or
//! steers turns with `turn/start`, `turn/steer`, `thread/queue/add` and `turn/interrupt`.
//!
//! Only `https://api.telegram.org` is contacted, only while `[telegram] enabled = true`,
//! and only chats in `allowed_chat_ids` are served. The bot token stays in the key store.
pub mod api;
pub mod bridge;
pub mod lock;
pub mod pairing;
pub mod settings;
pub mod text;
/// Key store id of the bot token.
pub const TOKEN_ID: &str = "telegram-bot";
/// The only host the bridge contacts.
pub const TELEGRAM_API_BASE: &str = "https://api.telegram.org";
/// App-server client name of the bridge connection.
pub const CLIENT_NAME: &str = "akode-telegram";