/**
 * Dashboard Data Service
 *
 * Extracts structured data from all UAP subsystems for consumption
 * by both the CLI dashboard and the web overlay.
 */
import { type PerformanceMetrics } from '../utils/performance-monitor.js';
export interface TimeSeriesPoint {
    timestamp: string;
    tasks: {
        total: number;
        done: number;
        inProgress: number;
        blocked: number;
        open: number;
    };
    coordination: {
        activeAgents: number;
        totalAgents: number;
        completedAgents: number;
        patternHits: number;
        activeWorktrees: number;
    };
    deployBuckets: DeployBucketData;
    compression: {
        rawBytes: number;
        contextBytes: number;
        savingsPercent: string;
        totalCalls: number;
    };
    memoryHitsMisses: MemoryHitMissData;
    compliance: {
        totalChecks: number;
        totalBlocks: number;
        blockRate: string;
    };
}
export declare function getTimeSeriesHistory(cwd: string): TimeSeriesPoint[];
export declare function pushTimeSeriesPoint(cwd: string, point: TimeSeriesPoint): void;
export interface PolicyData {
    id: string;
    name: string;
    category: string;
    level: string;
    enforcementStage: string;
    isActive: boolean;
    tags: string[];
    priority: number;
}
export interface PolicyFileData {
    filename: string;
    name: string;
    category: string;
    path: string;
}
export interface ComplianceData {
    totalChecks: number;
    totalBlocks: number;
    blockRate: string;
    recentFailures: Array<{
        policyId: string;
        policyName: string;
        operation: string;
        reason: string;
        executedAt: string;
        defeatedMechanism: string;
    }>;
    failuresByMechanism: Record<string, number>;
}
export interface DeployBucketData {
    queued: number;
    batched: number;
    executing: number;
    done: number;
    failed: number;
    batchCount: number;
    savedOps: number;
}
export interface AuditEntry {
    policyId: string;
    operation: string;
    allowed: boolean;
    reason: string;
    executedAt: string;
    taskId?: string;
}
export interface MemoryHitMissData {
    hits: number;
    misses: number;
    hitRate: string;
}
export interface MemoryData {
    l1: {
        entries: number;
        sizeKB: number;
    };
    l2: {
        entries: number;
    };
    l3: {
        status: string;
        uptime: string;
    };
    l4: {
        entities: number;
        relationships: number;
    };
    compression: {
        rawBytes: number;
        contextBytes: number;
        savingsPercent: string;
        totalCalls: number;
    };
    hitsMisses: MemoryHitMissData;
    recentQueries: Array<{
        query: string;
        type: string;
        timestamp: string;
    }>;
}
export interface ModelData {
    roles: {
        planner: string;
        executor: string;
        reviewer: string;
        fallback: string;
    };
    strategy: string;
    enabled: boolean;
    availableModels: string[];
    routingMatrix: Record<string, {
        planner: string;
        executor: string;
    }>;
    routingRules: Array<{
        keywords?: string[];
        complexity?: string;
        taskType?: string;
        targetRole: string;
        priority: number;
    }>;
    costOptimization: {
        enabled: boolean;
        targetReduction: number;
        maxPerformanceDegradation: number;
        fallbackThreshold: number;
    };
    sessionUsage: Array<{
        modelId: string;
        taskCount: number;
        totalTokensIn: number;
        totalTokensOut: number;
        totalCost: number;
        successRate: number;
    }>;
    totalCost: number;
    /** Recent routing decisions derived from model analytics */
    recentRoutingDecisions: Array<{
        timestamp: string;
        modelUsed: string;
        taskType: string;
        complexity: string;
        success: boolean;
        tokensIn: number;
        tokensOut: number;
        cost: number;
    }>;
}
export interface TaskItem {
    id: string;
    title: string;
    type: string;
    status: string;
    priority: number;
    assignee: string | null;
    updatedAt: string;
}
export interface TaskData {
    total: number;
    done: number;
    inProgress: number;
    blocked: number;
    open: number;
    items: TaskItem[];
}
export interface CoordData {
    activeAgents: number;
    activeClaims: number;
    pendingDeploys: number;
    totalAgents: number;
    completedAgents: number;
    patternHits: number;
    patternSuccesses: number;
    activeWorktrees: number;
    agents: Array<{
        id: string;
        name: string;
        status: string;
        startedAt: string;
        type?: string;
        task?: string;
    }>;
    skillsPerAgent: Record<string, string[]>;
    patternsPerAgent: Record<string, Array<{
        id: string;
        category: string;
        uses: number;
    }>>;
}
export interface SystemData {
    version: string;
    branch: string;
    dirty: number;
}
export interface PerformanceData {
    metrics: Record<string, PerformanceMetrics>;
    hotPaths: Array<{
        name: string;
        avgMs: number;
        p95Ms: number;
        count: number;
    }>;
}
export interface AgentDetail {
    id: string;
    name: string;
    type: 'droid' | 'subagent' | 'main';
    status: string;
    task: string;
    tokensUsed: number;
    tokensIn: number;
    tokensOut: number;
    model: string;
    durationMs: number;
    cost: number;
    taskCount: number;
}
export interface SkillDetail {
    name: string;
    source: string;
    active: boolean;
    reason: string;
}
export interface PatternDetail {
    id: string;
    name: string;
    weight: number;
    active: boolean;
    category: string;
}
export interface DeployDetail {
    id: string;
    type: string;
    target: string;
    status: string;
    message: string;
    batchId: string | null;
    queuedAt: number;
    executedAt: number | null;
}
export interface DeployBatchSummary {
    totalActions: number;
    queued: number;
    batched: number;
    executing: number;
    done: number;
    failed: number;
    batchCount: number;
    savedOps: number;
}
export interface RoutingDecision {
    timestamp: string;
    modelUsed: string;
    reasoning: string;
    taskType?: string;
    complexity?: string;
    tokensIn?: number;
    tokensOut?: number;
    cost?: number;
    success?: boolean;
}
export interface SessionTelemetryData {
    sessionId: string;
    uptime: string;
    tokensUsed: number;
    tokensIn: number;
    tokensOut: number;
    tokensSaved: number;
    toolCalls: number;
    policyChecks: number;
    policyBlocks: number;
    filesBackedUp: number;
    errors: number;
    totalCostUsd: number;
    estimatedCostWithoutUap: number;
    costSavingsPercent: number;
    agents: AgentDetail[];
    skills: SkillDetail[];
    patterns: PatternDetail[];
    deploys: DeployDetail[];
    deployBatchSummary: DeployBatchSummary;
    stepsCompleted: number;
    stepsTotal: number;
    currentStep: string;
    routingDecisions: RoutingDecision[];
    /** Per-model aggregate usage breakdown */
    modelBreakdown: Array<{
        modelId: string;
        taskCount: number;
        tokensIn: number;
        tokensOut: number;
        totalCost: number;
        successRate: number;
        agentIds: string[];
    }>;
}
export interface SessionHistoryEntry {
    sessionId: string;
    status: 'active' | 'completed' | 'ended';
    startedAt: string;
    endedAt: string | null;
    durationMs: number;
    tokensIn: number;
    tokensOut: number;
    totalCost: number;
    toolCalls: number;
    policyChecks: number;
    policyBlocks: number;
    agentCount: number;
    taskCount: number;
    model: string;
}
export interface DashboardData {
    timestamp: string;
    system: SystemData;
    policies: PolicyData[];
    policyFiles: PolicyFileData[];
    auditTrail: AuditEntry[];
    memory: MemoryData;
    models: ModelData;
    tasks: TaskData;
    coordination: CoordData;
    performance: PerformanceData;
    session?: SessionTelemetryData;
    sessions: SessionHistoryEntry[];
    timeSeries: TimeSeriesPoint[];
    compliance: ComplianceData;
    deployBuckets: DeployBucketData | DeployBatchSummary;
}
export declare function getDashboardData(): Promise<DashboardData>;
/**
 * Read policy .md files from the policies/ directory.
 * Returns metadata about each file (excluding README.md).
 */
export declare function getPolicyFiles(cwd: string): PolicyFileData[];
export declare function getDeployBucketData(cwd: string): DeployBatchSummary;
//# sourceMappingURL=data-service.d.ts.map