export type RunKind = 'analyse' | 'create';
export interface BuildRunFolderOptions {
    /** Prompt name, e.g. `analyse-v9`, `create-v9`. Used in default folder name when no `label`. */
    prompt?: string;
    /** Provider id, e.g. `claude-cli`, `anthropic`, `stub`. */
    providerId?: string;
    /** Model id (claude-opus-4-7, etc.) — coerced to filesystem-safe form. */
    modelId?: string;
    /** Optional intent-driven label that overrides the auto-derived tail. */
    label?: string;
}
/** Subset of case.yaml fields used for README rendering. Authoritative
 *  shape lives in the harness's case-loader; this is the loosest contract
 *  needed to render. */
export interface RunCaseEntry {
    name: string;
    kind?: RunKind;
    class?: number;
    stack?: string;
    upstream?: {
        repo?: string;
        pin_sha?: string;
        pin_date?: string;
    };
    domain_notes?: string;
    nl_request?: string;
    expected_spec_path?: string;
    [key: string]: unknown;
}
/** The run config snapshot written to manifest.json. Loose by design —
 *  callers add provider-specific fields freely. */
export interface RunManifest {
    kind: RunKind;
    case: string;
    runFolder: string;
    startedAt: string;
    endedAt?: string;
    wallTimeMs?: number;
    provider: string;
    model: string;
    prompt: string;
    workflow?: string;
    verify?: boolean;
    realize?: string | boolean | null;
    factsPath?: string | null;
    validateFinal?: string | null;
    sourcePath?: string | null;
    experimentRunId?: string | null;
    /** True iff the manifest was backfilled from a legacy run dir. */
    backfilled?: boolean;
    [key: string]: unknown;
}
/** Loose scoring shape — typically validity + round_trip / domain_coverage. */
export interface RunScore {
    validity?: Record<string, boolean>;
    round_trip?: ScoreCoverage;
    domain_coverage?: ScoreCoverage;
    [key: string]: unknown;
}
export interface ScoreCoverage {
    parse_ok?: boolean;
    errors?: string[];
    entities?: ScoreDimension;
    relationships?: ScoreDimension;
    lifecycles?: ScoreDimension;
    operations?: ScoreDimension;
}
export interface ScoreDimension {
    expected?: number;
    matched?: number;
    missing?: string[];
    extra?: string[];
}
export interface ProjectReadmeOptions {
    caseName: string;
    /** Realize attempt result; null = realize never ran (recipe form). */
    realized?: {
        ok: boolean;
        error?: string;
    } | null;
}
export interface ReadmeInfo {
    caseEntry: RunCaseEntry;
    manifest: RunManifest;
    score?: RunScore;
    runFolder: string;
    kind: RunKind;
}
/** Folder name for one per-case run. */
export declare function buildRunFolder({ prompt, providerId, modelId, label }: BuildRunFolderOptions): string;
/** Absolute path for one per-case run folder. */
export declare function caseRunPath(rootDir: string, kind: RunKind, caseName: string, runFolder: string): string;
/** Standard per-run subdir paths. */
export declare const SUBDIRS: readonly ["input", "facts", "prompts", "llm-output", "specs", "project"];
export declare const inputDir: (caseRunDir: string) => string;
export declare const factsDir: (caseRunDir: string) => string;
export declare const promptsDir: (caseRunDir: string) => string;
export declare const llmOutputDir: (caseRunDir: string) => string;
export declare const specsDir: (caseRunDir: string) => string;
export declare const projectDir: (caseRunDir: string) => string;
/** Pre-create all subdirs at the start of a run. Idempotent. */
export declare function ensureSubdirs(caseRunDir: string): void;
/**
 * Write a stage's spec to specs/{stage}.specly AND copy into specs/main.specly.
 * No symlinks: main.specly is always a real file, overwritten by each new stage.
 * Returns the path to the stage-specific file.
 */
export declare function writeStageSpec(caseRunDir: string, stage: string, content: string): string;
export interface VerifyGateResult {
    finalSpec: string;
    finalStage: 'draft' | 'verified';
    /** Validation result of the chosen spec — callers reuse it as `validateFinal` (no re-spawn). */
    validation: {
        ok: boolean;
        errors: string;
    };
    /** True when the verify output was rejected and the draft kept instead. */
    reverted: boolean;
}
/**
 * Keep a verify pass's output only if it's no worse than the draft.
 *
 * The verify pass (`verify-analyse` / `verify-create`) is an LLM-only "review
 * and improve this" call with no programmatic gate — so it can return prose
 * ("I need write permission…"), hoist events to the top level, or drop
 * required fields, turning a valid draft into an invalid spec WITHOUT throwing.
 * The runners' `try/catch` only fired on a thrown exception, so that returned-
 * but-broken output sailed through and clobbered the good draft.
 *
 * Contract: the caller has already written `verifiedSpec` to `specs/main.specly`
 * (via `writeStageSpec(dir, 'verified', verifiedSpec)`). This validates it; if
 * it fails AND the draft validates, it restores the draft as the canonical spec
 * and reports `reverted: true`. If both fail, it keeps the verify output (no
 * worse) and restores it at `main.specly`. `validate` is the caller's
 * `runValidate` (which validates whatever is at `specs/main.specly`).
 */
export declare function gateVerifyAgainstDraft(caseRunDir: string, draftSpec: string, verifiedSpec: string, validate: (specPath: string) => {
    ok: boolean;
    errors: string;
}): VerifyGateResult;
/**
 * Write a project/README.md. Three shapes depending on `realized`:
 *   - null/undefined → recipe form (project/ is empty)
 *   - { ok: true }   → "materialized" — describes layout + how to run
 *   - { ok: false }  → "realize failed" — captures error + retry recipe
 */
export declare function writeProjectReadme(caseRunDir: string, opts: ProjectReadmeOptions): void;
/** Write manifest.json — machine-readable run config + result. */
export declare function writeManifest(caseRunDir: string, manifest: RunManifest): void;
/** Write score.json. */
export declare function writeScore(caseRunDir: string, score: RunScore): void;
/** Write a human-readable README.md orienting a future reader to the run. */
export declare function writeReadme(caseRunDir: string, info: ReadmeInfo): void;
//# sourceMappingURL=run-paths.d.ts.map