Expand description
§wabot-feature-chat-controller
Rust port of wabot-ts/src/feature/chat-controller. Provides:
ChatChanneltrait +ChannelMessage/ReceivedMessagetypes.Chatentity,ChatRepository,ChatResolver(in-memory; Phase 4 will graduate these into a dedicatedwabot-feature-chat-botcrate alongside the Postgres implementation).- The runtime helpers macro emissions call into.
The #[chat_controller] macro lives in wabot-macros. Per-channel
markers (#[cmd], future #[telegram(...)] / #[socket(...)]) are
also there.
Re-exports§
pub use channel::ChannelError;pub use channel::ChannelMessage;pub use channel::ChatChannel;pub use channel::InjectInstance;pub use channel::MessageCallback;pub use channel::ReplyFn;pub use channel::ReplyResult;pub use handler::Dispatch;pub use handler::DispatchArgs;pub use handler::DispatchError;pub use handler::ReceivedMessage;pub use handler::ReplyHandle;pub use runtime::build_message_callback;pub use runtime::into_received;pub use runtime::populate_child_container;pub use runtime::run_chat_controllers;pub use async_trait;
Modules§
- channel
IChatChanneltrait + channel-side message types.- chat
- Re-export of the chat-bot Chat entity + repository.
- handler
- Inbound-message handler trait — the typed bridge between channels and macro-generated dispatch code.
- runtime
- Per-message runtime — shared by every
#[chat_controller]macro emission. Centralising the child-container / chat-resolution plumbing here keeps the macro emission small. - types
- Re-export of the chat-bot data types.
Structs§
- Chat
Connection - Identifies a chat at the channel level. Same shape as
IChatConnectionin TS. The(channel_name, id)pair is unique. - Chat
Data - Persistent chat state. Multi-channel-capable.
- Chat
Message - One chat message — inbound (received from a channel) or outbound
(a reply, or a bot-generated message from the LLM). Mirrors
IChatMessagein TS. - Chat
Message File - File attachment on a chat message — image or document. Either
public_urlorbase64_urlmust be set; readers fall back through them in that order. - Chat
Resolver - Make-or-find lookup keyed on
(channel_name, connection_id). Uses a per-keytokio::sync::Mutexso concurrent first-time messages from the same connection serialize their create attempts; horizontal scaling needs the full Locker port (Phase 5). - InMemory
Chat Repository - In-memory repository — fine for examples and tests.
Enums§
- Chat
Type - Whether a chat is one-on-one or group. Mirrors
IChatConnection.chatType('PRIVATE' | 'GROUP') from TS.
Traits§
- Chat
Repository - Storage interface for
Chatlookups.
Functions§
- chat_
from_ connection - Build a fresh
Chatfrom a single connection. Free function rather than an inherent impl becauseChatis a type alias (orphan rule).