Skip to main content

PacedChannel

Struct PacedChannel 

pub struct PacedChannel { /* private fields */ }

Implementations§

Source§

impl PacedChannel

Source

pub fn wrap( inner: Arc<dyn Channel>, cfg: &dyn HasReplyPacing, ) -> Arc<dyn Channel> ⓘ

Wrap inner with a pacing floor sourced from cfg. When cfg.reply_min_interval_secs() == 0 the inner Arc is returned unchanged so the default config has zero overhead — no wrapper, no mutex, no allocation.

Trait Implementations§

Source§

impl Attributable for PacedChannel

Source§

fn role(&self) -> Role

Source§

fn alias(&self) -> &str

Source§

fn tool_provenance(&self) -> ToolProvenance

Classifies whether a tool implementation is first-party native code or an extension. The conservative default prevents a new wrapper from inheriting native presentation privileges accidentally.
Source§

impl Channel for PacedChannel

Source§

fn present_model_picker<'life0, 'life1, 'async_trait>( &'life0 self, request: &'life1 ChannelModelPickerRequest, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

The picker is an interactive control surface, not paced outbound traffic. Without this forward the trait default’s Ok(false) would silently swallow the picker whenever pacing wraps the channel.

Source§

fn listener_health(&self) -> Option<ListenerHealth>

Forward the inner channel’s passive observation.

Without this the trait default (None) answers for the wrapper, and a supervisor reads “no signal” for a channel that does have one. Pacing is a delivery concern; it says nothing about whether the listener is reaching the service.

Source§

fn supports_native_polls(&self) -> bool

Forwarded rather than paced: a poll is one stanza, and the inner channel owns whatever limits apply to it.

Source§

fn room_context(&self, room_id: &str) -> Option<ChannelRoomContext>

Must be forwarded explicitly: the trait default returns None, so without this every channel wrapped here would report that it supplies no room context, no matter what the inner channel knows. Pacing concerns outbound sends only and has no opinion about a room’s description.

Source§

fn request_approval_attributed<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, recipient: &'life1 str, request: &'life2 ChannelApprovalRequest, ) -> Pin<Box<dyn Future<Output = Result<Option<AttributedApprovalResponse>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Must be forwarded explicitly: without this the trait default would call Channel::request_approval on the wrapper and relabel the inner channel’s synthesized timeout deny as an operator decision.

Source§

fn name(&self) -> &str

Human-readable channel name
Source§

fn send<'life0, 'life1, 'async_trait>( &'life0 self, message: &'life1 SendMessage, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Send a message through this channel
Source§

fn send_final<'life0, 'life1, 'async_trait>( &'life0 self, message: &'life1 SendMessage, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Send the completed assistant response for a turn. Read more
Source§

fn listen<'life0, 'async_trait>( &'life0 self, tx: Sender<ChannelMessage>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Start listening for incoming messages (long-running)
Source§

fn health_check<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Check if channel is healthy
Source§

fn start_typing<'life0, 'life1, 'async_trait>( &'life0 self, recipient: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Signal that the bot is processing a response (e.g. “typing” indicator).
Source§

fn set_cancel_token(&self, token: CancellationToken)

Receive the supervisor lifecycle token before listen() is called. Channels that internally wait for shutdown can subscribe instead of independently catching SIGINT.
Source§

fn uses_cancel_token(&self) -> bool

Whether this channel participates in the cooperative cancellation contract via set_cancel_token. Only participating channels get a bounded grace period for cleanup after cancellation.
Source§

fn stop_typing<'life0, 'life1, 'async_trait>( &'life0 self, recipient: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Stop any active typing indicator.
Source§

fn supports_draft_updates(&self) -> bool

Whether this channel supports progressive message updates via draft edits.
Source§

fn supports_multi_message_streaming(&self) -> bool

Whether this channel supports multi-message streaming delivery.
Source§

fn supports_turn_flush_narration(&self) -> bool

Whether this channel implements the turn-flush narration contract: flush_draft_turn delivers each completed agent text turn as a permanent outbound message, and the orchestrator therefore routes that narration through the outbound hook + leak-detection boundary and orders it ahead of the approval prompt via a flush barrier. Read more
Source§

fn multi_message_delay_ms(&self) -> u64

Minimum delay (ms) between successive messages in multi-message mode. The message boundary is channel-specific (for example, Telegram uses completed agent turns).
Source§

fn multi_message_confirmed_offset<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, recipient: &'life1 str, message_id: &'life2 str, ) -> Pin<Box<dyn Future<Output = usize> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Confirmed-delivery byte offset for a MultiMessage draft: how many bytes of the cumulative visible text previously handed to update_draft have already been emitted on the transport as paragraph messages (including their trailing \n\n delimiters). Read more
Source§

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

