import type Database from 'better-sqlite3';
import type { RequestContext } from '../middleware/auth';
import { type EnterpriseRepositoryScope } from './enterpriseRepository';
import { type TraceProcessorLeaseRecord, type TraceProcessorLeaseState, type TraceProcessorHolderType } from './traceProcessorLeaseStore';
import { TraceProcessorFactory } from './workingTraceProcessor';
type TraceProcessorFactoryStats = ReturnType<typeof TraceProcessorFactory.getStats>;
interface ModelUsageStats {
    calls: number;
    tokens: number;
    cost: number;
    failures: number;
}
interface ModelRouterUsageSnapshot {
    stats: Record<string, ModelUsageStats>;
    totalCost: number;
}
export interface EnterpriseRuntimeDashboardDependencies {
    now?: () => number;
    eventLimit?: number;
    openDb?: () => Database.Database;
    listLeases?: (scope: EnterpriseRepositoryScope) => TraceProcessorLeaseRecord[];
    traceProcessorStatsProvider?: () => TraceProcessorFactoryStats;
    modelRouterUsageProvider?: () => ModelRouterUsageSnapshot;
}
export declare function buildEnterpriseRuntimeDashboard(context: RequestContext, deps?: EnterpriseRuntimeDashboardDependencies): {
    success: boolean;
    generatedAt: string;
    scope: {
        tenantId: string;
        workspaceId: string;
        userId: string;
    };
    leases: {
        count: number;
        activeCount: number;
        holderCount: number;
        totalRssBytes: number;
        countsByState: Partial<Record<TraceProcessorLeaseState, number>>;
        countsByHolderType: Partial<Record<TraceProcessorHolderType, number>>;
        items: {
            id: string;
            traceId: string;
            mode: import("./traceProcessorLeaseStore").TraceProcessorLeaseMode;
            state: TraceProcessorLeaseState;
            rssBytes: number | null;
            heartbeatAt: number | null;
            expiresAt: number | null;
            queueLength: number;
            holderCount: number;
            holderTypes: TraceProcessorHolderType[];
        }[];
    };
    processors: {
        count: number;
        traceIds: string[];
        queueTotals: {
            queuedP0: number;
            queuedP1: number;
            queuedP2: number;
            total: number;
        };
        rssTotals: {
            observedProcessorRssBytes: number;
            unknownRssProcessorCount: number;
        };
        ramBudget: import("./traceProcessorRamBudget").TraceProcessorRamBudgetStats;
        items: {
            kind: "owned_process" | "external_rpc";
            processorId: string;
            traceId: string;
            leaseId: string | undefined;
            leaseMode: string | undefined;
            status: "error" | "ready" | "initializing" | "busy";
            activeQueries: number;
            rssBytes: number | null;
            startupRssBytes: number | null | undefined;
            peakRssBytes: number | null | undefined;
            lastRssSampleAt: number | null | undefined;
            rssSampleSource: "procfs" | "ps" | "unavailable" | "external";
            sqlWorker: {
                running: boolean;
                queuedP0: number;
                queuedP1: number;
                queuedP2: number;
                usesWorkerThread: boolean;
            } | undefined;
        }[];
    };
    events: {
        recentAgentEvents: {
            runId: string;
            cursor: number;
            eventType: string;
            createdAt: number;
        }[];
        recentAuditEvents: {
            action: string;
            resourceType: string;
            resourceId: string | null;
            actorUserId: string | null;
            workspaceId: string | null;
            createdAt: number;
        }[];
    };
    llmCost: {
        totalCost: number;
        totalCalls: number;
        totalTokens: number;
        totalFailures: number;
        byModel: Record<string, ModelUsageStats>;
    };
};
export {};
//# sourceMappingURL=enterpriseRuntimeDashboardService.d.ts.map