import { InstanceAiFeedbackRequestDto, InstanceAiGatewayCapabilitiesDto, InstanceAiGatewayCreateCredentialDto, InstanceAiFilesystemResponseDto, InstanceAiRenameThreadRequestDto, InstanceAiSendMessageRequest, InstanceAiEventsQuery, InstanceAiCorrectTaskRequest, InstanceAiEnsureThreadRequest, InstanceAiThreadMessagesQuery, InstanceAiAdminSettingsUpdateRequest, InstanceAiUserPreferencesUpdateRequest, InstanceAiEvalExecutionRequest, InstanceAiEvalAgentExecutionRequest, InstanceAiEvalCredentialAllowlistRequest, InstanceAiEvalRestoreThreadRequest, InstanceAiEvalSeedDataTableRowsRequest } from '@n8n/api-types'; import type { InstanceAiAdminSettingsResponse } from '@n8n/api-types'; import { ModuleRegistry } from '@n8n/backend-common'; import { GlobalConfig } from '@n8n/config'; import { AuthenticatedRequest, UserRepository } from '@n8n/db'; import type { NextFunction, Request, Response } from 'express'; import { InstanceAiBrowserSessionService } from './browser/instance-ai-browser-session.service'; import { EvalAgentExecutionService } from './eval/agent-execution.service'; import { EvalExecutionService } from './eval/execution.service'; import { EvalThreadCredentialAllowlistService } from './eval/thread-credential-allowlist.service'; import { EvalThreadRestoreService } from './eval/thread-restore.service'; import { DurableEventLog } from './event-bus/durable-event-log'; import { DurableLogMetrics } from './event-bus/durable-log-metrics'; import { InProcessEventBus } from './event-bus/in-process-event-bus'; import { InstanceAiErrorReporterService } from './instance-ai-error-reporter.service'; import { InstanceAiGatewayService } from './instance-ai-gateway.service'; import { InstanceAiMemoryService } from './instance-ai-memory.service'; import { InstanceAiSettingsService } from './instance-ai-settings.service'; import { InstanceAiService } from './instance-ai.service'; import { CredentialsService } from '../../credentials/credentials.service'; import { Push } from '../../push'; import { Publisher } from '../../scaling/pubsub/publisher.service'; import { ProjectService } from '../../services/project.service.ee'; import { UrlService } from '../../services/url.service'; type FlushableResponse = Response & { flush?: () => void; }; export declare class InstanceAiController { private readonly instanceAiService; private readonly gatewayService; private readonly browserSessionService; private readonly memoryService; private readonly settingsService; private readonly evalExecutionService; private readonly evalAgentExecutionService; private readonly evalCredentialAllowlists; private readonly evalThreadRestore; private readonly eventBus; private readonly eventLog; private readonly durableLogMetrics; private readonly moduleRegistry; private readonly push; private readonly urlService; private readonly userRepository; private readonly credentialsService; private readonly projectService; private readonly instanceAiErrorReporter; private readonly publisher; private readonly gatewayApiKey; private readonly durableLogEnabled; private static getTreeRichnessScore; private static selectBootstrapTree; constructor(instanceAiService: InstanceAiService, gatewayService: InstanceAiGatewayService, browserSessionService: InstanceAiBrowserSessionService, memoryService: InstanceAiMemoryService, settingsService: InstanceAiSettingsService, evalExecutionService: EvalExecutionService, evalAgentExecutionService: EvalAgentExecutionService, evalCredentialAllowlists: EvalThreadCredentialAllowlistService, evalThreadRestore: EvalThreadRestoreService, eventBus: InProcessEventBus, eventLog: DurableEventLog, durableLogMetrics: DurableLogMetrics, moduleRegistry: ModuleRegistry, push: Push, urlService: UrlService, userRepository: UserRepository, credentialsService: CredentialsService, projectService: ProjectService, instanceAiErrorReporter: InstanceAiErrorReporterService, publisher: Publisher, globalConfig: GlobalConfig); private requireInstanceAiEnabled; private requireRunDebugEnabled; 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; confirm(req: AuthenticatedRequest, _res: Response, requestId: string): Promise; cancel(req: AuthenticatedRequest, _res: Response, threadId: string): Promise<{ ok: boolean; }>; feedback(req: AuthenticatedRequest, _res: Response, threadId: string, responseId: string, payload: InstanceAiFeedbackRequestDto): 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; updateAdminSettings(req: AuthenticatedRequest, _res: Response, payload: InstanceAiAdminSettingsUpdateRequest): Promise; reloadAdminSettings(): Promise; private applyAdminSettingsSideEffects; getUserPreferences(req: AuthenticatedRequest): Promise; updateUserPreferences(req: AuthenticatedRequest, _res: Response, payload: InstanceAiUserPreferencesUpdateRequest): Promise; listServiceCredentials(_req: AuthenticatedRequest): Promise; listInstanceModelCredentials(_req: AuthenticatedRequest): Promise; listThreads(req: AuthenticatedRequest): Promise; ensureThread(req: AuthenticatedRequest, _res: Response, payload: InstanceAiEnsureThreadRequest): Promise; 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; getThreadStatus(req: AuthenticatedRequest, _res: Response, threadId: string): Promise; getRunDebug(req: AuthenticatedRequest, _res: Response, runId: string): Promise; listThreadDebugRuns(req: AuthenticatedRequest, _res: Response, threadId: string): Promise<{ threadId: string; runs: { runId: string; threadId: string; startedAt: number; stepCount: number; workflowCodeCount: number; label: string | undefined; }[]; }>; executeWithLlmMock(req: AuthenticatedRequest, _res: Response, workflowId: string, payload: InstanceAiEvalExecutionRequest): Promise; executeAgentWithLlmMock(req: AuthenticatedRequest, _res: Response, agentId: string, payload: InstanceAiEvalAgentExecutionRequest): Promise; setThreadCredentialAllowlist(req: AuthenticatedRequest, _res: Response, payload: InstanceAiEvalCredentialAllowlistRequest): Promise<{ ok: boolean; }>; restoreEvalThread(req: AuthenticatedRequest, _res: Response, payload: InstanceAiEvalRestoreThreadRequest): Promise<{ ok: boolean; threadId: string; restored: number; workflowIds: string[]; dataTableIds: string[]; }>; seedEvalDataTableRows(req: AuthenticatedRequest, _res: Response, payload: InstanceAiEvalSeedDataTableRowsRequest): Promise<{ ok: boolean; tableId: string; rowCount: number; }>; createGatewayLink(req: AuthenticatedRequest): Promise<{ token: string; command: string; expiresAt: string | null; ttlSeconds: number | null; }>; gatewayEvents(req: Request, res: FlushableResponse): Promise; gatewayInit(req: Request, _res: Response, payload: InstanceAiGatewayCapabilitiesDto): Promise<{ ok: boolean; sessionKey: string; } | { sessionKey?: undefined; ok: boolean; }>; gatewayDisconnect(req: Request): { ok: boolean; }; gatewayResponse(req: Request, _res: Response, requestId: string, payload: InstanceAiFilesystemResponseDto): { ok: boolean; }; gatewayCreateCredential(req: Request, _res: Response, payload: InstanceAiGatewayCreateCredentialDto): Promise<{ credentialId: string; }>; gatewayStatus(req: AuthenticatedRequest): Promise<{ connected: boolean; connectedAt: string | null; directory: string | null; hostIdentifier: string | null; toolCategories: import("@n8n/api-types").ToolCategory[]; }>; gatewayDisconnectSession(req: AuthenticatedRequest): Promise<{ ok: boolean; }>; createBrowserLink(req: AuthenticatedRequest): Promise; browserStatus(req: AuthenticatedRequest): import("@n8n/api-types").InstanceAiBrowserStatusResponse; browserDisconnectSession(req: AuthenticatedRequest): Promise<{ ok: boolean; }>; private assertBrowserChannelEnabled; private assertThreadAccess; private assertGatewayEnabled; private getGatewayKeyHeader; private validateGatewayApiKey; private resolveGatewayUser; private writeSseEvent; } export {};