import { PersonalRevision, type BaseVersion } from './schemas/manifest.js';
export interface LessonFile {
    /** Monotonic ordering id from filename `lesson_<n>.yaml`. */
    id: number;
    /** Absolute file path (so callers can copy / read / delete). */
    path: string;
    /** Parsed YAML body. */
    body: Record<string, unknown>;
    /** True iff file is a `.conflict.yaml` sidecar (unresolved merge state). */
    hasConflict: boolean;
}
/**
 * Read version.json from a pack's personal_revision directory. Returns null
 * if directory or file is absent (e.g. fresh install, no lessons yet, OR
 * built-in pack that has no personal_revision dir). Throws on malformed
 * JSON or schema-invalid content (loud failure — the file is
 * engine-written, never user-edited).
 */
export declare function readVersionJson(packStateDir: string): Promise<PersonalRevision | null>;
/**
 * Write version.json atomically (temp + rename). Creates the
 * personal_revision/ directory if absent. Uses `<pid>.<rand>` suffix so
 * concurrent tests (which run in the same process under vitest pool) don't
 * collide on temp names.
 */
export declare function writeVersionJson(packStateDir: string, state: PersonalRevision): Promise<void>;
/**
 * Enumerate all lesson_*.yaml + lesson_*.conflict.yaml files in monotonic
 * order. Returns empty array if directory is absent. Skips malformed-name
 * files (anything not matching `^lesson_\d+(\.conflict)?\.yaml$`).
 */
export declare function readLessonFiles(packStateDir: string): Promise<LessonFile[]>;
/**
 * Append a new lesson_<n+1>.yaml atomically. Reads version.json, computes
 * next id, writes the lesson file (temp + rename), bumps
 * personal_revision_id in version.json. Returns the new id.
 *
 * NOT concurrency-safe across processes — caller must serialize.
 */
export declare function appendLessonFile(packStateDir: string, lessonBody: Record<string, unknown>): Promise<number>;
/**
 * Initialize a fresh personal_revision/ directory for a newly installed pack.
 * Writes version.json with personal_revision_id=0 + supplied base_version.
 * Idempotent: re-running for an already-initialized pack returns existing
 * state without overwriting.
 */
export declare function initPersonalRevision(packStateDir: string, baseVersion: BaseVersion): Promise<PersonalRevision>;
/**
 * LP.3 — high-level "a Stage-2-promoted lesson lands in this pack's
 * personal_revision/ directory" helper. Ensures version.json exists
 * (idempotent init at `'0.0.0'` default — caller should pass a real
 * baseline via `initPersonalRevision` first when known), then appends the
 * lesson as `lesson_<n+1>.yaml` + bumps `personal_revision_id`.
 *
 * Lesson body shape per LP.3 spec:
 *   promoted_at: ISO-8601 timestamp
 *   engine_lesson_id: string (the engine's lesson id for reconciliation)
 *   lesson_body: any (engine's lesson content)
 *   cited_memory_ids: string[]
 *   skill: string (originating skill name, optional)
 *   retired: boolean (default false; user can flip via CLI later)
 *
 * Returns the new revision id. Throws on personal_revision write failure
 * — caller must surface (NO silent swallow per [[feedback_no_silent_fail_open]]).
 *
 * Imported by: store_lesson primitive (LP.3 wiring follow-up); CLI install
 * path (LP.4).
 */
export interface PromotedLessonInput {
    /** Engine-side lesson id for reconciliation. */
    engine_lesson_id: string;
    /** Engine-side lesson body. */
    lesson_body: unknown;
    /** Memory ids cited by the lesson. */
    cited_memory_ids?: string[];
    /** Originating skill name (optional — engine-direct lessons omit). */
    skill?: string;
    /** Pack base version (passed at install time; defensive '0.0.0' default). */
    packBaseVersion?: BaseVersion;
}
export declare function persistPromotedLesson(packStateDir: string, lesson: PromotedLessonInput): Promise<number>;
//# sourceMappingURL=personal_revision.d.ts.map