/** * Telegram Inbound Processor * * Handles inbound message processing from Telegram: * - Message queuing (per chat) * - Deduplication * - Access control * - Media download * - STT transcription * - Event publishing to bus */ import type { Context } from 'grammy'; import type { Config } from '@xopcai/xopc/config/schema.js'; import type { MessageBus } from '@xopcai/xopc/infra/bus/index.js'; import type { TelegramAccountManager } from './account-manager.js'; export interface AccessControlService { normalizeAllowFromWithStore(options: { allowFrom?: Array; }): unknown; evaluateGroupBaseAccess(options: { isGroup: boolean; groupConfig?: unknown; topicConfig?: unknown; hasGroupAllowOverride: boolean; effectiveGroupAllow: unknown; senderId?: string; senderUsername?: string; }): { allowed: boolean; reason?: string; }; resolveRequireMention(options: { topicConfig?: unknown; groupConfig?: unknown; defaultRequireMention?: boolean; }): boolean; hasBotMention(options: { botUsername: string; text?: string; entities?: unknown; }): boolean; removeBotMention(text: string, botUsername: string): string; } export interface SessionKeyService { generateSessionKey(options: { source: string; chatId: string; senderId: string; isGroup: boolean; threadId?: string; accountId?: string; agentId?: string; }): string; } export interface STTService { transcribe(buffer: Buffer, config: unknown, options?: { language?: string; }): Promise<{ text: string; }>; isSTTAvailable(config: unknown): boolean; } export interface MediaUtils { getMimeType(type: string, filePath?: string): string; } export interface InboundProcessorDeps { bus: MessageBus; config: Config; accountManager: TelegramAccountManager; accessControl: AccessControlService; sessionKeyService: SessionKeyService; sttService: STTService; mediaUtils: MediaUtils; } /** * Create inbound message processor */ export declare function createInboundProcessor(deps: InboundProcessorDeps): (ctx: Context, accountId: string) => Promise;