/**
 * Transport inbound → umbrella inbox writer (CAT.1b).
 *
 * The chat-daemon subscribes the telegram adapter's rich transport surface
 * (`subscribeTransport`) and hands each `InboundChatMessage` here. This module:
 *
 *   1. resolves the message to an umbrella (or `general`, or orphan) via the
 *      pure FSM in `./routing.ts` — the deterministic replacement for the
 *      legacy in-worker `RoutingIndex` Map; and
 *   2. appends a byte-for-byte-compatible inbox row to that umbrella's
 *      `umbrellas/<id>/inbox/<platform>.jsonl` (orphan → the legacy top-level
 *      `inbox/orphan/<platform>.jsonl`).
 *
 * The row shape is IDENTICAL to what the live legacy daemon writes + what
 * `src/runtime/chat/inbox.ts InboxRow` parses (verified against live bytes):
 *   { v:1, id, thread_id?, platform, channel:"<platform>:<chatId>", sender,
 *     sender_id, text, received_at, enqueued_at, mentions_bot }
 * Only the directory KEY changes (project_uuid → umbrella). Readers move to the
 * umbrella key in CAT.1c.
 *
 * Append is O_APPEND atomic per line (matches the legacy `appendToInbox`); the
 * row is pre-serialized so a partial write can only ever truncate a tail line,
 * which every reader silent-skips.
 *
 * Imports from: node:fs/promises, node:path, ../runtime/paths, ./routing,
 *   ./types. Imported by: the CAT.1b daemon + tests.
 */
import { type ChannelsConfig } from './routing.js';
import type { InboundChatMessage } from './types.js';
/** CAT.4 — on-disk media entry (mirrors `InboxMedia` in inbox.ts). */
interface InboxLineMedia {
    kind: 'photo' | 'document';
    path: string;
    caption?: string;
    mime?: string;
}
/** The byte-compatible inbox row (kept in field order matching live bytes). */
interface InboxLine {
    v: 1;
    id: string;
    thread_id?: string;
    platform: string;
    channel: string;
    sender: string;
    sender_id: string;
    text: string;
    received_at: string;
    enqueued_at: string;
    mentions_bot: boolean;
    /** CAT.4 — downloaded attachments; omitted on text-only messages. */
    media?: InboxLineMedia[];
}
/**
 * Project a rich `InboundChatMessage` to the on-disk inbox row. `channel` is
 * `"<platform>:<chatId>"` (legacy `formatChannelId` shape, e.g.
 * `telegram:-1003923174632`); `enqueuedAtIso` is stamped by the daemon at
 * write time.
 */
export declare function buildInboxLine(msg: InboundChatMessage, enqueuedAtIso: string): InboxLine;
export interface RouteWriteResult {
    destination: 'umbrella' | 'orphan';
    /** Set when destination === 'umbrella' (the umbrella id or `general`). */
    umbrellaId?: string;
    /** Absolute path the row was appended to. */
    inboxPath: string;
}
/**
 * Resolve `msg` to its umbrella via the FSM and append the inbox row. Telegram
 * only for now (the rich envelope is telegram-sourced); other platforms route
 * to orphan until their adapters emit `InboundChatMessage`. Returns where the
 * row landed.
 */
export declare function routeAndWriteInbound(cfg: ChannelsConfig, msg: InboundChatMessage, enqueuedAtIso: string): Promise<RouteWriteResult>;
export {};
//# sourceMappingURL=transport_inbox.d.ts.map