/**
 * Local REST API Server
 *
 * Provides a REST API for external scripts to interact with Code Buddy:
 * - Send prompts and receive responses
 * - Execute tools
 * - Manage sessions
 * - Query status and metrics
 */
import { EventEmitter } from 'events';
export interface ApiRequest {
    method: string;
    path: string;
    query: Record<string, string>;
    body: unknown;
    headers: Record<string, string>;
}
export interface ApiResponse {
    status: number;
    body: unknown;
    headers?: Record<string, string>;
}
export type RouteHandler = (req: ApiRequest) => Promise<ApiResponse>;
export interface ApiServerConfig {
    port?: number;
    host?: string;
    enableCors?: boolean;
    apiKey?: string;
    maxRequestSize?: number;
}
/**
 * REST API Server
 */
export declare class RestApiServer extends EventEmitter {
    private config;
    private server;
    private routes;
    private isRunning;
    onPrompt?: (prompt: string, options?: Record<string, unknown>) => Promise<string>;
    onToolExecute?: (tool: string, params: Record<string, unknown>) => Promise<unknown>;
    onGetSessions?: () => Promise<unknown[]>;
    onGetMetrics?: () => Promise<unknown>;
    constructor(config?: ApiServerConfig);
    /**
     * Setup default API routes
     */
    private setupDefaultRoutes;
    /**
     * Add a route handler
     */
    addRoute(method: string, path: string, handler: RouteHandler): void;
    /**
     * Get list of endpoints
     */
    getEndpoints(): Array<{
        method: string;
        path: string;
    }>;
    /**
     * Start the server
     */
    start(): Promise<void>;
    /**
     * Stop the server
     */
    stop(): Promise<void>;
    /**
     * Handle incoming request
     */
    private handleRequest;
    /**
     * Parse request body
     */
    private parseBody;
    /**
     * Find route handler
     */
    private findHandler;
    /**
     * Send response
     */
    private sendResponse;
    /**
     * Get server address
     */
    getAddress(): string;
    /**
     * Check if running
     */
    isServerRunning(): boolean;
}
/**
 * Get or create API server
 */
export declare function getApiServer(config?: ApiServerConfig): RestApiServer;
/**
 * Start API server
 */
export declare function startApiServer(config?: ApiServerConfig): Promise<RestApiServer>;
/**
 * Stop API server
 */
export declare function stopApiServer(): Promise<void>;
export default RestApiServer;
