/** * UDSServer — Cross-platform IPC server (Unix Domain Socket / Named Pipe) * * Implements the IIPCServer interface for PTYIPCBridge. * Handles: * - net.createServer on UDS (macOS/Linux) or Named Pipe (Windows) * - Connection lifecycle (accept, track, close) * - Wire format decode/encode (length-prefixed MessagePack) * - Hello/welcome handshake (intercepted before routing) * - Heartbeat/heartbeat:ack (intercepted before routing) * - Namespace-based message routing to endpoint handlers * - Socket file cleanup (Unix only; named pipes auto-cleanup) * * Ported from p008-claude-on-the-go/packages/desktop IPCServiceImpl. */ import { EventEmitter } from 'events'; import type { IMessageBus } from './ipc-transport.js'; import type { IIPCServer } from './ipc-bridge.js'; export interface UDSServerConfig { socketPath: string; maxConnections?: number; connectionTimeout?: number; } /** * Handler for namespace-routed messages. */ export type NamespaceHandler = (connectionId: string, message: { namespace: string; type: string; payload: unknown; }) => void; export declare class UDSServer extends EventEmitter implements IIPCServer { private server; private connections; private config; private endpoints; private messageBus; constructor(); getMessageBus(): IMessageBus | null; start(config: UDSServerConfig): void; stop(): void; isRunning(): boolean; dispose(): void; isNamedPipe(): boolean; getConnectionCount(): number; closeConnection(connectionId: string): void; /** * Register a namespace endpoint handler. * Returns an unsubscribe function. */ registerEndpoint(namespace: string, handler: NamespaceHandler): () => void; /** * Send a namespaced message to a specific connection using MessagePack framing. */ sendNamespaced(connectionId: string, namespace: string, type: string, payload?: unknown): boolean; private handleConnection; private handleData; private handleHello; private handleHeartbeat; } export declare function createUDSServer(): UDSServer; //# sourceMappingURL=uds-server.d.ts.map