/** * Agentic QE v3 - Stdio Transport * JSON-RPC 2.0 over stdin/stdout for MCP protocol * Based on claude-flow MCP implementation */ import { Readable, Writable } from 'stream'; export interface JSONRPCRequest { jsonrpc: '2.0'; id?: string | number; method: string; params?: Record; } export interface JSONRPCResponse { jsonrpc: '2.0'; id: string | number | null; result?: unknown; error?: JSONRPCError; } export interface JSONRPCError { code: number; message: string; data?: unknown; } export interface TransportConfig { maxMessageSize?: number; inputStream?: Readable; outputStream?: Writable; } export interface TransportMetrics { messagesReceived: number; messagesSent: number; errors: number; bytesReceived: number; bytesSent: number; } export type RequestHandler = (request: JSONRPCRequest) => Promise; export type NotificationHandler = (notification: JSONRPCRequest) => Promise; export declare const JSON_RPC_ERRORS: { readonly PARSE_ERROR: -32700; readonly INVALID_REQUEST: -32600; readonly METHOD_NOT_FOUND: -32601; readonly INVALID_PARAMS: -32602; readonly INTERNAL_ERROR: -32603; readonly SERVER_ERROR: -32000; }; export declare class StdioTransport { private readonly inputStream; private readonly outputStream; private readonly maxMessageSize; private rl; private requestHandler; private notificationHandler; private running; private metrics; constructor(config?: TransportConfig); /** * Set handler for requests (messages with id) */ onRequest(handler: RequestHandler): void; /** * Set handler for notifications (messages without id) */ onNotification(handler: NotificationHandler): void; /** * Start listening for messages */ start(): void; /** * Stop listening */ stop(): void; /** * Send a response */ sendResponse(response: JSONRPCResponse): Promise; /** * Send a notification (no id) */ sendNotification(method: string, params?: Record): Promise; /** * Get transport metrics */ getMetrics(): TransportMetrics; /** * Check if transport is running */ isRunning(): boolean; private handleLine; private handleRequest; private handleNotification; private sendError; private write; } export declare function createStdioTransport(config?: TransportConfig): StdioTransport; //# sourceMappingURL=stdio.d.ts.map