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:
@@ -5,6 +5,8 @@ import type { ToolRegistry } from '../../tools/registry.js';
|
||||
import type { ToolExecutor } from '../../tools/executor.js';
|
||||
import type { ToolResult } from '../../tools/types.js';
|
||||
import type { ToolPolicyContext } from '../../tools/policy.js';
|
||||
import type { Attachment } from '../../channels/types.js';
|
||||
import { buildUserMessage, getMessageText } from '../../models/media.js';
|
||||
|
||||
export interface ToolUseEvent {
|
||||
type: 'start' | 'end';
|
||||
@@ -61,8 +63,8 @@ export class NativeAgent {
|
||||
return this.session?.getHistory() ?? [...this.inMemoryHistory];
|
||||
}
|
||||
|
||||
async process(userMessage: string): Promise<string> {
|
||||
const userMsg: Message = { role: 'user', content: userMessage };
|
||||
async process(userMessage: string, attachments?: Attachment[]): Promise<string> {
|
||||
const userMsg = buildUserMessage(userMessage, attachments);
|
||||
|
||||
if (this.session) {
|
||||
this.session.addMessage(userMsg);
|
||||
|
||||
Reference in New Issue
Block a user