import type { Database } from "bun:sqlite";
export interface AgentMetrics {
    agent_id: string;
    agent_name: string;
    tasks_completed: number;
    tasks_failed: number;
    tasks_in_progress: number;
    completion_rate: number;
    avg_completion_minutes: number | null;
    avg_confidence: number | null;
    review_score_avg: number | null;
    composite_score: number;
}
export interface LeaderboardEntry extends AgentMetrics {
    rank: number;
}
export interface AgentReliabilityScorecardOptions {
    project_id?: string;
    since?: string;
    stale_after_hours?: number;
}
export type AgentReliabilityGrade = "excellent" | "good" | "watch" | "at_risk";
export interface AgentReliabilityScorecard {
    schema_version: 1;
    local_only: true;
    no_network: true;
    generated_at: string;
    agent_id: string;
    agent_name: string;
    scope: {
        project_id: string | null;
        since: string | null;
        stale_after_hours: number;
    };
    score: number;
    grade: AgentReliabilityGrade;
    components: {
        delivery: number;
        verification: number;
        run_reliability: number;
        lock_hygiene: number;
        retry_discipline: number;
        handoff_hygiene: number;
    };
    signals: {
        tasks_completed: number;
        tasks_failed: number;
        tasks_in_progress: number;
        completion_rate: number;
        passed_verifications: number;
        failed_verifications: number;
        unknown_verifications: number;
        completed_tasks_with_passed_verification: number;
        verification_coverage: number;
        runs_completed: number;
        runs_failed: number;
        run_success_rate: number;
        stale_task_locks: number;
        stale_resource_locks: number;
        handoffs_created: number;
        handoffs_with_task_refs: number;
        handoffs_with_blockers: number;
        retry_count: number;
        max_retry_count: number;
    };
    evidence: {
        failed_tasks: Array<{
            id: string;
            short_id: string | null;
            title: string;
            updated_at: string;
        }>;
        failed_verifications: Array<{
            id: string;
            task_id: string;
            command: string;
            run_at: string;
        }>;
        failed_runs: Array<{
            id: string;
            task_id: string;
            title: string | null;
            completed_at: string | null;
        }>;
        stale_locks: Array<{
            kind: "task" | "resource";
            id: string;
            locked_at: string;
            resource_type?: string;
        }>;
    };
    recommendations: string[];
}
export interface AgentReliabilityExport {
    schema_version: 1;
    local_only: true;
    no_network: true;
    generated_at: string;
    filters: {
        agent_id: string | null;
        project_id: string | null;
        since: string | null;
        stale_after_hours: number;
    };
    count: number;
    scorecards: AgentReliabilityScorecard[];
}
/**
 * Compute metrics for a single agent from task data.
 */
export declare function getAgentMetrics(agentId: string, opts?: {
    project_id?: string;
}, db?: Database): AgentMetrics | null;
/**
 * Get leaderboard: all agents ranked by composite score.
 */
export declare function getLeaderboard(opts?: {
    project_id?: string;
    limit?: number;
}, db?: Database): LeaderboardEntry[];
/**
 * Score a task completion (store review score in metadata).
 */
export declare function scoreTask(taskId: string, score: number, reviewerId?: string, db?: Database): void;
export declare function getAgentReliabilityScorecard(agentId: string, options?: AgentReliabilityScorecardOptions, db?: Database): AgentReliabilityScorecard | null;
export declare function listAgentReliabilityScorecards(options?: AgentReliabilityScorecardOptions & {
    agent_id?: string;
    limit?: number;
}, db?: Database): AgentReliabilityScorecard[];
export declare function createAgentReliabilityExport(options?: AgentReliabilityScorecardOptions & {
    agent_id?: string;
    limit?: number;
}, db?: Database): AgentReliabilityExport;
export declare function renderAgentReliabilityMarkdown(report: AgentReliabilityExport | AgentReliabilityScorecard): string;
//# sourceMappingURL=agent-metrics.d.ts.map