Send an initial draft message. Returns a platform-specific message ID for later edits.
Source§

fn update_draft<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, recipient: &'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,

Update a previously sent draft message with new accumulated content.
Source§

fn update_draft_progress<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, recipient: &'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,

Show a progress/status update (e.g. tool execution status).
Source§

fn update_draft_progress_batch<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, recipient: &'life1 str, message_id: &'life2 str, texts: &'life3 [String], ) -> 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,

Show a batch of progress/status updates as one coalesced draft update. Read more
Source§

fn update_typed_draft_progress_batch<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, recipient: &'life1 str, message_id: &'life2 str, progress: &'life3 [DraftProgress], ) -> 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,

Show a batch of progress updates without discarding their source kind. Read more
Source§

fn update_draft_lifecycle<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, recipient: &'life1 str, message_id: &'life2 str, event: ProgressEvent, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Show localized lifecycle progress produced from a typed runtime event. Unlike raw tool status text, this input is trusted channel chrome.
Source§

fn flush_draft_turn<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, recipient: &'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,

Flush the current agent text turn as an outbound message in multi-message streaming mode. Called when an LLM turn completes (e.g. before tool execution). Default: no-op.
Source§

fn discard_draft_turn<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, recipient: &'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,

Discard a completed agent text turn WITHOUT sending it, marking that narration consumed for this draft. Called when the outbound hook cancels a narration flush: the cancelled turn must never be re-offered (no resurrection), but narration produced by a later turn must still be deliverable. Advancing the channel’s delivered-prefix bookkeeping over the cancelled text achieves both. Default: no-op.
Source§

fn finalize_draft<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, recipient: &'life1 str, message_id: &'life2 str, text: &'life3 str, suppress_voice: bool, ) -> 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 a draft with the complete response (e.g. apply Markdown formatting). suppress_voice forces text delivery even on voice-only peers. Read more
Source§

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

Cancel and remove a previously sent draft message if the channel supports it.
Source§

fn add_reaction<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, channel_id: &'life1 str, message_id: &'life2 str, emoji: &'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,

Add a reaction (emoji) to a message.
Source§

fn remove_reaction<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, channel_id: &'life1 str, message_id: &'life2 str, emoji: &'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,

Remove a reaction (emoji) from a message previously added by this bot.
Source§

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

Pin a message in the channel.
Source§

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

Unpin a previously pinned message.
Source§

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

Redact (delete) a message from the channel.
Source§

fn create_room<'life0, 'life1, 'async_trait>( &'life0 self, options: &'life1 RoomCreationOptions, ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Create a new platform room/conversation when the channel supports it.
Source§

fn invite_user<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, room_id: &'life1 str, user_id: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Invite a user to an existing platform room/conversation.
Source§

fn send_poll<'life0, 'life1, 'async_trait>( &'life0 self, poll: &'life1 PollRequest, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Post a native poll when the channel supports it.
Source§

fn request_approval<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, recipient: &'life1 str, request: &'life2 ChannelApprovalRequest, ) -> Pin<Box<dyn Future<Output = Result<Option<ChannelApprovalResponse>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Request interactive tool-call approval from the channel operator. Read more
Source§

