import type { OutputValidationResult } from '../core/outputValidation';
import type { TraceEvent, TraceRecord } from '../core/tracing';
export type OutputValidationSelectionSource = 'auto-selected' | 'manual-selected';
export interface OutputValidationEvalRunOptions {
    selectionSource?: OutputValidationSelectionSource;
    selectionReason?: string;
}
export interface TraceSnapshot {
    spans: TraceRecord[];
    events: TraceEvent[];
}
export interface EvalTraceExample {
    id: string;
    createdAt: string;
    mode?: 'trace' | 'replay';
    task: string;
    expectedBehavior: string;
    status: 'pass' | 'fail';
    spanNames: string[];
    eventNames: string[];
    tags: string[];
    error?: string;
    prompt?: string;
    expectedResponseIncludes?: string[];
    expectedTools?: string[];
    actualResponse?: string;
    actualTools?: string[];
    sourceTraceId?: string;
    sourceSessionId?: string;
    sourceContext?: string;
}
export interface EvalTraceRunResult {
    exampleId: string;
    task: string;
    status: 'pass' | 'fail';
    expectedStatus: 'pass' | 'fail';
    actualStatus: 'pass' | 'fail';
    tags: string[];
    message: string;
    checks?: string[];
    links?: ReplayEvalSourceLinks;
}
export interface EvalTraceRun {
    id: string;
    createdAt: string;
    total: number;
    passed: number;
    failed: number;
    passRate: number;
    results: EvalTraceRunResult[];
}
export interface EvalTraceRunTrend {
    totalRuns: number;
    latest?: EvalTraceRun;
    averagePassRate: number;
    byTag: Record<string, {
        total: number;
        passed: number;
        failed: number;
        passRate: number;
    }>;
}
export interface EvalTraceOptions {
    task?: string;
    expectedBehavior?: string;
    tags?: string[];
}
export interface ReplayEvalOptions {
    task: string;
    prompt: string;
    expectedBehavior?: string;
    expectedResponseIncludes?: string[];
    expectedTools?: string[];
    actualResponse?: string;
    actualTools?: string[];
    sourceTraceId?: string;
    sourceSessionId?: string;
    sourceContext?: string;
    tags?: string[];
}
export interface ReplayEvalSourceLinks {
    traceUrl?: string;
    sessionUrl?: string;
    context?: string;
}
export interface ReplayEvalActuals {
    actualResponse?: string;
    actualTools?: string[];
}
export interface ReplayEvalRunOptions {
    replayAdapter?: (example: EvalTraceExample) => Promise<ReplayEvalActuals>;
}
export declare function createEvalTraceExample(snapshot: TraceSnapshot, options?: EvalTraceOptions): EvalTraceExample;
export declare function createReplayEvalExample(options: ReplayEvalOptions): EvalTraceExample;
export declare function appendEvalTraceExample(projectDir: string, example: EvalTraceExample): Promise<string>;
export declare function listEvalTraceExamples(projectDir: string, limit?: number): Promise<EvalTraceExample[]>;
export declare function readEvalTraceDataset(projectDir: string): Promise<string>;
export declare function updateEvalTraceExampleTags(projectDir: string, exampleId: string, tags: string[]): Promise<EvalTraceExample>;
export declare function deleteEvalTraceExample(projectDir: string, exampleId: string): Promise<boolean>;
export declare function runEvalTraceDataset(projectDir: string, options?: ReplayEvalRunOptions): Promise<EvalTraceRun>;
export declare function createOutputValidationEvalRun(validation: OutputValidationResult, task?: string, options?: OutputValidationEvalRunOptions): EvalTraceRun;
export declare function recordOutputValidationEvalRun(projectDir: string, validation: OutputValidationResult, task?: string, options?: OutputValidationEvalRunOptions): Promise<EvalTraceRun>;
export interface UploadsFallbackEvalOptions {
    uniqueFallbacks: number;
    suppressedFallbacks: number;
    tools: string[];
    sessionId?: string;
    task?: string;
}
export declare function createUploadsFallbackEvalRun(options: UploadsFallbackEvalOptions): EvalTraceRun | null;
export declare function recordUploadsFallbackEvalRun(projectDir: string, options: UploadsFallbackEvalOptions): Promise<EvalTraceRun | null>;
export interface UploadsFallbackTrend {
    totalSessions: number;
    totalFallbacks: number;
    byTool: Record<string, number>;
    recent: Array<{
        at: string;
        unique: number;
        tools: string[];
    }>;
}
export declare function summarizeUploadsFallbackRuns(runs: EvalTraceRun[]): UploadsFallbackTrend;
export interface ContextLossDetectionInput {
    priorUserMessage: string;
    priorAssistantMessage?: string;
    assistantResponse: string;
}
export interface ContextLossDetectionResult {
    contextLoss: boolean;
    overlapTokens: string[];
    priorTokens: string[];
    responseTokens: string[];
}
export declare function detectAssistantContextLoss(input: ContextLossDetectionInput): ContextLossDetectionResult;
export interface ContextLossEvalOptions {
    priorUserMessage: string;
    priorAssistantMessage?: string;
    assistantResponse: string;
    task?: string;
}
export declare function createContextLossEvalRun(options: ContextLossEvalOptions): EvalTraceRun | null;
export declare function recordContextLossEvalRun(projectDir: string, options: ContextLossEvalOptions): Promise<EvalTraceRun | null>;
export interface ContextLossTrend {
    total: number;
    recent: Array<{
        task: string;
        createdAt: string;
        message: string;
    }>;
}
export declare function summarizeContextLossRuns(runs: EvalTraceRun[]): ContextLossTrend;
export type ProfileFeedbackVote = 'up' | 'down';
export interface ProfileFeedbackOptions {
    profile: string;
    vote: ProfileFeedbackVote;
    selectionSource?: OutputValidationSelectionSource;
    selectionReason?: string;
    prompt?: string;
}
export declare function createProfileFeedbackEvalRun(options: ProfileFeedbackOptions): EvalTraceRun;
export declare function recordProfileFeedbackEvalRun(projectDir: string, options: ProfileFeedbackOptions): Promise<EvalTraceRun>;
export declare function listEvalTraceRuns(projectDir: string, limit?: number): Promise<EvalTraceRun[]>;
export declare function summarizeEvalTraceRuns(runs: EvalTraceRun[]): EvalTraceRunTrend;
/** Public wrapper around the internal append so external pipelines (e.g. the simulator) can persist runs into the same trend file the promotion gate consults. */
export declare function persistEvalTraceRun(projectDir: string, run: EvalTraceRun): Promise<void>;
export interface OutputValidationRunTrend {
    totalResults: number;
    byProfile: Record<string, {
        total: number;
        passed: number;
        failed: number;
        passRate: number;
    }>;
    bySelectionSource: Record<string, {
        total: number;
        passed: number;
        failed: number;
        passRate: number;
    }>;
    byStatus: Record<string, number>;
    latestFailures: Array<{
        task: string;
        profile: string;
        status: string;
        selectionSource: string;
        message: string;
        checks: string[];
        createdAt: string;
    }>;
}
export interface OutputValidationTrendExport {
    generatedAt: string;
    trend: OutputValidationRunTrend;
    results: Array<{
        runId: string;
        createdAt: string;
        task: string;
        profile: string;
        status: string;
        selectionSource: string;
        passed: boolean;
        message: string;
        checks: string[];
    }>;
}
export declare function createOutputValidationTrendExport(runs: EvalTraceRun[], generatedAt?: string): OutputValidationTrendExport;
export declare function summarizeOutputValidationRuns(runs: EvalTraceRun[]): OutputValidationRunTrend;
export interface ProfileFeedbackBucket {
    total: number;
    up: number;
    down: number;
    approvalRate: number;
}
export interface ProfileFeedbackInsight {
    profile: string;
    severity: 'info' | 'warn';
    message: string;
    downVotes: number;
    upVotes: number;
}
export interface ProfileFeedbackTrend {
    totalVotes: number;
    byProfile: Record<string, ProfileFeedbackBucket>;
    insights: ProfileFeedbackInsight[];
    recentVotes: Array<{
        profile: string;
        vote: ProfileFeedbackVote;
        task: string;
        createdAt: string;
    }>;
    dailyApproval: Array<{
        date: string;
        total: number;
        up: number;
        down: number;
        approvalRate: number;
    }>;
}
export declare function summarizeProfileFeedbackRuns(runs: EvalTraceRun[]): ProfileFeedbackTrend;
//# sourceMappingURL=evalTrace.d.ts.map