/** * LocalTuiChannelAdapter — the first reference {@link ChannelAdapter} (T11952). * * A fully-offline, daemon-OFF terminal channel that rides the EXISTING conduit * {@link Transport} (the project-local `LocalTransport` over conduit.db). It * needs no network and no platform credential: the single local operator on the * other end of stdin/stdout is treated as a verified sender. * * The adapter translates between the channel-native surface and the normalized * {@link InboundMsg} / {@link OutboundReply} shapes the {@link DeliveryRouter} * consumes. It does NOT reinvent the transport — every wire operation delegates * to the injected {@link Transport} (push/poll/subscribe), so the SAME adapter * works over `LocalTransport` in production and an in-memory transport in tests. * * Platform adapters (Telegram/Discord/Slack/WhatsApp — T11855) implement the * same {@link ChannelAdapter} contract but are credential+network gated and are * out of scope for this contained increment. * * @epic T11854 * @saga T10419 * @module conduit/local-tui-adapter */ import type { ChannelAdapter, ChannelConfig, ChannelHealth, InboundMsg, OutboundReply, Transport, TransportConnectConfig } from '@cleocode/contracts'; /** Default channel id for the Local-TUI adapter. */ export declare const LOCAL_TUI_CHANNEL_ID = "local-tui"; /** Options for constructing a {@link LocalTuiChannelAdapter}. */ export interface LocalTuiChannelAdapterOptions { /** The transport this channel rides (e.g. conduit `LocalTransport`). */ transport: Transport; /** Transport connect config (agentId / apiKey / apiBaseUrl). */ connectConfig: TransportConnectConfig; /** Per-channel configuration. */ config?: ChannelConfig; /** Channel id override (defaults to {@link LOCAL_TUI_CHANNEL_ID}). */ id?: string; } /** * Local terminal channel adapter over a conduit {@link Transport}. * * @see T11952 */ export declare class LocalTuiChannelAdapter implements ChannelAdapter { readonly id: string; readonly config: ChannelConfig; private readonly transport; private readonly connectConfig; private status; private detail; private unsubscribe; private queue; /** Create a Local-TUI channel adapter. */ constructor(options: LocalTuiChannelAdapterOptions); /** * Connect the transport and begin buffering inbound messages. * * Idempotent: a second `start()` while already connected is a no-op. */ start(): Promise; /** Detach the subscription, end the inbound stream, and disconnect. */ stop(): Promise; /** * Stream inbound messages as they arrive on the transport. * * Yields each {@link InboundMsg} until {@link LocalTuiChannelAdapter.stop} * ends the iterator. When the transport lacks `subscribe()`, falls back to a * single drain of `poll()` so the channel is still usable. */ receive(): AsyncIterable; /** * Send a reply back to the channel over the transport. * * @param reply - The reply. The destination session resolves from * `reply.sessionKey` then `config.homeChannel` then the default TTY session. */ send(reply: OutboundReply): Promise; /** Sample the adapter's current health. */ health(): ChannelHealth; /** Push a transport message onto the inbound queue (after policy filtering). */ private onTransportMessage; /** * Normalize a {@link ConduitMessage} into an {@link InboundMsg}, applying the * channel's allowlist + require-mention policy. Returns `undefined` when the * message is filtered out. */ private toInbound; /** Whether the message content mentions the connected agent id. */ private mentionsAgent; } //# sourceMappingURL=local-tui-adapter.d.ts.map