fn request_approval_attributed_with_timeout<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, recipient: &'life1 str, request: &'life2 ChannelApprovalRequest, timeout: Duration, ) -> Pin<Box<dyn Future<Output = Result<Option<AttributedApprovalResponse>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Request an attributed approval using a caller-owned response budget. Read more
Source§

fn request_choice<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, question: &'life1 str, choices: &'life2 [String], timeout: Duration, ) -> Pin<Box<dyn Future<Output = Result<Option<String>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Ask the user a multiple-choice question and return the chosen option’s text. Read more
Source§

fn request_multi_choice<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, question: &'life1 str, choices: &'life2 [String], min_items: usize, max_items: usize, timeout: Duration, ) -> Pin<Box<dyn Future<Output = Result<Option<Vec<String>>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source§

fn supports_free_form_ask(&self) -> bool

Whether this channel can answer free-form (no-choices) ask_user questions via the standard send + listen flow. Channels that only handle structured choices return false so callers fail fast with a useful error instead of timing out on listen.
Source§

fn send_choice<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, recipient: &'life1 str, prompt: &'life2 str, options: &'life3 [(String, String)], ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, Self: 'async_trait,

Send a discrete-choice prompt with options. Read more
Source§

fn supports_outbound_send(&self) -> bool

Whether send actually delivers a message OUTBOUND on this channel. Default true. An INBOUND-ONLY transport (e.g. an AMQP trigger source whose send is a deliberate no-op that returns Ok) overrides this to false, so a surface that must genuinely deliver - such as the SOP approval route adapter - can refuse to route to it (and report the misconfiguration) instead of silently succeeding without sending anything.
Source§

fn self_handle(&self) -> Option<String>

Self-loop guard for multi-agent runs: the bot’s own handle/identity on this channel, so the orchestrator can drop inbound events whose sender matches. A bot must never respond to its own messages, even if a misconfigured peer group lists the bot’s handle as an external peer. Read more
Source§

fn self_addressed_mention(&self) -> Option<String>

The exact form the bot expects when addressed by users on this channel (e.g. Discord <@snowflake>, Telegram @bot_username). Returned verbatim into the per-channel system prompt. Default None for channels with no inbound mention concept. Channels that override self_handle should usually override this too.
Source§

fn drop_self_messages(&self, msg: &ChannelMessage) -> bool

Whether the orchestrator should drop an inbound message as self-authored (multi-agent self-loop guard). Default compares msg.sender against Self::self_handle case-insensitively after stripping a leading @ from each side. Override only for platforms whose identity comparison is non-string.
Source§

fn forge_request<'life0, 'async_trait>( &'life0 self, _request: ForgeApiRequest, ) -> Pin<Box<dyn Future<Output = Result<ForgeApiResponse, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Source§

fn is_direct_message(&self, _msg: &ChannelMessage) -> bool

Whether an inbound message is a direct one-to-one conversation with the bot. A DM is definitionally addressed to the bot, so the orchestrator skips the reply-intent classifier and goes straight to the tool-capable agent turn. Default false: channels that cannot prove a one-to-one context keep the classifier precheck.
Source§

fn send_gate_prompt<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _recipient: &'life1 str, _prompt: &'life2 ChannelGatePrompt, ) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Self: 'async_trait,

Present a long-lived, out-of-band gate prompt (e.g. a parked SOP approval) on this channel, rendered natively — an embed with one button per choice on Discord, an inline keyboard on Telegram, and so on. Read more
Source§

fn finalize_gate_prompt<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _reference: &'life1 str, _outcome: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Self: 'async_trait,

Mark a previously sent gate prompt as resolved: strip its interactive controls and replace the body with outcome (e.g. “Approved by @user — run resumed”), so a decided gate cannot be clicked again and the decision is visible in place. reference is the same correlation key the prompt was sent with. Best-effort: Ok(false) when this channel has nothing to finalize (no native prompt, or the mapping was lost to a restart) — the gate state itself is never affected.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more