/** * The unattended decision log — `.aidlc/state//unattended-stops.md` — read as data * (unattended-decision-diary). * * The agent writes one `## . — <slug>` entry per default, decision or hard stop. * Autopilot counts the open questions in it before a merge (`driver.ts` `advancePr`), and * `aidlc autopilot review` writes a person's verdict back into it and promotes the good calls * into an always-read guidance layer. * * Every byte here was written by an agent, so it is cleaned before it reaches a terminal or a * guidance file every later agent reads (AC-19). * * Design: design.md C2 * * @module */ export declare const ENTRY_TYPES: readonly ["default", "interpretation", "deviation", "open-question"]; export type EntryType = (typeof ENTRY_TYPES)[number]; export declare const VERDICTS: readonly ["kept", "rejected", "promoted"]; export type Verdict = (typeof VERDICTS)[number]; export interface LogEntry { /** From the `## <n>.` heading. */ n: number; title: string; /** The text after the heading's last ` — `; '' when it has none. */ slug: string; type: EntryType; /** * False when the entry has no `**Type:**` line. Such an entry keeps `type: 'default'`, so the * merge check and `pending` read it as before; only `promotable` reads this (design D4). */ typed: boolean; verdict: Verdict | null; /** The entry's lines, heading included, as written. */ lines: string[]; /** Index of the heading line in the file. */ start: number; } /** The longest text one promoted entry carries into guidance. */ export declare const PROMOTED_CAP = 2000; export declare const DECISIONS_FILE = "decisions.md"; export declare const DECISIONS_LAYER = "decisions"; /** An instance name as `aidlc start` makes one: it becomes a path segment. */ export declare const INSTANCE_RE: RegExp; export declare function stopsLogPath(projectDir: string, instance: string): string; /** Every entry in the log, in file order (AC-7). Text before the first entry belongs to none. */ export declare function parseLog(text: string): LogEntry[]; /** Open questions no person has answered yet; 0 for no log. */ export declare function unreviewedOpenQuestions(text: string | null): number; /** Who decided, after the date of a verdict taken from an agent's proposal (review-from-agent-proposal/AC-11). */ export declare const PROPOSAL_NOTE = "accepted from the agent's proposal"; /** Who decided, after the date of a verdict a person gave at a prompt (review-from-agent-proposal/AC-12). */ export declare const PERSON_NOTE = "judged by the person"; /** Who decided, for a verdict given in the autopilot watcher. */ export declare function watcherNote(by: string): string; /** * The log with entry `n`'s verdict set: its `**Review:**` line replaced, or one added after * its last non-blank line. Every other byte is kept (AC-15). `note`, when given, says who * decided, in parentheses after the date, where the verdict parser does not read * (review-from-agent-proposal/AC-13). */ export declare function withVerdict(text: string, n: number, verdict: Verdict, date: string, note?: string): string; /** * Agent text made safe to print and to read as guidance: C0 controls but newline and tab, * DEL and C1 controls (ESC among them) removed, then capped (AC-19, design D6). */ export declare function cleanEntry(text: string, cap?: number): string; /** * Only a decision a person can stand behind becomes guidance (AC-18). An untyped entry, from a * log written before types existed, may be one; a typed default or an open question never is * (review-from-agent-proposal/AC-14). */ export declare function promotable(entry: LogEntry): boolean; /** The entry as it reads in `decisions.md`: a heading naming the instance and date, then its body. */ export declare function decisionBlock(instance: string, date: string, entry: LogEntry): string; /** Write through a temp file in the same directory, so an interrupted write leaves the old file whole. */ export declare function writeWhole(path: string, text: string): void; export type PromoteResult = { ok: true; file: string; } | { ok: false; reason: string; }; /** * Append a promotable entry to `.aidlc/guidance/decisions.md`, creating it when absent, and * register the layer (AC-17). An open question or a default is refused and nothing is * written (AC-18). */ export declare function promote(projectRoot: string, instance: string, date: string, entry: LogEntry): PromoteResult; /** The longest answer a correction carries, so a long Decided field cannot cut it off (design D2). */ export declare const ANSWER_CAP = 1000; /** * The entry's `**Decided:**` field as written: its line plus the lines it wraps onto, up to a * blank line or the next `**Field:**` line; null when it has none * (rejected-decision-records-correction/AC-2). */ export declare function decidedField(entry: LogEntry): string | null; /** * A rejected call as it reads in `decisions.md`: what the run decided and what it should have * done. The answer is capped first and the Decided field gets what is left, so the person's * answer — the part that teaches — is never the part cut (design D2). */ export declare function correctionBlock(instance: string, date: string, entry: LogEntry, shouldHave: string): string; /** * Append a rejected call and what it should have been to `decisions.md`, and register the * layer. What promote refuses is refused here too, and so is an empty answer: a blank * correction would sit in a file every later agent reads (AC-4, design D3). */ export declare function recordCorrection(projectRoot: string, instance: string, date: string, entry: LogEntry, shouldHave: string): PromoteResult; //# sourceMappingURL=decisions.d.ts.map