/**
 * chat-transport daemon worker (T-CHAT-AS-TERMINAL CAT.1b).
 *
 * The long-running process spawned (detached) by `./lifecycle.startDaemon`.
 * Ported from `src.legacy/chat/daemon/worker.ts` onto the new-tree primitives.
 *
 * Lifecycle inside the worker:
 *   1. Write the pidfile (`chat-daemon.pid`) FIRST so a post-spawn status check
 *      sees the worker promptly.
 *   2. Load the umbrella routing config (`loadChannelsConfig`) + build the
 *      transport adapters (`buildChatAdapters`).
 *   3. Subscribe the telegram adapter's RICH transport surface
 *      (`subscribeTransport`) → `routeAndWriteInbound(channelsConfig, msg, now)`
 *      — the inbound path that writes umbrella-keyed inbox rows. (Inbound
 *      DELIVERY to sessions is the file-tail watcher's job, not the daemon's.)
 *   4. `gateway.start()` (kicks the long-poll loops) + start the RPC server
 *      (outbound `send` + `ping` + `list_channels` + `create_topic`).
 *   5. SIGTERM/SIGINT → graceful shutdown: stop adapters, close the server,
 *      remove pidfile + socket.
 *   6. Park on a long no-op interval so the event loop stays alive.
 *
 * Degradation: if `channelsConfig` is null (absent/malformed channels.json) the
 * worker still serves OUTBOUND (gateway.send works) — only inbound routing is
 * affected, and every inbound message orphans (routeAndWriteInbound writes to
 * the orphan inbox when the config can't resolve an umbrella). We pass an empty
 * `{ v:1, umbrellas:[] }` config in that case so every message orphans cleanly
 * rather than crashing the handler.
 *
 * Imports from: node:fs, grammy, ../config, ../factory, ../gateway, ../routing,
 *   ../transport_inbox, ../../runtime/paths, ./protocol, ./rpc_server.
 * Imported by: ./lifecycle.ts (as the worker entry) + tests. NOT wired into the
 * CLI yet (CAT.1d owns CLI/autospawn).
 */
import { type ChannelsConfig } from '../routing.js';
import type { ChannelAdapter, InboundChatMessage } from '../types.js';
/**
 * Wire one rich-transport adapter's `subscribeTransport` to the umbrella inbox
 * writer. Extracted from `runDaemonWorker` as a pure, testable seam: given a
 * subscribe-capable adapter + a channels config, every emitted
 * `InboundChatMessage` is routed + written via `routeAndWriteInbound`. Returns
 * the subscription (caller owns unsubscribe), or null when the adapter has no
 * transport surface.
 */
export declare function wireInboundTransport(adapter: Pick<ChannelAdapter, 'subscribeTransport'>, routingConfig: ChannelsConfig, onError?: (msg: InboundChatMessage, err: unknown) => void): Promise<{
    unsubscribe(): Promise<void>;
} | null>;
export declare function runDaemonWorker(): Promise<never>;
//# sourceMappingURL=worker.d.ts.map