Skip to main content

DraftChannel

Trait DraftChannel 

Source
pub trait DraftChannel: Send + Sync {
    // Required methods
    fn send_draft<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        chat_id: &'life1 str,
        text: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<String>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn update_draft_progress<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        chat_id: &'life1 str,
        message_id: &'life2 str,
        text: &'life3 str,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
    fn finalize_draft<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        chat_id: &'life1 str,
        message_id: &'life2 str,
        text: &'life3 str,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
}
Expand description

Live draft updates: send a placeholder → edit with progress → finalize with the answer.

Deliberately has no default implementations: a channel that claims draft support must actually be able to put the final text on screen, because the agent loop will not also return it to the caller.

Required Methods§

Source

fn send_draft<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, chat_id: &'life1 str, text: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<Option<String>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Send an initial draft placeholder (e.g. “⏳”). Returns message ID for edits.

Source

fn update_draft_progress<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, chat_id: &'life1 str, message_id: &'life2 str, text: &'life3 str, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Edit the draft with a live progress update (tool start/end). Rate-limited by impl.

Source

fn finalize_draft<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, chat_id: &'life1 str, message_id: &'life2 str, text: &'life3 str, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Finalize the draft with the full formatted response, replacing any progress text.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§