/** Pure parsing and rendering for the canonical project-learnings document. */
import { type LearningEntry } from "./learnings-contract.js";
/**
 * Stable diagnosis prefix. Shared so the CI gate can recognize this specific
 * failure and attach merge-driver remediation without re-implementing the scan.
 */
export declare const CONFLICT_MARKER_DIAGNOSIS = "Project learnings file contains a git conflict marker";
/**
 * Render the complete file in one stable, machine-readable Markdown form.
 * @param entries - Validated entries to serialize
 * @returns Canonical Markdown plus JSONL document
 */
export declare function renderLearningsFile(entries: readonly LearningEntry[]): string;
/**
 * Parse and revalidate an existing file before it participates in a write.
 * @param content - Existing learnings document
 * @returns Revalidated entries from the document
 */
export declare function parseLearningsFile(content: string): LearningEntry[];
/**
 * A document that does not fit the hard entry-count or token budget.
 *
 * Typed so the writer can tell "this capture has nowhere to go" apart from every
 * other write failure. That distinction is load-bearing: a budget breach is the
 * one failure whose dropped CONTENT is still worth preserving in the overflow
 * file (CodySwannGT/lisa#1996), whereas an unsafe path or a corrupted document
 * must fail outright rather than have content salvaged out of it. The messages
 * are unchanged from the plain-`Error` era so existing diagnostics and their
 * assertions still read the same.
 */
export declare class LearningsBudgetError extends Error {
    /**
     * Build a budget breach carrying the caller-facing diagnosis.
     * @param message - Single-line budget diagnosis
     */
    constructor(message: string);
}
/**
 * Enforce the shared entry-count and model-agnostic token upper bounds.
 * @param content - Canonical document
 * @param entryCount - Number of entries in the document
 * @param context - Error-message prefix
 */
export declare function assertDocumentBudget(content: string, entryCount: number, context: string): void;
/**
 * Locate the first line git left a conflict marker on.
 *
 * The fs-level write lock cannot prevent this corruption: each learner pass
 * runs on its own `learning/<fingerprint>` branch in its own worktree, so a
 * path-scoped lock never sees the other writer and the collision surfaces at
 * merge time.
 *
 * Detection is exact because of the render contract: entries are serialized one
 * `JSON.stringify` object per line and that escapes every newline, so no stored
 * field value can ever begin a line. Every line of a canonical document starts
 * with `#`, `<!--`, a backtick fence, `{`, or is empty — so a line STARTING
 * with a seven-character git marker is unambiguously foreign to the format and
 * cannot be legitimate content.
 * @param content - Untrusted learnings document
 * @returns One-based line number of the first marker, or undefined when clean
 */
export declare function findConflictMarkerLine(content: string): number | undefined;
/**
 * Build the one canonical conflict diagnosis every reader throws.
 *
 * Shared because the readers each apply a file-SIZE guard before handing bytes
 * to the parser, and a real conflicted ledger is roughly double size — so the
 * size guard would otherwise win the race and tell an operator to "shorten or
 * remove entries" on a file whose actual problem is duplication. Each reader
 * scans its bounded prefix and throws THIS error instead.
 * @param line - One-based line number of the first marker
 * @returns Error carrying the shared diagnosis and remediation
 */
export declare function conflictMarkerError(line: number): Error;
/**
 * Scan a possibly-truncated UTF-8 prefix for a conflict marker.
 *
 * Decoded leniently on purpose: the buffer is cut at a fixed byte ceiling and
 * may split a multi-byte character, which a strict decoder would reject. A
 * replacement character cannot forge or hide a marker, since markers are ASCII
 * anchored at line start.
 * @param prefix - Bounded bytes read from the head of a candidate ledger
 * @returns One-based line number of the first marker, or undefined when clean
 */
export declare function findConflictMarkerInBytes(prefix: Uint8Array): number | undefined;
//# sourceMappingURL=learnings-document.d.ts.map