import type { ControlEvalResult, ControlRunResult, ControlStep } from './control-runtime';
import type { DatasetScenario, DatasetSplit } from './dataset';
export type FeedbackArtifactType = 'text' | 'code' | 'plan' | 'research' | 'action' | 'ui' | 'decision' | 'data' | 'other';
export type FeedbackLabelSource = 'user' | 'judge' | 'environment' | 'metric' | 'policy' | 'system';
export type FeedbackLabelKind = 'approve' | 'reject' | 'select' | 'edit' | 'rank' | 'rate' | 'comment' | 'metric_outcome' | 'policy_block' | 'revision_request';
export type FeedbackSeverity = 'info' | 'warning' | 'error' | 'critical';
export interface FeedbackTask {
    intent: string;
    context?: unknown;
}
export interface ProposedSideEffect {
    type: string;
    risk?: 'low' | 'medium' | 'high';
    costUsd?: number;
    externalSideEffect?: boolean;
    requiresApproval?: boolean;
    metadata?: Record<string, unknown>;
}
export interface FeedbackLabel {
    id?: string;
    source: FeedbackLabelSource;
    kind: FeedbackLabelKind;
    value: unknown;
    reason?: string;
    severity?: FeedbackSeverity;
    createdAt: string;
    metadata?: Record<string, unknown>;
}
export interface FeedbackAttempt {
    id: string;
    stepIndex: number;
    artifactType: FeedbackArtifactType;
    artifact: unknown;
    options?: unknown[];
    proposedAction?: ProposedSideEffect;
    evals?: ControlEvalResult[];
    feedback?: FeedbackLabel[];
    createdAt: string;
    metadata?: Record<string, unknown>;
}
export interface FeedbackOutcome {
    success?: boolean;
    score?: number;
    metrics?: Record<string, number>;
    costUsd?: number;
    detail?: string;
    observedAt?: string;
    metadata?: Record<string, unknown>;
}
export 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>;
}
export 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>;
}
export interface FeedbackTrajectoryFilter {
    projectId?: string;
    scenarioId?: string;
    split?: DatasetSplit;
    tag?: [string, string];
}
export interface FeedbackSplitPolicy {
    trainPct?: number;
    devPct?: number;
    testPct?: number;
    holdoutPct?: number;
}
export interface PreferenceMemoryEntry {
    instruction: string;
    rationale: string;
    weight: number;
    sourceTrajectoryId: string;
    sourceLabelId?: string;
    category?: string;
}
export interface FeedbackOptimizerRow {
    scenarioId: string;
    trajectoryId: string;
    labelKinds: FeedbackLabelKind[];
    score?: number;
    metadata?: Record<string, unknown>;
}
export interface FeedbackReplayResult {
    trajectoryId: string;
    pass: boolean;
    score?: number;
    labels: FeedbackLabel[];
    outcome?: FeedbackOutcome;
    metadata?: Record<string, unknown>;
}
export interface FeedbackReplayAdapter {
    replay(trajectory: FeedbackTrajectory): Promise<Omit<FeedbackReplayResult, 'trajectoryId'>> | Omit<FeedbackReplayResult, 'trajectoryId'>;
}
export 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>;
}
export 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;
}
export 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;
export declare function assignFeedbackSplit(trajectory: Pick<FeedbackTrajectory, 'id' | 'projectId' | 'scenarioId' | 'task'>, policy?: FeedbackSplitPolicy): DatasetSplit;
export declare function withAssignedFeedbackSplit(trajectory: FeedbackTrajectory, policy?: FeedbackSplitPolicy): FeedbackTrajectory;
export declare function feedbackTrajectoryToDatasetScenario(trajectory: FeedbackTrajectory): DatasetScenario;
export declare function feedbackTrajectoriesToDatasetScenarios(trajectories: FeedbackTrajectory[]): DatasetScenario[];
export declare function feedbackTrajectoryToOptimizerRow(trajectory: FeedbackTrajectory): FeedbackOptimizerRow;
export declare function feedbackTrajectoriesToOptimizerRows(trajectories: FeedbackTrajectory[]): FeedbackOptimizerRow[];
export declare function replayFeedbackTrajectory(trajectory: FeedbackTrajectory, adapter: FeedbackReplayAdapter): Promise<FeedbackReplayResult>;
export declare function replayFeedbackTrajectories(trajectories: FeedbackTrajectory[], adapter: FeedbackReplayAdapter): Promise<FeedbackReplayResult[]>;
export declare function summarizePreferenceMemory(trajectories: FeedbackTrajectory[], options?: {
    maxEntries?: number;
}): PreferenceMemoryEntry[];
export declare function renderPreferenceMemoryMarkdown(entries: PreferenceMemoryEntry[]): string;
export declare function serializeFeedbackTrajectoriesJsonl(trajectories: FeedbackTrajectory[]): string;
export declare function parseFeedbackTrajectoriesJsonl(jsonl: string): FeedbackTrajectory[];
export 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;
//# sourceMappingURL=feedback-trajectory.d.ts.map