@botmesh/core - v2.0.0-alpha.2
    Preparing search index...

    Class RecordingProvider<P>

    Transparent IProvider wrapper that records a transcript.

    Type Parameters

    Implements

    Index
    id: string

    Stable transport tag (e.g. 'baileys', 'telegram') — used to namespace conversation keys if one Bot ever runs multiple providers concurrently.

    capabilities: ProviderCapabilities
    inner: P
    ingest?: (
        rawEvent: unknown,
        headers?: Record<string, string | string[] | undefined>,
    ) => unknown

    Push ingress for webhook transports (Cloud API POST, Telegram/Discord webhook, Discord interaction endpoint). The host HTTP server calls this with the raw body (and, optionally, the request headers for signature checks); the provider normalizes and emits via onEvent. May return a value the host can use as the HTTP status (e.g. 200 accepted / 403 bad signature). Socket-first providers (Baileys, Discord gateway) omit it.

    downloadMedia?: (
        ref: MediaRef,
    ) => Promise<Buffer<ArrayBufferLike> | ReadableStream>

    Lazy media retrieval behind one signature for every download model.

    serializeMediaRef?: (ref: MediaRef) => SerializedMediaRef | undefined

    Durable journaling (BotConfig.durability): turn a live MediaRef into a JSON-safe, versioned reference that rehydrateMediaRef can rebuild in another process, so a replayed message (crash recovery, background retry) can still download its media. Synchronous, cheap and side-effect free; a throw counts as "not durable". Return undefined for a ref that must not be journaled (e.g. view-once media). Never include credentials: the result is stored at rest with the inbound record.

    rehydrateMediaRef?: (
        stored: SerializedMediaRef,
        ref: Omit<MediaRef, "token">,
    ) => MediaRef | Promise<MediaRef>

    Rebuild the MediaRef of a replayed message from what serializeMediaRef wrote. ref is the journaled ref without its token. Pure decoding: it must not need the transport to be connected. stored comes from storage and is UNTRUSTED: reject an invalid, unknown-version or tampered value with a ProviderError.

    getMessage?: (ref: MessageRef) => Promise<InboundMessage<unknown> | undefined>

    Read-back seam for poll aggregation, quote-body resolution, retry decrypt. Providers that don't need it no-op / omit it. Replaces the constructor- injected getMessage callback baked into BaileysProvider today.

    markRead?: (refs: MessageRef[]) => Promise<void>
    typing?: (
        chatId: string,
        state?: "typing" | "paused" | "recording",
    ) => Promise<void>
    deleteMessage?: (ref: MessageRef) => Promise<void>
    editMessage?: (
        ref: MessageRef,
        content: OutboundContent,
    ) => Promise<SendResult<unknown>>
    acknowledgeInteraction?: (
        interactionId: string,
        opts?: { text?: string; defer?: boolean },
    ) => Promise<void>
    maxTurns: number

    Max turns kept in memory (oldest dropped first).

    • get connection(): unknown

      A single primary connection handle for DEBUGGING ONLY. Not a structural guarantee of exactly one connection (Discord may hold many shard sockets). Core must NOT reach through this for behavior.

      Returns unknown