import { InstanceAiConfirmRequestDto, InstanceAiRenameThreadRequestDto, InstanceAiSendMessageRequest, InstanceAiEventsQuery, InstanceAiCorrectTaskRequest, InstanceAiEnsureThreadRequest, InstanceAiThreadMessagesQuery, InstanceAiAdminSettingsUpdateRequest, InstanceAiUserPreferencesUpdateRequest, InstanceAiEvalExecutionRequest } from '@n8n/api-types';
import { ModuleRegistry } from '@n8n/backend-common';
import { GlobalConfig } from '@n8n/config';
import { AuthenticatedRequest } from '@n8n/db';
import type { NextFunction, Request, Response } from 'express';
import { EvalExecutionService } from './eval/execution.service';
import { InProcessEventBus } from './event-bus/in-process-event-bus';
import { InstanceAiMemoryService } from './instance-ai-memory.service';
import { InstanceAiSettingsService } from './instance-ai-settings.service';
import { InstanceAiService } from './instance-ai.service';
import { Push } from '../../push';
type FlushableResponse = Response & {
    flush?: () => void;
};
export declare class InstanceAiController {
    private readonly instanceAiService;
    private readonly memoryService;
    private readonly settingsService;
    private readonly evalExecutionService;
    private readonly eventBus;
    private readonly moduleRegistry;
    private readonly push;
    private readonly gatewayApiKey;
    private readonly instanceBaseUrl;
    private static getTreeRichnessScore;
    private static selectBootstrapTree;
    constructor(instanceAiService: InstanceAiService, memoryService: InstanceAiMemoryService, settingsService: InstanceAiSettingsService, evalExecutionService: EvalExecutionService, eventBus: InProcessEventBus, moduleRegistry: ModuleRegistry, push: Push, globalConfig: GlobalConfig);
    private requireInstanceAiEnabled;
    stripBrotli(req: Request, _res: Response, next: NextFunction): void;
    chat(req: AuthenticatedRequest, _res: Response, threadId: string, payload: InstanceAiSendMessageRequest): Promise<{
        runId: string;
    }>;
    events(req: AuthenticatedRequest, res: FlushableResponse, threadId: string, query: InstanceAiEventsQuery): Promise<void>;
    confirm(req: AuthenticatedRequest, _res: Response, requestId: string, body: InstanceAiConfirmRequestDto): Promise<{
        ok: boolean;
    }>;
    cancel(req: AuthenticatedRequest, _res: Response, threadId: string): Promise<{
        ok: boolean;
    }>;
    cancelTask(req: AuthenticatedRequest, _res: Response, threadId: string, taskId: string): Promise<{
        ok: boolean;
    }>;
    correctTask(req: AuthenticatedRequest, _res: Response, threadId: string, taskId: string, payload: InstanceAiCorrectTaskRequest): Promise<{
        ok: boolean;
    }>;
    getCredits(req: AuthenticatedRequest): Promise<{
        creditsQuota: number;
        creditsClaimed: number;
    }>;
    getAdminSettings(_req: AuthenticatedRequest): Promise<import("@n8n/api-types").InstanceAiAdminSettingsResponse>;
    updateAdminSettings(_req: AuthenticatedRequest, _res: Response, payload: InstanceAiAdminSettingsUpdateRequest): Promise<import("@n8n/api-types").InstanceAiAdminSettingsResponse>;
    getUserPreferences(req: AuthenticatedRequest): Promise<import("@n8n/api-types").InstanceAiUserPreferencesResponse>;
    updateUserPreferences(req: AuthenticatedRequest, _res: Response, payload: InstanceAiUserPreferencesUpdateRequest): Promise<import("@n8n/api-types").InstanceAiUserPreferencesResponse>;
    listModelCredentials(req: AuthenticatedRequest): Promise<import("@n8n/api-types").InstanceAiModelCredential[]>;
    listServiceCredentials(req: AuthenticatedRequest): Promise<import("@n8n/api-types").InstanceAiModelCredential[]>;
    listThreads(req: AuthenticatedRequest): Promise<import("@n8n/api-types").InstanceAiThreadListResponse>;
    ensureThread(req: AuthenticatedRequest, _res: Response, payload: InstanceAiEnsureThreadRequest): Promise<import("@n8n/api-types").InstanceAiEnsureThreadResponse>;
    deleteThread(req: AuthenticatedRequest, _res: Response, threadId: string): Promise<{
        ok: boolean;
    }>;
    renameThread(req: AuthenticatedRequest, _res: Response, threadId: string, payload: InstanceAiRenameThreadRequestDto): Promise<{
        thread: import("@n8n/api-types").InstanceAiThreadInfo;
    }>;
    getThreadMessages(req: AuthenticatedRequest, _res: Response, threadId: string, query: InstanceAiThreadMessagesQuery): Promise<import("@n8n/api-types").InstanceAiThreadMessagesResponse | {
        nextEventId: number;
        messages: import("@n8n/api-types").InstanceAiMessage[];
        threadId: string;
    }>;
    getThreadStatus(req: AuthenticatedRequest, _res: Response, threadId: string): Promise<import("@n8n/api-types").InstanceAiThreadStatusResponse>;
    executeWithLlmMock(req: AuthenticatedRequest, _res: Response, workflowId: string, payload: InstanceAiEvalExecutionRequest): Promise<import("@n8n/api-types").InstanceAiEvalExecutionResult>;
    createGatewayLink(req: AuthenticatedRequest): Promise<{
        token: string;
        command: string;
    }>;
    gatewayEvents(req: Request, res: FlushableResponse): Promise<void>;
    gatewayInit(req: Request): {
        ok: boolean;
        sessionKey: string;
    } | {
        ok: boolean;
        sessionKey?: undefined;
    };
    gatewayDisconnect(req: Request): {
        ok: boolean;
    };
    gatewayResponse(req: Request, _res: Response, requestId: string): {
        ok: boolean;
    };
    gatewayStatus(req: AuthenticatedRequest): Promise<{
        connected: boolean;
        connectedAt: string | null;
        directory: string | null;
        hostIdentifier: string | null;
        toolCategories: import("@n8n/api-types").ToolCategory[];
    }>;
    private assertThreadAccess;
    private getGatewayKeyHeader;
    private validateGatewayApiKey;
    private writeSseEvent;
}
export {};
