type SlowQueryExecutionOverride = Record<string, any>;
type SlowQueryLogModel = Record<string, any>;
export interface TokenEligibilityResult {
    eligible: boolean;
    reason?: string;
}
export type CheckAICoderTokenEligibilityFn = Function;
export interface SlowQueryVerifierDependencies {
    ClientDBs?: any;
    Clients?: any;
    SlowQueryLogs: any;
    AICoderApps?: any;
    AIDashboardJobs?: any;
    checkAICoderTokenEligibility?: CheckAICoderTokenEligibilityFn;
}
export declare function registerSlowQueryVerifierDependencies(dependencies: SlowQueryVerifierDependencies): void;
interface ExplainStageSummary {
    stage: string;
    path: string;
    executionTimeMs?: number;
    docsExamined?: number;
    keysExamined?: number;
    nReturned?: number;
}
export declare function ensureSlowQueryVerifier(serverConfig?: any): SlowQueryVerifier | null;
interface ExplainResult {
    durationMs: number;
    explainPlan: Record<string, any>;
    explainStats: Record<string, any>;
    stageSummaries: ExplainStageSummary[];
}
export declare class SlowQueryVerifier {
    private readonly _timer?;
    private readonly config;
    private readonly autoOptimizeInFlight;
    private readonly autoOptimizeDependenciesAvailable;
    private static readonly APP_SETTINGS_CACHE_TTL_MS;
    private appSettingsAutoOptimizeCacheExpiresAt;
    private appSettingsAutoOptimizeCacheValue;
    constructor(serverConfig?: any, dependencies?: Partial<SlowQueryVerifierDependencies>);
    private static resolveConfig;
    private parseBooleanEnv;
    private resolveAutoOptimizeEnabled;
    private poll;
    private processCandidate;
    generateExplainForLog(logId: string): Promise<void>;
    runLog(logId: string, options?: {
        force?: boolean;
    }): Promise<{
        status: 'in_progress' | 'success' | 'failed' | 'updated' | 'not_found';
        reason?: string;
        log?: SlowQueryLogModel;
    }>;
    queueLogRun(logId: string, options?: {
        force?: boolean;
    }): Promise<{
        status: 'in_progress' | 'not_found' | 'failed';
        reason?: string;
        log?: SlowQueryLogModel;
    }>;
    deployLog(logId: string): Promise<{
        status: 'success' | 'failed' | 'not_found';
        reason?: string;
        log?: SlowQueryLogModel;
    }>;
    private runLogWithRetries;
    private shouldRetryForOutputMismatch;
    private runExplain;
    measureQuery(log: SlowQueryLogModel, overrides?: SlowQueryExecutionOverride): Promise<ExplainResult>;
    private handleExplainResult;
    private handleExplainError;
    private assignSlowQueryCounter;
    private scheduleAutoOptimization;
    private runAutoOptimizationInBackground;
    private escapeRegex;
    private getEscalationRecipients;
    private sendSlowQueryEscalationNotice;
    private resolveSlowQueryClientTarget;
    private buildLocalInternalUserCriteria;
    private buildLocalAdminUserCriteria;
    private resolveLocalNotificationUserIds;
    private isGeneratedAICoderClient;
    private buildAICoderSlowQuerySummary;
    private buildResolveIOProjectSlowQueryDetails;
    private notifyCustomerSlowQueryStatus;
    private parseDate;
    private resolveFingerprintScopeKey;
    private buildFingerprintMatchQuery;
    private countAttemptsWithinWindow;
    private resolveFingerprintAttemptsInWindow;
    private resolveCooldownDeadline;
    private markAutoOptimizeCooldownActive;
    private markAutoOptimizeTokenIneligible;
    private markAutoOptimizeBudgetExceeded;
    private maybeStopAutoOptimizeAfterFailure;
    private shouldFallbackDashboardMethod;
    private createDashboardJob;
    private waitForDashboardJobStop;
    private isDashboardJobRunning;
    private publishDashboardJob;
    private evaluateDashboardPublishOutcome;
    private resolveBaselineDurationMs;
    private static collectMetricValues;
    private static asNonNegativeNumber;
    private static maxNumber;
    private static sortStageSummaries;
    private static collectExecutionTreeStages;
    private static extractStageSummaries;
    private resolveExecutionMetrics;
    private evaluateOptimizationOutcome;
    private formatStageSummaryForPrompt;
    private buildSlowQueryAutoOptimizeDescription;
    private resolveAutoOptimizeRepoSlug;
    private resolveAutoOptimizeRepoPath;
    private static queryHasExplicitSort;
    private static countLookupExprInPattern;
    private static buildBoundedPipelineForOutputCompare;
    private static buildBoundedFindOptionsForOutputCompare;
    private static normalizeOutputValue;
    private static digestOutputDocument;
    private captureOutputFingerprint;
    private compareOutputEquivalence;
    private resolveAutoOptimizeApp;
    private runAutoOptimization;
    private resolveClientDB;
    private resolveExplainTarget;
    private static extractPipelineFromLog;
    private static applyQueryOverrides;
    private static extractPipelineOptions;
    private static extractFindOptions;
    private static resolveDurationMs;
    private static pipelineHasWriteStage;
    private static extractAggregateOptions;
    private static buildAggregateExplainCommand;
    private static isAggregateExplainWriteConcernError;
    private static isBsonObjectTooLargeError;
    private static isValidDuration;
    private static buildFindCursor;
    private static measureExecution;
    private static normalizeExplainPayload;
    private static sanitizeExplainPayload;
    private static deepClone;
}
export {};
