UNPKG

overmind-mcp

Version:

Orchestrateur universel agents IA multi-modeles via MCP. Inclut le protocole 'Custom-Nickname' pour identifier vos agents avec des surnoms originaux (The Chaos Prophet, Shadow Sniper, etc.), l'isolation mémoire (Private Memory Context) et le support pour

83 lines • 3.97 kB
/** * ╔══════════════════════════════════════════════════════════════════════╗ * ║ OVERMIND BRIDGE — WebhookAdapter (Generic Webhook → Bridge) ║ * ║ ║ * ║ Normalise les webhooks de providers variés vers un format ║ * ║ uniforme consommable par l'API agent.run. ║ * ║ ║ * PROVIDERS SUPPORTÉS ║ * ──────────────────── ║ * - voipms : VoIP.ms (from, to, message, id, date, media) ║ * - twilio : Twilio (From, To, Body, MessageSid, MediaUrl0) ║ * - telegram : Telegram Bot API (message.chat.id, message.from.id) ║ * - discord : Discord-like (channelId, userId, content) ║ * - generic : Format customisable (mapping field-by-field) ║ * ║ ║ * ║ Chaque adapter retourne un NormalizedWebhook qui contient : ║ * ║ - externalKey : clé pour SessionStore (phone, user, etc.) ║ * ║ - prompt : texte à envoyer à l'agent (déjà contextualisé) ║ * ║ - metadata : données brutes pour audit ║ * ║ - mediaUrls : URLs de médias attachés ║ * ╚══════════════════════════════════════════════════════════════════════╝ */ import { type BridgeLogger } from './utils.js'; export interface NormalizedWebhook { /** Clé externe pour SessionStore (ex: numéro de téléphone) */ externalKey: string; /** Prompt à passer à l'agent (déjà contextualisé) */ prompt: string; /** Liste des URLs de médias (optionnel) */ mediaUrls: string[]; /** Métadonnées brutes (provider, messageId, etc.) */ metadata: Record<string, unknown>; } export type WebhookProvider = 'voipms' | 'twilio' | 'telegram' | 'generic' | 'discord'; export interface WebhookAdapterConfig { /** Nom du provider (default: 'voipms') */ provider?: WebhookProvider; /** Pour 'generic' : mapping custom field → champ normalisé */ fieldMap?: Partial<Record<keyof NormalizedWebhook, string>>; /** Préfixe ajouté au prompt (ex: '[SMS reçu]') */ promptPrefix?: string; /** Inclure un contexte Discord-like dans le prompt */ discordContext?: { channelId?: string; userId?: string; username?: string; }; /** Logger */ logger?: BridgeLogger; } export declare class WebhookAdapter { private readonly config; private readonly log; constructor(config?: WebhookAdapterConfig); /** * Adapte un payload brut vers un NormalizedWebhook. */ adapt(rawPayload: Record<string, unknown>): NormalizedWebhook; /** * VoIP.ms callback format. * Params: from, to, message, id, date, media (URLs séparées par |) * Body peut être GET query ou POST form-encoded. */ private adaptVoipMs; /** * Twilio format (snake_case ou CamelCase). */ private adaptTwilio; /** * Telegram Bot API format. * Payload: { message: { chat: { id }, from: { id, username }, text, photo: [{ file_id }] } } */ private adaptTelegram; /** * Discord-like format (channel, user, message). */ private adaptDiscord; /** * Generic — applique le fieldMap custom. */ private adaptGeneric; } //# sourceMappingURL=WebhookAdapter.d.ts.map