import type { TraceProcessorHolderType, TraceProcessorLeaseMode, TraceProcessorLeaseRecord } from './traceProcessorLeaseStore';
import type { TraceProcessorRamBudgetStats } from './traceProcessorRamBudget';
import type { TraceProcessorRuntimeStats } from './workingTraceProcessor';
export declare const TP_SLOW_QUERY_MS_ENV = "SMARTPERFETTO_TP_SLOW_QUERY_MS";
export declare const TP_SHARED_QUEUE_THRESHOLD_ENV = "SMARTPERFETTO_TP_SHARED_QUEUE_THRESHOLD";
export declare const TP_FRONTEND_ACTIVE_MS_ENV = "SMARTPERFETTO_TP_FRONTEND_ACTIVE_MS";
export type TraceProcessorLeaseModeDecisionReason = 'frontend_interactive' | 'manual_register' | 'requested_shared' | 'requested_isolated' | 'quota_low_shared' | 'report_generation' | 'full_analysis' | 'heavy_skill' | 'estimated_slow_query' | 'shared_queue_backlog' | 'frontend_active_long_task' | 'fast_mode' | 'default_shared';
export interface TraceProcessorLeaseModeSignals {
    holderType: TraceProcessorHolderType;
    analysisMode?: string;
    requestedMode?: TraceProcessorLeaseMode;
    estimatedSqlMs?: number;
    heavySkill: boolean;
    longTask: boolean;
    sharedQueueLength: number;
    sharedQueueThreshold: number;
    frontendActive: boolean;
    frontendActiveWithinMs: number;
    slowQueryThresholdMs: number;
    quotaAvailableForNewLeaseBytes?: number;
    estimatedNewLeaseRssBytes?: number;
}
export interface TraceProcessorLeaseModeDecision {
    mode: TraceProcessorLeaseMode;
    reason: TraceProcessorLeaseModeDecisionReason;
    signals: TraceProcessorLeaseModeSignals;
}
export interface TraceProcessorLeaseModeDecisionInput {
    holderType: TraceProcessorHolderType;
    requestedMode?: TraceProcessorLeaseMode;
    analysisMode?: unknown;
    estimatedSqlMs?: unknown;
    heavySkill?: boolean;
    longTask?: boolean;
    sharedQueueLength?: number;
    frontendActive?: boolean;
    quotaAvailableForNewLeaseBytes?: number;
    estimatedNewLeaseRssBytes?: number;
    env?: NodeJS.ProcessEnv;
}
export interface TraceProcessorLeaseModeRuntimeInput extends Omit<TraceProcessorLeaseModeDecisionInput, 'sharedQueueLength' | 'frontendActive' | 'quotaAvailableForNewLeaseBytes'> {
    traceId: string;
    leases?: TraceProcessorLeaseRecord[];
    processors?: TraceProcessorRuntimeStats[];
    ramBudget?: TraceProcessorRamBudgetStats;
    now?: number;
}
export declare function sharedQueueLengthForTrace(traceId: string, processors?: TraceProcessorRuntimeStats[]): number;
export declare function hasRecentFrontendHolder(leases?: TraceProcessorLeaseRecord[], now?: number, activeWithinMs?: number): boolean;
export declare function buildTraceProcessorLeaseModeDecision(input: TraceProcessorLeaseModeRuntimeInput): TraceProcessorLeaseModeDecision;
export declare function decideTraceProcessorLeaseMode(input: TraceProcessorLeaseModeDecisionInput): TraceProcessorLeaseModeDecision;
//# sourceMappingURL=traceProcessorLeaseModeDecision.d.ts.map