/** * WSServer — Lightweight WebSocket server running on the React Native device. * * Since we're building a JS-only library (no native modules), we implement * a simple WebSocket server using React Native's built-in networking. * The server accepts connections from CLI clients and routes messages * to the CommandHandler. * * Implementation: We use a polyfill-based approach where the RN app acts * as a WebSocket server via a TCP server. For the v1 JS-only approach, * we'll leverage the Metro dev server's message channel or a simple * HTTP polling fallback that works without native TCP sockets. * * This module provides a transport-agnostic server interface. */ import type { AgentKitConfig } from './types'; export declare class BridgeServer { private config; private commandHandler; private isRunning; private pollingClients; private pollTimeout; private pendingRequests; constructor(config: AgentKitConfig); /** * Start the bridge server. * Registers global message handlers that CLI tools can invoke. */ start(): void; /** * Stop the bridge server. */ stop(): void; /** * Process a raw JSON message string and return response JSON. */ processMessage(messageJson: string): Promise; /** * Broadcast a response to all connected clients. */ private broadcast; /** * Register global functions that external tools can call to communicate. * * This approach works across all RN environments: * - Expo: via Expo Dev Tools custom messages * - Bare RN: via Metro dev server / debugging protocol * - Release builds: via native bridge injection (future) * * The global functions: * - __AGENTKIT_SEND__(json): Send a command, returns response promise * - __AGENTKIT_STATUS__(): Check if bridge is running * - __AGENTKIT_PORT__: Port number for reference */ private registerGlobalHandler; private unregisterGlobalHandler; private cleanupStaleClients; get running(): boolean; } //# sourceMappingURL=WSServer.d.ts.map