import { S as Span, J as JudgeSpan } from './schema-m0gsnbt3.js';
import { T as TraceStore } from './store-CKUAgsJz.js';
import { T as Trajectory, a as TrajectoryStep } from './trajectory-GEdXJCL5.js';

/**
 * Process Reward Modeling — per-step rubric grading.
 *
 * A StepRubric inspects one span and returns a score + rationale.
 * PrmGrader applies an array of rubrics to every LLM span in a
 * trajectory (consumers can broaden to tool/retrieval spans via the
 * `kind` filter on each rubric).
 *
 * Why this matters: outcome-only eval (did the final artifact work?)
 * gives sparse reward — most agent turns are unattributable. PRMs
 * densify the signal so optimizers and RL fine-tuning can assign
 * credit per turn.
 */

interface StepContext {
    trajectory: Trajectory;
    step: TrajectoryStep;
    /** Steps preceding `step` in trajectory order. */
    prior: TrajectoryStep[];
    /** Steps following `step`. */
    next: TrajectoryStep[];
}
interface StepRubric {
    id: string;
    /** Only grade spans of these kinds (default: all). */
    kinds?: Array<Span['kind']>;
    /** Weight in the aggregate score. Default 1. */
    weight?: number;
    /** Returns score in 0..1 + optional rationale/evidence. Return `null` to
     *  skip grading (rubric doesn't apply to this step). */
    grade: (ctx: StepContext) => Promise<{
        score: number;
        rationale?: string;
        evidence?: string;
    } | null>;
}
interface GradedStep {
    spanId: string;
    rubricId: string;
    score: number;
    weight: number;
    rationale?: string;
    evidence?: string;
}
interface PrmGradedTrace {
    runId: string;
    steps: GradedStep[];
    /** Weighted mean of all graded steps; 0..1. */
    aggregateScore: number;
    /** Number of spans graded — useful for sanity-checking coverage. */
    gradedCount: number;
    /** Number of spans in the trajectory that no rubric matched. */
    ungradedCount: number;
}
declare class PrmGrader {
    private rubrics;
    constructor(rubrics: StepRubric[]);
    /**
     * Grade every eligible span in a run. Emits a JudgeVerdict span for each
     * (rubric × span) verdict so the result is visible to downstream pipelines
     * (judgeAgreementView, etc.) — PRM is just "a judge that runs per span."
     */
    grade(store: TraceStore, runId: string): Promise<PrmGradedTrace>;
}
/** Helper: reads JudgeVerdict spans that PRM emitted so downstream pipelines
 *  can distinguish PRM verdicts from human or top-level LLM judges. */
declare function isPrmVerdict(verdict: JudgeSpan): boolean;

export { type GradedStep as G, type PrmGradedTrace as P, type StepRubric as S, PrmGrader as a, type StepContext as b, isPrmVerdict as i };
