/**
 * JSON-RPC Protocol for code-buddy External Integration
 *
 * This protocol is designed for loose coupling - any client can use it.
 * No dependencies on FileCommander or any specific application.
 *
 * Transport: stdin/stdout (line-delimited JSON)
 * Protocol: JSON-RPC 2.0
 */
export interface JsonRpcRequest {
    jsonrpc: '2.0';
    id: string | number;
    method: string;
    params?: Record<string, unknown>;
}
export interface JsonRpcResponse {
    jsonrpc: '2.0';
    id: string | number;
    result?: unknown;
    error?: JsonRpcError;
}
export interface JsonRpcError {
    code: number;
    message: string;
    data?: unknown;
}
export interface JsonRpcNotification {
    jsonrpc: '2.0';
    method: string;
    params?: Record<string, unknown>;
}
export declare const ErrorCodes: {
    readonly PARSE_ERROR: -32700;
    readonly INVALID_REQUEST: -32600;
    readonly METHOD_NOT_FOUND: -32601;
    readonly INVALID_PARAMS: -32602;
    readonly INTERNAL_ERROR: -32603;
    readonly NOT_INITIALIZED: -32001;
    readonly OPERATION_CANCELLED: -32002;
    readonly TIMEOUT: -32003;
    readonly FILE_NOT_FOUND: -32004;
    readonly PERMISSION_DENIED: -32005;
    readonly AI_ERROR: -32006;
    readonly TOOL_ERROR: -32007;
};
export interface ServerCapabilities {
    version: string;
    methods: string[];
    features: {
        ai: boolean;
        tools: boolean;
        fcs: boolean;
        streaming: boolean;
    };
}
export interface InitializeParams {
    clientName: string;
    clientVersion: string;
    capabilities?: {
        streaming?: boolean;
    };
}
export interface InitializeResult {
    serverName: string;
    serverVersion: string;
    capabilities: ServerCapabilities;
}
export interface AiCompleteParams {
    prompt: string;
    context?: {
        file?: string;
        language?: string;
        prefix?: string;
        suffix?: string;
    };
    options?: {
        maxTokens?: number;
        temperature?: number;
        model?: string;
    };
}
export interface AiCompleteResult {
    text: string;
    model: string;
    usage?: {
        promptTokens: number;
        completionTokens: number;
        totalTokens: number;
    };
}
export interface AiChatParams {
    message: string;
    conversationId?: string;
    context?: string[];
}
export interface AiChatResult {
    response: string;
    conversationId: string;
    model: string;
}
export interface ToolDefinition {
    name: string;
    description: string;
    parameters: {
        type: 'object';
        properties: Record<string, {
            type: string;
            description: string;
            required?: boolean;
        }>;
        required?: string[];
    };
}
export interface ToolsListResult {
    tools: ToolDefinition[];
}
export interface ToolsCallParams {
    name: string;
    arguments: Record<string, unknown>;
}
export interface ToolsCallResult {
    success: boolean;
    result?: unknown;
    error?: string;
}
export interface FcsExecuteParams {
    script: string;
    config?: {
        workdir?: string;
        timeout?: number;
        dryRun?: boolean;
    };
}
export interface FcsExecuteResult {
    success: boolean;
    output: string[];
    returnValue?: unknown;
    error?: string;
    duration: number;
}
export interface FcsParseParams {
    script: string;
}
export interface FcsParseResult {
    valid: boolean;
    ast?: unknown;
    errors?: Array<{
        line: number;
        column: number;
        message: string;
    }>;
}
export interface ContextAddParams {
    files: string[];
}
export interface ContextAddResult {
    added: string[];
    failed: Array<{
        file: string;
        reason: string;
    }>;
    totalSize: number;
}
export interface ContextListResult {
    files: Array<{
        path: string;
        size: number;
    }>;
    totalSize: number;
}
export interface ContextClearResult {
    cleared: number;
}
export interface ProgressNotification {
    taskId: string;
    progress: number;
    message?: string;
}
export interface OutputNotification {
    stream: 'stdout' | 'stderr';
    text: string;
}
export interface LogNotification {
    level: 'debug' | 'info' | 'warn' | 'error';
    message: string;
    timestamp: string;
}
export type MethodMap = {
    'initialize': {
        params: InitializeParams;
        result: InitializeResult;
    };
    'shutdown': {
        params: undefined;
        result: null;
    };
    'ai/complete': {
        params: AiCompleteParams;
        result: AiCompleteResult;
    };
    'ai/chat': {
        params: AiChatParams;
        result: AiChatResult;
    };
    'ai/clearHistory': {
        params: {
            conversationId?: string;
        };
        result: {
            cleared: boolean;
        };
    };
    'tools/list': {
        params: undefined;
        result: ToolsListResult;
    };
    'tools/call': {
        params: ToolsCallParams;
        result: ToolsCallResult;
    };
    'fcs/execute': {
        params: FcsExecuteParams;
        result: FcsExecuteResult;
    };
    'fcs/parse': {
        params: FcsParseParams;
        result: FcsParseResult;
    };
    'context/add': {
        params: ContextAddParams;
        result: ContextAddResult;
    };
    'context/list': {
        params: undefined;
        result: ContextListResult;
    };
    'context/clear': {
        params: undefined;
        result: ContextClearResult;
    };
    'git/status': {
        params: undefined;
        result: {
            status: string;
            branch: string;
        };
    };
    'git/diff': {
        params: {
            staged?: boolean;
        };
        result: {
            diff: string;
        };
    };
};
export declare function createRequest<M extends keyof MethodMap>(id: string | number, method: M, params?: MethodMap[M]['params']): JsonRpcRequest;
export declare function createResponse<T>(id: string | number, result: T): JsonRpcResponse;
export declare function createErrorResponse(id: string | number, code: number, message: string, data?: unknown): JsonRpcResponse;
export declare function createNotification(method: string, params?: Record<string, unknown>): JsonRpcNotification;
export declare function isRequest(msg: unknown): msg is JsonRpcRequest;
export declare function isNotification(msg: unknown): msg is JsonRpcNotification;
