- Menu comandi (setMyCommands, chat private): /sessioni /nuova /stato /stop /impostazioni /aiuto; /usa rimosso. - Un topic per sessione (createForumTopic in chat privata), nome "<cartella> · <modello>", rinominato al cambio di modello e "(chiusa)" alla chiusura; mappa salvata in AKODE_HOME/telegram-topics.json. Senza topic: prefisso [cartella · modello] e scelta della sessione con pulsanti. - /sessioni con Apri (link al topic), Stato e Stop; il messaggio si aggiorna modificandolo. - Streaming con sendMessageDraft (can_stop, al massimo 1/s, stop = interrompe il turno), messaggio finale con piede "ctx · t/s · durata". - Approvazioni con pulsanti colorati, poi un pulsante disattivato con l'esito. - Piano come elenco modificato; reazioni ricevuto/fatto configurabili. - /impostazioni con interruttori Sì/No salvati in [telegram] (streaming, reactions nuovi). - Messaggi modificati: un comando modificato riparte, il testo no. - Pulsanti con token opachi lato server; allowlist anche sui pulsanti. - Nessuna emoji nei testi in uscita (test dedicato). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
33 lines
1.3 KiB
Rust
33 lines
1.3 KiB
Rust
//! 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;
|
|
mod outbox;
|
|
pub mod pairing;
|
|
pub mod settings;
|
|
pub mod text;
|
|
pub mod topics;
|
|
|
|
/// 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";
|