import { type FailureCategory } from './failureTaxonomy';
/** Strict JSON shape emitted by the review agent. Anything else is rejected. */
export interface ReviewAgentNoteEmission {
    failureCategoryEnum: FailureCategory;
    evidenceSummary: string;
    candidateKeywords?: string[];
    candidateConstraints?: string;
    candidateCriticalTools?: string[];
    /** Optional self-supplied failureModeHash; backend recomputes regardless. */
    failureModeHash?: string;
    /** Skill that the note targets — required so the writer knows which file. */
    skillId: string;
    /** Provenance fields the writer copies into the persisted note. */
    sourceSessionId?: string;
    sourceTurnIndex?: number;
}
export interface PersistedSkillNote {
    id: string;
    failureCategory: FailureCategory;
    failureModeHash?: string;
    evidenceSummary: string;
    candidateKeywords: string[];
    candidateConstraints: string;
    candidateCriticalTools: string[];
    createdAt: number;
    cooldownUntil: number;
    byteSize: number;
    sourceSessionId?: string;
    sourceTurnIndex?: number;
}
export interface SkillNotesFile {
    schemaVersion: 1;
    skillId: string;
    notes: PersistedSkillNote[];
    lastUpdated: number;
    totalBytes: number;
}
export type WriteOutcome = {
    ok: true;
    noteId: string;
    filePath: string;
    totalBytes: number;
} | {
    ok: false;
    reason: WriteRejectReason;
    details: string;
};
export type WriteRejectReason = 'invalid_schema' | 'unknown_category' | 'security_scan' | 'capacity_exceeded' | 'invalid_skill_id' | 'io_error';
export interface WriteOptions {
    /** Override notes directory — primarily for tests. */
    notesDir?: string;
    /** Override `Date.now()` for deterministic tests. */
    now?: number;
    /** Optional registry of valid tool/skill IDs; criticalTools are validated against it when supplied. */
    toolRegistry?: ReadonlySet<string>;
}
/**
 * Validate the agent emission against the schema. Truncates over-long fields
 * rather than failing on them — matches the validation style elsewhere in
 * selfImprove. Returns a normalized emission ready to be persisted.
 */
export declare function validateEmission(raw: unknown, toolRegistry?: ReadonlySet<string>): {
    ok: true;
    value: ReviewAgentNoteEmission;
} | {
    ok: false;
    reason: WriteRejectReason;
    details: string;
};
/**
 * Run security scanner across the emission's free-form text. Returns the
 * matches if any are found so the caller can log the offending excerpt.
 */
export declare function scanEmission(emission: ReviewAgentNoteEmission): string | null;
/**
 * Atomically write a new note to `<notesDir>/<skillId>.notes.json`. The full
 * pipeline runs here: schema validation → security scan → capacity check →
 * tmp+rename write. Returns a structured outcome so the worker can log a
 * reason without throwing.
 */
export declare function writeSkillNote(raw: unknown, opts?: WriteOptions): WriteOutcome;
export declare function readSkillNotesFile(filePath: string): SkillNotesFile;
export declare const __testing: {
    MAX_NOTE_BYTES: number;
    MAX_FILE_BYTES: number;
    NOTE_COOLDOWN_MS: number;
    SKILL_ID_RE: RegExp;
};
//# sourceMappingURL=skillNotesWriter.d.ts.map