Expand description
§aidaemon-channels (experimental)
Chat channels (Telegram, Slack, Discord, or your own) connected to
aidaemon_core agents. This crate defines the Channel contract and
the runner that turns channel events into agent runs: one session per
conversation, one run at a time per session, streamed progress, and
approvals as buttons that resume interrupted runs.
Adapters live in their own crates (aidaemon-channel-telegram,
aidaemon-channel-slack, aidaemon-channel-discord) and depend only on
the types in channel.
The runner is ChannelRunner; see runner for how to wire an agent,
an EventRouter and channels together.
Re-exports§
pub use channel::ApprovalAnswer;pub use channel::ApprovalChoice;pub use channel::ApprovalDetails;pub use channel::ApprovalPrompt;pub use channel::Attachment;pub use channel::AttachmentKind;pub use channel::Channel;pub use channel::ChannelCapabilities;pub use channel::ChannelError;pub use channel::ChannelEvent;pub use channel::CommandInvocation;pub use channel::CommandSpec;pub use channel::Conversation;pub use channel::ConversationKind;pub use channel::DEFAULT_MAX_DOWNLOAD_BYTES;pub use channel::InboundMessage;pub use channel::MessageRef;pub use channel::OutboundFile;pub use channel::OutboundMessage;pub use channel::ProgressPhase;pub use channel::RunEnding;pub use channel::RunProgress;pub use channel::Sender;pub use channel::ToolProgress;pub use channel::ToolState;pub use commands::CommandContext;pub use commands::CommandHandler;pub use commands::CommandReply;pub use commands::builtin_commands;pub use names::DisplayNameCache;pub use policy::AccessPolicy;pub use policy::Admission;pub use policy::DEFAULT_REFUSAL;pub use policy::SenderRole;pub use router::EventRouter;pub use runner::APPROVE_CHOICE;pub use runner::AttachmentConfig;pub use runner::ChannelRunner;pub use runner::ChannelRunnerBuilder;pub use runner::DENY_CHOICE;pub use runner::RunnerBuildError;pub use runner::RunnerConfig;pub use session::MemorySessionIndex;pub use session::SessionIndex;pub use session::session_id;pub use split::split_message;
Modules§
- admin_
commands - Owner commands an application can add to the shared ones
(
crate::slash::SharedCommands::extensions):/reloadover the host’s config, and/checkpointsand/rollbackover the filesystem checkpoints ofaidaemon_tools(featurecheckpoints). - approval_
render - Approval-message rendering shared across chat channels.
- attachments
- Shared inbound file attachment helpers for Telegram, Slack, and Discord.
- bot
- What a platform bot (the Telegram, Slack and Discord bots in their adapter crates) runs on: the agent, sessions, the task registry and file settings, as one bundle, and who counts as the owner.
- channel
- The contract every chat channel implements.
- claim
- Claiming a bot that has no owner yet. A bot connected without an
allowlist used to make whoever messaged it first its owner, so anyone who
found its username before the owner did owned the daemon. Now the first
direct message must carry a one-time code that only the surface that
connected the bot shows (the chat that ran
/connect, the setup screen, or the daemon’s log for a bot from the config file). - commands
- Slash commands a host adds to a
crate::ChannelRunner. - context
- Where a message came from: the conversation’s audience, platform, sender and any scoped project grant. Internal to aidaemon (the daemon’s channel context), no stability promise.
- hub
- The daemon’s outbound surface to a bot: where a session’s messages,
media, approvals and goal confirmations go, the
ChannelHubthat routes them to the bot a session came from, plus the runtime-managed bot and session-routing stores. Internal to aidaemon, no stability promise; the public contract iscrate::channel. - latex
- LaTeX math cleanup for chat platforms that cannot render it.
- live_
status - Single self-editing status surface per turn. One message is created lazily on the first progress event and edited in place for every subsequent update, so a task shows one calm, updating line/checklist instead of many messages.
- markdown
- Inline Markdown as the models write it, parsed once for every chat’s
formatter (Slack mrkdwn, Telegram HTML, plain text): each renders the
same
Inlinetree its own way, so the rules cannot drift apart. - mid_run
- Messages that arrive while a run is going.
- names
- Display names: cleaned, cached, and kept apart from identity.
- outbound
- The one redaction boundary for what the owner is shown.
- owner_
wait - How long a turn has waited on its owner. A turn’s hang limits leave that time out: waiting on a person is not the turn working. Internal to aidaemon, no stability promise.
- policy
- Who may talk to the agent through which channel.
- ports
- The ports between chat channels and the agent runtime: what a turn
hands the agent (
InboundMessageRequest), what comes back (AgentResponseEnvelope), the agent administration channel commands use (ChannelAgentRuntime), and the outbound router the agent and tools reach the chat through (OutboundRouter). Internal to aidaemon, no stability promise; the public contract iscrate::channel. - presentation
- Shared presentation rules for outbound chat text.
- prompts
- Approval and goal-confirmation prompts on any SDK channel.
- queue
- Bounded queues between the daemon’s producers and the channel hub:
their settings (
QueuePolicyConfig), pressure telemetry and overload policy. Internal to aidaemon, no stability promise. - restored
- Messages a previous run of the daemon accepted to wait for their turn, run after a restart.
- router
- Routing agent events to the conversation whose run produced them.
- runner
- The runner: channel events in, agent runs out.
- send_
file send_file: deliver a file to the current chat through the channel hub’s media queue, and wait for the channel’s receipt.- session
- Mapping conversations to the run they continue from.
- slash
- Slash commands shared by every chat platform: the command menu
(
shared_commands,build_help_text) and the commands that behave the same everywhere (SharedCommands): models, chat operations, context,/private,/mode,/clear,/wipeand usage. A host supplies its services throughCommandHostand adds its own commands (/work,/reload…) asSlashCommands. Internal to aidaemon, no stability promise; the public contract iscrate::channel. - split
- Splitting long Markdown replies into messages that fit a channel.
- stop
- Everything a chat has running, in one list, and stopping it.
- tasks
- Each session’s chat operations: the running turn (cancel token, heartbeat), messages queued behind it, steering messages taken mid-turn and duplicate suppression. Internal to aidaemon, no stability promise.
- terminal_
lite - Chat-based “terminal lite”: a lightweight shell mode that runs single
commands without interactive TUIs, for any channel’s owner chat (the
Telegram bot’s
/terminal lite). - tls
- TLS for the sockets reqwest does not open (a bot’s websocket), trusting what the daemon’s HTTPS client trusts. TLS for the sockets reqwest does not open (websockets, IMAP).
- turns
- A session’s turns, the same on every chat platform.
Structs§
- Memory
Approval Store - Stored
Approval - One open approval, as the runner needs it after a restart. The interrupted
run itself is not copied here: it is read back from the runner’s
aidaemon_core::RunStorebyrun_id, so the approval can never resume anything other than what that store says is waiting.
Traits§
- Approval
Store - Where the runner keeps open approvals. Implement it on your database to
survive restarts;
MemoryApprovalStoreis the in-process version. Set it withcrate::ChannelRunnerBuilder::approval_store.
Functions§
- truncate_
ellipsis - Truncates to at most
max_charscharacters, ending in a single “…” when cut (for labels and chat text where every character counts). - write_
private_ file - Write
bytesto a new filepathindir, both private to this user (0700 / 0600 on Unix), refusing a file that is already there. For the bots’ own attachment paths, which name their files themselves. Blocking.