import { C as ControlEvalResult, a as ControlRunResult, b as ControlStep } from './control-runtime-BZ_lVLYW.js';
import { D as DatasetSplit, a as DatasetScenario } from './dataset-ueRVTUoY.js';

type FeedbackArtifactType = 'text' | 'code' | 'plan' | 'research' | 'action' | 'ui' | 'decision' | 'data' | 'other';
type FeedbackLabelSource = 'user' | 'judge' | 'environment' | 'metric' | 'policy' | 'system';
type FeedbackLabelKind = 'approve' | 'reject' | 'select' | 'edit' | 'rank' | 'rate' | 'comment' | 'metric_outcome' | 'policy_block' | 'revision_request';
type FeedbackSeverity = 'info' | 'warning' | 'error' | 'critical';
interface FeedbackTask {
    intent: string;
    context?: unknown;
}
interface ProposedSideEffect {
    type: string;
    risk?: 'low' | 'medium' | 'high';
    costUsd?: number;
    externalSideEffect?: boolean;
    requiresApproval?: boolean;
    metadata?: Record<string, unknown>;
}
interface FeedbackLabel {
    id?: string;
    source: FeedbackLabelSource;
    kind: FeedbackLabelKind;
    value: unknown;
    reason?: string;
    severity?: FeedbackSeverity;
    createdAt: string;
    metadata?: Record<string, unknown>;
}
interface FeedbackAttempt {
    id: string;
    stepIndex: number;
    artifactType: FeedbackArtifactType;
    artifact: unknown;
    options?: unknown[];
    proposedAction?: ProposedSideEffect;
    evals?: ControlEvalResult[];
    feedback?: FeedbackLabel[];
    createdAt: string;
    metadata?: Record<string, unknown>;
}
interface FeedbackOutcome {
    success?: boolean;
    score?: number;
    metrics?: Record<string, number>;
    costUsd?: number;
    detail?: string;
    observedAt?: string;
    metadata?: Record<string, unknown>;
}
interface FeedbackTrajectory {
    id: string;
    projectId?: string;
    scenarioId?: string;
    task: FeedbackTask;
    attempts: FeedbackAttempt[];
    labels: FeedbackLabel[];
    outcome?: FeedbackOutcome;
    split?: DatasetSplit;
    tags?: Record<string, string>;
    createdAt: string;
    updatedAt?: string;
    metadata?: Record<string, unknown>;
}
interface FeedbackTrajectoryStore {
    save(trajectory: FeedbackTrajectory): Promise<void>;
    get(id: string): Promise<FeedbackTrajectory | null>;
    list(filter?: FeedbackTrajectoryFilter): Promise<FeedbackTrajectory[]>;
    appendAttempt(id: string, attempt: FeedbackAttempt): Promise<FeedbackTrajectory>;
    appendLabel(id: string, label: FeedbackLabel, attemptId?: string): Promise<FeedbackTrajectory>;
}
interface FeedbackTrajectoryFilter {
    projectId?: string;
    scenarioId?: string;
    split?: DatasetSplit;
    tag?: [string, string];
}
interface FeedbackSplitPolicy {
    trainPct?: number;
    devPct?: number;
    testPct?: number;
    holdoutPct?: number;
}
interface PreferenceMemoryEntry {
    instruction: string;
    rationale: string;
    weight: number;
    sourceTrajectoryId: string;
    sourceLabelId?: string;
    category?: string;
}
interface FeedbackOptimizerRow {
    scenarioId: string;
    trajectoryId: string;
    labelKinds: FeedbackLabelKind[];
    score?: number;
    metadata?: Record<string, unknown>;
}
interface FeedbackReplayResult {
    trajectoryId: string;
    pass: boolean;
    score?: number;
    labels: FeedbackLabel[];
    outcome?: FeedbackOutcome;
    metadata?: Record<string, unknown>;
}
interface FeedbackReplayAdapter {
    replay(trajectory: FeedbackTrajectory): Promise<Omit<FeedbackReplayResult, 'trajectoryId'>> | Omit<FeedbackReplayResult, 'trajectoryId'>;
}
declare class InMemoryFeedbackTrajectoryStore implements FeedbackTrajectoryStore {
    private readonly trajectories;
    save(trajectory: FeedbackTrajectory): Promise<void>;
    get(id: string): Promise<FeedbackTrajectory | null>;
    list(filter?: FeedbackTrajectoryFilter): Promise<FeedbackTrajectory[]>;
    appendAttempt(id: string, attempt: FeedbackAttempt): Promise<FeedbackTrajectory>;
    appendLabel(id: string, label: FeedbackLabel, attemptId?: string): Promise<FeedbackTrajectory>;
}
declare class FileSystemFeedbackTrajectoryStore implements FeedbackTrajectoryStore {
    private readonly dir;
    private readonly memory;
    private loaded;
    constructor(options: {
        dir: string;
    });
    save(trajectory: FeedbackTrajectory): Promise<void>;
    get(id: string): Promise<FeedbackTrajectory | null>;
    list(filter?: FeedbackTrajectoryFilter): Promise<FeedbackTrajectory[]>;
    appendAttempt(id: string, attempt: FeedbackAttempt): Promise<FeedbackTrajectory>;
    appendLabel(id: string, label: FeedbackLabel, attemptId?: string): Promise<FeedbackTrajectory>;
    private append;
    private load;
}
declare function createFeedbackTrajectory(input: {
    id?: string;
    projectId?: string;
    scenarioId?: string;
    task: FeedbackTask;
    attempts?: FeedbackAttempt[];
    labels?: FeedbackLabel[];
    outcome?: FeedbackOutcome;
    split?: DatasetSplit;
    tags?: Record<string, string>;
    createdAt?: string;
    metadata?: Record<string, unknown>;
}): FeedbackTrajectory;
declare function assignFeedbackSplit(trajectory: Pick<FeedbackTrajectory, 'id' | 'projectId' | 'scenarioId' | 'task'>, policy?: FeedbackSplitPolicy): DatasetSplit;
declare function withAssignedFeedbackSplit(trajectory: FeedbackTrajectory, policy?: FeedbackSplitPolicy): FeedbackTrajectory;
declare function feedbackTrajectoryToDatasetScenario(trajectory: FeedbackTrajectory): DatasetScenario;
declare function feedbackTrajectoriesToDatasetScenarios(trajectories: FeedbackTrajectory[]): DatasetScenario[];
declare function feedbackTrajectoryToOptimizerRow(trajectory: FeedbackTrajectory): FeedbackOptimizerRow;
declare function feedbackTrajectoriesToOptimizerRows(trajectories: FeedbackTrajectory[]): FeedbackOptimizerRow[];
declare function replayFeedbackTrajectory(trajectory: FeedbackTrajectory, adapter: FeedbackReplayAdapter): Promise<FeedbackReplayResult>;
declare function replayFeedbackTrajectories(trajectories: FeedbackTrajectory[], adapter: FeedbackReplayAdapter): Promise<FeedbackReplayResult[]>;
declare function summarizePreferenceMemory(trajectories: FeedbackTrajectory[], options?: {
    maxEntries?: number;
}): PreferenceMemoryEntry[];
declare function renderPreferenceMemoryMarkdown(entries: PreferenceMemoryEntry[]): string;
declare function serializeFeedbackTrajectoriesJsonl(trajectories: FeedbackTrajectory[]): string;
declare function parseFeedbackTrajectoriesJsonl(jsonl: string): FeedbackTrajectory[];
declare function controlRunToFeedbackTrajectory<TState, TAction, TActionResult>(run: ControlRunResult<TState, TAction, TActionResult>, options?: {
    projectId?: string;
    scenarioId?: string;
    artifactType?: FeedbackArtifactType;
    artifactFromStep?: (step: ControlStep<TState, TAction, TActionResult>) => unknown;
    proposedActionFromStep?: (step: ControlStep<TState, TAction, TActionResult>) => ProposedSideEffect | undefined;
    createdAt?: string;
}): FeedbackTrajectory;

