/** * daemon/adapter-registry.ts — Registry of connected adapters + routing engine. * * Phase 1: minimal adapter tracking and commandHandler dispatch. * Phase 2: full BrokerMessage routing with hub -> adapter delivery via IPC. */ import type { BrokerMessage, RouteResult } from "../types/broker.js"; import type { AdapterHealth } from "../types/adapter.js"; import type { CommandContext } from "./command-context.js"; export interface AdapterDescriptor { name: string; socketPath: string; registeredAt: number; } type HubCommandHandler = (text: string, timestamp: number, ctx: CommandContext) => void | Promise; export declare class AdapterRegistry { private readonly adapters; private readonly lastHealth; private pollInterval; private hubCommandHandler; setCommandHandler(handler: HubCommandHandler): void; register(descriptor: AdapterDescriptor): void; unregister(name: string): void; startHealthPolling(intervalMs?: number): void; stopHealthPolling(): void; getAdapterHealth(name: string): AdapterHealth | undefined; getAllHealth(): Map; private pollAllAdapters; private pollAdapter; get(name: string): AdapterDescriptor | undefined; list(): AdapterDescriptor[]; /** * Dispatch an incoming message from an adapter source through the * BrokerMessage routing pipeline. * * Phase 1 called commandHandler directly. Phase 3 creates a proper * BrokerMessage and routes it so PAILot messages flow through the * same adapter pipeline as everything else (PAILot -> hub -> Whazaa). * * Falls back to commandHandler if no adapters are registered (embedded-like). */ dispatchIncoming(source: string, text: string, timestamp: number): void; /** * Route a BrokerMessage to the appropriate adapter. * * Routing logic: * 1. If target is specified and adapter is registered -> deliver to that adapter * 2. If target is specified but not registered -> error * 3. If target is omitted and type is "command" -> run through commandHandler * 4. If target is omitted -> deliver to first registered messaging adapter * 5. If no adapters registered -> error */ route(message: BrokerMessage): Promise; /** * Deliver a BrokerMessage to an adapter via its IPC socket. * * The hub acts as an IPC client, connecting to the adapter's socket * and calling the "deliver" method with the message as payload. */ deliverToAdapter(adapter: AdapterDescriptor, message: BrokerMessage): Promise; } export {}; //# sourceMappingURL=adapter-registry.d.ts.map