/** * Channel Manager — thin composition root for the channel subsystem. * * Wires together the four coordinators that own what used to be the eight * concerns of this 707-line class: * * - {@link ChannelPluginRegistry} — plugins Map, register/get * - {@link ChannelLifecycleSupervisor} — init/start/stop/restart-backoff * - {@link ChannelHeartbeatScheduler} — per-account heartbeat probes * - {@link ChannelOutboundSender} — TTS rewrite + persist + delivery * * The public surface (`registerPlugin`, `initialize`, `start`, `send`, etc.) is * preserved so callers (`GatewayService`, CLI commands, channel plugins) are * unchanged. */ import type { Config } from '../config/schema.js'; import type { MessageBus } from '../infra/bus/index.js'; import type { InboundMessage, OutboundMessage } from './transport-types.js'; import type { ChannelPlugin, ChannelPluginSessionModelHooks, ChannelStreamHandle } from './plugin-types.js'; import { ChannelHealthMonitor, type ChannelHealthState } from './health-monitor.js'; import { type OutboundChannelHooks } from './outbound-sender.js'; export type { OutboundChannelHooks } from './outbound-sender.js'; export declare class ChannelManager { private config; private readonly registry; private readonly healthMonitor; private readonly lifecycle; private readonly heartbeat; private readonly outbound; private sessionModelHooks?; constructor(config: Config, bus: MessageBus); setOutboundHooks(hooks: OutboundChannelHooks): void; /** Call before `initialize()` so plugins can persist per-session model overrides. */ setSessionModelHooks(hooks: ChannelPluginSessionModelHooks | undefined): void; enableOutboundPersistence(agentDir: string): void; registerPlugin(plugin: ChannelPlugin): void; getPlugin(id: string): ChannelPlugin | undefined; getAllPlugins(): ChannelPlugin[]; /** Backward-compat alias for `getAllPlugins`. */ getAllChannels(): ChannelPlugin[]; /** Channel IDs whose runtime reports connected (e.g. Telegram polling active). */ getRunningChannels(): string[]; initialize(): Promise; initializeChannel(channelId: string): Promise; start(options?: { deferConnectPluginIds?: ReadonlySet; }): Promise; startDeferredConnects(): Promise; stop(): Promise; stopChannel(channelId: string): Promise; startChannel(channelId: string): Promise; listDeferConnectChannelIds(cfg: Config): string[]; send(msg: OutboundMessage, options?: { skipPersist?: boolean; }): Promise; replayPendingOutboundMessages(): Promise; startStream(channel: string, chatId: string, accountId?: string, opts?: { threadId?: string; replyToMessageId?: string; }): ChannelStreamHandle | null; getChannelStatus(channel: string): Promise>; /** * Optional channel hook before `AgentService` consumes an inbound message * (e.g. Feishu card-action triggers). */ dispatchInboundMessageAction(msg: InboundMessage): Promise; updateConfig(config: Config): Promise; /** Replace in-memory config without running plugin `onConfigUpdated` hooks. */ setRuntimeConfig(config: Config): void; getRuntimeSnapshot(): { initialized: boolean; running: boolean; pluginIds: string[]; initializedPluginIds: string[]; manuallyStopped: string[]; restartAttempts: Record; channelHealth: Record; }; getHealthMonitor(): ChannelHealthMonitor; } export declare function createChannelManager(config: Config, bus: MessageBus): ChannelManager;