export { replayFeedbackTrajectory as A, serializeFeedbackTrajectoriesJsonl as B, summarizePreferenceMemory as C, withAssignedFeedbackSplit as D, type FeedbackArtifactType as F, InMemoryFeedbackTrajectoryStore as I, type PreferenceMemoryEntry as P, type FeedbackAttempt as a, type FeedbackLabel as b, type FeedbackLabelKind as c, type FeedbackLabelSource as d, type FeedbackOptimizerRow as e, type FeedbackOutcome as f, type FeedbackReplayAdapter as g, type FeedbackReplayResult as h, type FeedbackSeverity as i, type FeedbackSplitPolicy as j, type FeedbackTask as k, type FeedbackTrajectory as l, type FeedbackTrajectoryFilter as m, type FeedbackTrajectoryStore as n, FileSystemFeedbackTrajectoryStore as o, type ProposedSideEffect as p, assignFeedbackSplit as q, controlRunToFeedbackTrajectory as r, createFeedbackTrajectory as s, feedbackTrajectoriesToDatasetScenarios as t, feedbackTrajectoriesToOptimizerRows as u, feedbackTrajectoryToDatasetScenario as v, feedbackTrajectoryToOptimizerRow as w, parseFeedbackTrajectoriesJsonl as x, renderPreferenceMemoryMarkdown as y, replayFeedbackTrajectories as z };
