/** * Message router — the core wiring between messenger transports and pi RPC. * * Shared by the standalone entry (and testable in isolation with a mock transport): * incoming messenger message ──> router ──> RPC command / prompt * agent events ────────────────> router ──> reply back to the messenger */ import type { ChallengeAuth } from "../auth/challenge-auth.js"; import type { TransportManager } from "../transports/manager.js"; import type { ExternalMessage, PendingRemoteChat } from "../types.js"; import type { PiRpc } from "./pi-rpc.js"; import type { ProjectManager } from "./project-manager.js"; export interface MessageRouterDeps { rpc: PiRpc; /** Multi-project routing: resolves the PiRpc for a room (default when unmapped). */ projectManager: ProjectManager; auth: ChallengeAuth; transportManager: TransportManager; /** Send a text reply to a chat via a transport (errors swallowed by caller) */ sendReply: (chatId: string, transport: string, text: string) => Promise; log: (...args: unknown[]) => void; debug: boolean; } export interface MessageRouter { /** Handle an incoming messenger message */ handleIncoming(msg: ExternalMessage): Promise; /** Handle an agent event (from pi RPC). roomId = the room that owns the * pi process (project rooms); omitted for the shared default Rpc. */ handleEvent(event: unknown, roomId?: string): void; /** Chat that the current/last turn belongs to */ pendingRemoteChat: PendingRemoteChat | null; } export declare function createMessageRouter(deps: MessageRouterDeps): MessageRouter; //# sourceMappingURL=message-router.d.ts.map