Communication runtime

Every channel. One thread.

Channel turns platform conversations into domain state: every inbound and outbound message — web, email, whatsapp, slack — lands as a canonical channel_messages record on the agent's context. UI reads it reactively from InstantDB; delivery internals stay contained inside the package.

/channel

Channel surface

@ekairos/channel@beta

schema

channel_messages

Canonical message crossing any channel: kind, direction, role, text/parts, status, externalId, participant — linked to event_contexts and event_items.

channel_state

Internal runtime key/value state with TTL for platform delivery (caches, lists).

channel_locks

Per-conversation delivery locks (token + TTL) so one handler runs at a time.

channel_subscriptions

Conversations the runtime is subscribed to, durable across restarts.

actions

createChannels

Boots the multichannel runtime: configured platforms feed one inbound pipeline and expose one webhook handler each.

inbound.reply

Posts a reply on the same platform conversation and persists the outbound message.

ChannelRegistry.send

Sends an outbound message through a registered channel adapter by kind.

createChannelMessage

Constructs a canonical message record ready to persist and link.

ChannelTimeline

The whole conversation across every channel: queries channel_messages reactively from InstantDB by contextId and renders the interleaved timeline.

From simple to complex

The same idea, three depths.

01

in one sentence

One conversation across whatsapp, email, slack, and the web.

Your agent answers wherever people write, and it all reads as a single thread.

02

how it works

Messages come in from any platform, land in one place, and replies go back out.

Each platform delivers messages through a webhook, and every one of them becomes the same canonical record attached to the agent's conversation. Your agent reacts once, and the reply travels back through whichever channel the person used. The UI just reads the thread — it never cares which platform a message came from.

03

under the hood

Canonical messages plus the delivery machinery to keep them ordered.

channel_messages is the cross-platform record — kind, direction, role, parts, status — linked to event_contexts and event_items, while channel_locks, channel_queues, channel_subscriptions, and channel_state keep delivery serialized and durable. createChannels boots the runtime from platform credentials and two callbacks, exposing one webhook handler per platform.

Runtime shape

Package behavior. Registry presentation.

Channel UI is plug & play: components query the channel_messages schema on InstantDB directly. The only custom code an app writes is the send endpoint and the webhook mount.

package

@ekairos/channel@beta

aggregate

channel_messages

durable

channel_state

ui

4 component listed

database…