feat: add multimodal media pipeline for image support across all providers and channels

Widen Message.content from string to string | MessageContentPart[] to support
multimodal content. Add Attachment type to channel layer, media conversion
utilities, and image extraction to all channel adapters (Telegram, Discord,
Slack, WhatsApp). Update all model clients (Anthropic, OpenAI, Gemini, Bedrock)
to convert structured content to provider-specific formats. Fix downstream
consumers (tokens, compaction, TUI, local models) to handle the widened type
via getMessageText() helper.
This commit is contained in:
William Valentin
2026-02-06 17:17:21 -08:00
parent cfdd448495
commit a515912537
22 changed files with 788 additions and 37 deletions
+16
View File
@@ -6,6 +6,20 @@
* the ChannelAdapter interface to provide a uniform messaging API.
*/
/** Media attachment received from or sent to a channel. */
export interface Attachment {
/** MIME type (e.g. "image/jpeg", "audio/ogg", "application/pdf"). */
mimeType: string;
/** Base64-encoded data (preferred for model APIs). */
data?: string;
/** URL to download the attachment (alternative to data). */
url?: string;
/** Original filename, if available. */
filename?: string;
/** File size in bytes, if known. */
size?: number;
}
/** Inbound message received from a channel platform. */
export interface InboundMessage {
/** Platform message ID. */
@@ -18,6 +32,8 @@ export interface InboundMessage {
senderName?: string;
/** Message text. */
text: string;
/** Media attachments (images, audio, documents). */
attachments?: Attachment[];
/** ID of message being replied to. */
replyTo?: string;
/** Unix ms. */