import { JudgeVerdictKind } from './extraction-judge.js';
import './types.js';
import './local-llm.js';
import './model-registry.js';
import './fallback-llm.js';

/**
 * Extraction Judge Training Data Shim (issue #562, PR 4).
 *
 * Opt-in collector for `(candidate_text, verdict_kind, reason,
 * ground_truth_label?)` tuples. Rows are appended to JSONL files under
 * `~/.remnic/judge-training/<YYYY-MM-DD>.jsonl` so operators can ship the
 * data into a future GRPO training pipeline without exfiltrating live
 * memory content through the regular observation ledger.
 *
 * Gating:
 *   - Off by default. Must be explicitly enabled via
 *     `collectJudgeTrainingPairs: true` in plugin config.
 *   - The ground-truth label is always optional — labels are added out-of-
 *     band once reviewers disambiguate the candidate's fate.
 *
 * Privacy: the row carries only what the judge already sees — the
 * candidate text and its metadata. It does NOT carry session keys,
 * principal IDs, or any user identifiers. The file lives in the user's
 * home directory rather than the shared memory directory so it is never
 * committed, sync'd, or bundled into exports.
 */

/**
 * Persisted training row. Intentionally minimal: just the signal needed
 * to train a judge replacement policy. Schema version is tagged so future
 * readers can migrate older rows.
 */
interface JudgeTrainingPair {
    version: 1;
    ts: string;
    candidateText: string;
    candidateCategory: string;
    candidateConfidence?: number;
    verdictKind: JudgeVerdictKind;
    reason: string;
    /**
     * Number of prior deferrals when the verdict was resolved. `0` for the
     * first resolution; only set when known (defer pathway).
     */
    priorDeferrals?: number;
    /**
     * Optional human-applied ground-truth label. Added after the fact by a
     * reviewer / labelling script; not present on fresh rows.
     */
    groundTruthLabel?: JudgeVerdictKind;
}
interface JudgeTrainingOptions {
    enabled: boolean;
    /**
     * Override for the output directory. Defaults to
     * `~/.remnic/judge-training`. Tests pass a temp path here.
     */
    directory?: string;
}
declare function resolveTrainingDir(options: JudgeTrainingOptions): string;
declare function trainingFilePathFor(directory: string, iso: string): string;
/**
 * Append a single training row. Fails open — write errors are logged at
 * debug level and swallowed, same policy as the telemetry emitter.
 * No-op when `options.enabled` is false.
 */
declare function recordJudgeTrainingPair(row: JudgeTrainingPair, options: JudgeTrainingOptions): Promise<void>;
/**
 * Read all training rows from the configured directory. Returns an empty
 * array when the directory is missing. Malformed lines are skipped and
 * counted in the returned `malformed` tally.
 */
declare function readJudgeTrainingPairs(options: Pick<JudgeTrainingOptions, "directory">): Promise<{
    rows: JudgeTrainingPair[];
    malformed: number;
}>;
/**
 * Structural validator matching the persisted schema. Forward-compat: an
 * unknown `verdictKind` string is treated as malformed (strict training
 * signal — we do not want to admit unlabelled gibberish into a trainer).
 */
declare function isValidTrainingPair(value: unknown): value is JudgeTrainingPair;

export { type JudgeTrainingOptions, type JudgeTrainingPair, isValidTrainingPair, readJudgeTrainingPairs, recordJudgeTrainingPair, resolveTrainingDir, trainingFilePathFor };
