import { EventEmitter } from 'events';
export interface CopilotCompletionRequest {
    prompt: string;
    suffix?: string;
    max_tokens?: number;
    temperature?: number;
    top_p?: number;
    n?: number;
    stop?: string[];
    language?: string;
    file_path?: string;
}
export interface CopilotCompletionResponse {
    id: string;
    choices: Array<{
        text: string;
        index: number;
        finish_reason: 'stop' | 'length';
    }>;
    usage?: {
        prompt_tokens: number;
        completion_tokens: number;
        total_tokens: number;
    };
}
export interface CopilotProxyConfig {
    port: number;
    host: string;
    /** Auth token — if not set, authentication is DISABLED (use with caution) */
    authToken?: string;
    /** Require authentication even if authToken is not set */
    requireAuth?: boolean;
    maxTokens: number;
    /** Absolute max tokens a client can request */
    maxTokensLimit?: number;
    /** Rate limit: max requests per minute per IP */
    rateLimitPerMinute?: number;
    onCompletion: (req: CopilotCompletionRequest) => Promise<CopilotCompletionResponse>;
}
export declare class CopilotProxy extends EventEmitter {
    private server;
    private config;
    private requestCount;
    /** Rate limiter: IP → { count, windowStart } */
    private rateLimitMap;
    private rateLimitCleanupTimer;
    constructor(config: CopilotProxyConfig);
    start(): Promise<void>;
    private handleRequest;
    private parseBody;
    private authenticate;
    /**
     * Token-bucket rate limiter per IP.
     */
    private checkRateLimit;
    getRequestCount(): number;
    isRunning(): boolean;
    stop(): Promise<void>;
}
