export type AIRunSource = 'support_ticket' | 'aicoder_app' | 'ai_assistant' | 'qa_runner' | 'unknown';
export type AIRunOutcomeLabel = 'accepted' | 'rejected' | 'qa_incomplete' | 'qa_infra_failed' | 'build_failed' | 'release_blocked' | 'manual_handoff' | 'false_pass' | 'stopped' | 'unknown';
export type AIRunEventType = 'model_call' | 'log' | 'qa_infra' | 'qa_compile' | 'qa_route_probe' | 'qa_business_assertion' | 'scorecard' | 'deploy' | 'publish' | 'hotfix' | 'assistant_message' | 'assistant_query' | 'git_commit' | 'usage' | 'human_intervention';
export type AIRunGateStatus = 'pass' | 'fail' | 'warn' | 'blocked' | 'skipped';
export type AIQaCheckStatus = 'pass' | 'fail' | 'blocked' | 'warn' | 'skipped' | 'unknown';
export type AIQaCompileStatus = 'pass' | 'fail' | 'blocked' | 'stale' | 'skipped' | 'unknown';
export type AIQaOutcome = 'infra_failed' | 'compile_failed' | 'route_failed' | 'route_only_pass' | 'business_assertion_passed' | 'business_assertion_failed' | 'incomplete';
export interface AIRunEvent {
    id?: string;
    type: AIRunEventType;
    source?: AIRunSource | string;
    message?: string;
    category?: string;
    artifactPaths?: string[];
    metadata?: Record<string, any>;
    recordedAt?: Date | string;
}
export interface AIRunGateResult {
    key: string;
    label: string;
    status: AIRunGateStatus;
    reason: string;
    evidenceRefs: string[];
    recordedAt: string;
    metadata?: Record<string, any>;
}
export interface AIRunCost {
    inputTokens: number;
    cachedInputTokens: number;
    outputTokens: number;
    totalTokens: number;
    estimatedUsd: number;
    models: string[];
    categories: Record<string, {
        inputTokens: number;
        cachedInputTokens: number;
        outputTokens: number;
        totalTokens: number;
        estimatedUsd: number;
        count: number;
    }>;
    sources?: Record<string, {
        inputTokens: number;
        cachedInputTokens: number;
        outputTokens: number;
        totalTokens: number;
        estimatedUsd: number;
        count: number;
        manualCount: number;
        untrackedCount: number;
    }>;
    surfaces?: Record<string, {
        totalTokens: number;
        estimatedUsd: number;
        count: number;
    }>;
    manualEstimatedUsd?: number;
    untrackedEstimatedUsd?: number;
    untrackedWarnings?: string[];
    wallTimeMs?: number;
    retries?: number;
}
export interface OpenAIUsageCostEntry {
    model?: string;
    category?: string;
    id_request?: string;
    idRequest?: string;
    id_conversation?: string;
    idConversation?: string;
    timestamp?: Date | string;
    input_tokens?: number;
    inputTokens?: number;
    cached_input_tokens?: number;
    cachedInputTokens?: number;
    output_tokens?: number;
    outputTokens?: number;
    total_tokens?: number;
    totalTokens?: number;
    cost_estimate?: number;
    estimatedUsd?: number;
    usage_source?: string;
    usageSource?: string;
    usage_surface?: string;
    usageSurface?: string;
    usage_phase?: string;
    usagePhase?: string;
    cost_basis?: string;
    costBasis?: string;
    is_manual?: boolean;
    isManual?: boolean;
    is_untracked?: boolean;
    isUntracked?: boolean;
    untracked_reason?: string;
    untrackedReason?: string;
    [key: string]: any;
}
export interface AIQaInfraCheck {
    name: string;
    status: AIQaCheckStatus;
    message?: string;
    path?: string;
    durationMs?: number;
    metadata?: Record<string, any>;
    checkedAt?: Date | string;
}
export interface AIQaCompileResult {
    status: AIQaCompileStatus;
    command?: string;
    artifactPath?: string;
    message?: string;
    durationMs?: number;
    staleEvidence?: boolean;
    recordedAt?: Date | string;
    metadata?: Record<string, any>;
}
export interface AIQaRouteProbe {
    route: string;
    status: AIQaCheckStatus;
    screenshot?: string;
    caption?: string;
    shellOnly?: boolean;
    authenticated?: boolean;
    consoleErrors?: string[];
    networkErrors?: string[];
    message?: string;
    recordedAt?: Date | string;
    metadata?: Record<string, any>;
}
export interface AIQaBusinessAssertion {
    assertion: string;
    status: AIQaCheckStatus;
    workflow?: string;
    route?: string;
    action?: string;
    expected?: string;
    observed?: string;
    dataProof?: string;
    mongoDelta?: Record<string, any>;
    artifactPaths?: string[];
    message?: string;
    recordedAt?: Date | string;
    metadata?: Record<string, any>;
}
export interface AIQaArtifact {
    type: 'screenshot' | 'trace' | 'console_log' | 'network_log' | 'coverage_matrix' | 'seed_data' | 'script' | 'other';
    path?: string;
    url?: string;
    title?: string;
    caption?: string;
    metadata?: Record<string, any>;
}
export interface AIQaRun {
    outcome: AIQaOutcome;
    infraChecks: AIQaInfraCheck[];
    compile?: AIQaCompileResult;
    routeProbes: AIQaRouteProbe[];
    businessAssertions: AIQaBusinessAssertion[];
    artifacts: AIQaArtifact[];
    gateResults: AIRunGateResult[];
    updatedAt: string;
}
export interface AIRun {
    id?: string;
    source: AIRunSource;
    sourceIds: Record<string, string>;
    title?: string;
    status?: string;
    phase?: string;
    startedAt?: Date | string;
    completedAt?: Date | string;
    outcome: AIRunOutcomeLabel;
    events: AIRunEvent[];
    gates: AIRunGateResult[];
    qa?: AIQaRun;
    cost?: AIRunCost;
    nextAction?: string;
    warnings?: string[];
    metadata?: Record<string, any>;
}
export interface AIRunTrainingExample {
    runId: string;
    source: AIRunSource;
    inputSummary: string;
    actionSummary: string;
    outcome: AIRunOutcomeLabel;
    evidence: string[];
    cost?: AIRunCost;
    metadata?: Record<string, any>;
}
export interface AIQaEvaluationInput {
    infraChecks?: AIQaInfraCheck[];
    compile?: AIQaCompileResult;
    routeProbes?: AIQaRouteProbe[];
    businessAssertions?: AIQaBusinessAssertion[];
    artifacts?: AIQaArtifact[];
    now?: Date | string;
}
export interface AIRunOutcomeInput {
    source?: AIRunSource;
    status?: string;
    phase?: string;
    qa?: AIQaRun | AIQaEvaluationInput;
    gates?: AIRunGateResult[];
    scorecardPassed?: boolean;
    scorecardStatus?: string;
    deployStatus?: string;
    publishStatus?: string;
    sampleDataStatus?: string;
    manualHandoff?: boolean;
    stopped?: boolean;
    rejected?: boolean;
    explicitAccepted?: boolean;
    terminal?: boolean;
    now?: Date | string;
}
export interface AIRunOutcomeDecision {
    outcome: AIRunOutcomeLabel;
    reason: string;
    nextAction: string;
    gates: AIRunGateResult[];
    warnings: string[];
    recordedAt: string;
}
export declare function isCumulativeCodexUsageEntry(entry: OpenAIUsageCostEntry): boolean;
export declare function resolveOpenAIUsageThreadKey(entry: OpenAIUsageCostEntry): string;
export declare function normalizeOpenAIUsageRowsForCosting<T extends OpenAIUsageCostEntry>(rows?: T[]): T[];
export declare function buildAIQaRun(input?: AIQaEvaluationInput): AIQaRun;
export declare function classifyAIRunOutcome(input?: AIRunOutcomeInput): AIRunOutcomeDecision;
export declare function buildAIRun(input: Omit<AIRun, 'outcome' | 'gates'> & {
    outcome?: AIRunOutcomeLabel;
    gates?: AIRunGateResult[];
    scorecardPassed?: boolean;
    deployStatus?: string;
    publishStatus?: string;
    sampleDataStatus?: string;
    manualHandoff?: boolean;
    stopped?: boolean;
    rejected?: boolean;
    explicitAccepted?: boolean;
    terminal?: boolean;
    now?: Date | string;
}): AIRun;
export declare function buildAIRunCost(entries?: OpenAIUsageCostEntry[]): AIRunCost;
export declare function redactAIRunTrainingExample(example: AIRunTrainingExample): AIRunTrainingExample;
