Skip to content

TinyChannels

CI License: GPL v3

TinyChannels is a Rust library for OpenHuman channel and messaging primitives. It provides the portable channel contract, channel configuration schema, connection metadata, route helpers, and backend delegation layer used to connect channel surfaces to OpenHuman harnesses without coupling this crate to the OpenHuman application crate.

Intended Scope

  • channel abstractions for inbound and outbound message streams
  • harness-facing communication contracts
  • transport-neutral message envelopes and routing metadata
  • adapters for OpenHuman channel surfaces
  • observability and lifecycle hooks around channel traffic

Runtime side effects are pluggable through ChannelBackend. OpenHuman owns the actual backend implementation for REST/JWT/config storage, while this crate validates channel metadata and delegates operations through that trait.

Provider Features

TinyChannels includes optional provider implementations that must be explicitly enabled:

Provider Feature Channels Dependencies
Email (send only) email-send EmailChannel (SMTP send) lettre
Email email EmailChannel (SMTP + IMAP) lettre, async-imap, mail-parser
Lark/Feishu lark LarkChannel (webhook receiver + Protobuf decoder) axum, prost
WhatsApp Web whatsapp-web WhatsAppWebChannel (multi-device via whatsapp-rust) whatsapp-rust, whatsapp-rust-tokio-transport, whatsapp-rust-ureq-http-client, wacore

Not on crates.io. This crate and tinychannels-bus are publish = false OpenHuman uses the vendored path dependency under vendor/tinychannels. Other consumers can use the direct Git dependency shown below. What a host loads at runtime is the compiled tinychannels-module cdylib, delivered as a release artifact and pinned by SHA-256, not a published crate.

The default feature set (default = []) does not include these providers. To use them, add to your Cargo.toml:

[dependencies]
tinychannels = { git = "https://github.com/tinyhumansai/tinychannels", features = ["email", "lark", "whatsapp-web"] }

Or enable them individually as needed:

[dependencies]
tinychannels = { git = "https://github.com/tinyhumansai/tinychannels", features = ["email"] }

If you only ever send mail — no mailbox is polled — take email-send instead. It gives you EmailChannel::new, send_message and the build_*_message helpers on lettre alone, without the IMAP receive stack (18 fewer packages):

[dependencies]
tinychannels = { git = "https://github.com/tinyhumansai/tinychannels", features = ["email-send"] }

email-send carries no Channel impl — a send-only build cannot listen, so the trait is gated on the full email feature rather than promising a half-working channel.

All other providers (Telegram, Discord, Slack, Signal, iMessage, IRC, Yuanbao/钉钉, etc.) are included in the default build.

Development

cargo fmt --check
cargo clippy --all-targets -- -D warnings
cargo build --all-targets
cargo test

# Test with all optional providers
cargo test --features email,lark

Repository Layout

  • crates/tinychannels-bus/ is the contract: Channel, ChannelMessage and SendMessage (traits.rs), channel configuration (config.rs), per-provider capabilities (capabilities.rs), connection definitions, connect-form parsing and backend response types (controllers/), and conversation keys (context.rs).
  • crates/tinychannels-runtime/ holds listener supervision, the bounded dispatch loop, logout-scoped sessions, channel health checks and the console CliChannel.
  • crates/tinychannels-module/ is the loadable TinyBus module.
  • src/lib.rs exports the crate surface and re-exports the contract.
  • src/providers/ holds the provider transports.
  • src/delivery/ holds the durable outbound queue and progressive/, the streaming reply driver (draft, thinking and filler bubbles) over a host-supplied ProgressiveSender. The reply splitter (segment_for_delivery) lives in tinychannels-bus (delivery::segment) and is re-exported here.
  • src/remote/ implements /status, /sessions, /new and /help for every provider with the remote_control capability, over a host-supplied RemoteControlHost.
  • src/approvals/ sends in-chat approval prompts for every provider with the chat_approvals capability.
  • src/relay/ holds the relay transport loop, the WebSocket dialer and the process-wide transport registry.
  • src/backend.rs owns ChannelBackend and ChannelManager; src/host/ is the host service boundary; src/routes.rs and src/runtime.rs hold portable runtime helpers.

Releases

Packages

Contributors

Languages