/** * `aidlc autopilot answer` — apply a person's answer to one pending entry, and record it so * no session asks it again (autopilot-watcher-asks-person/AC-19..AC-30). * * The caller names an entry by fingerprint and an option by id; the command it applies is * looked up in a list computed here, never taken from the caller, so a session can run only * what the list offered (design D1). Approving an item and keeping or rejecting a logged * decision are applied here, in-process, through the same library calls the approve and review * commands make, and each records who gave it in the watcher (design D2, Q1: B). Those two * commands keep their terminal test. An option only a person can carry out — finishing by * hand, a new session, an edit — runs nothing, and the person is handed the steps. * * The answers file sits beside `state.json` in the git common dir: every worktree and * session reads the same one, and nothing there is committed (design D3). * * Design: design.md C2 * * @module */ import { type PendingEntry, type PendingKind } from './pending.js'; import type { AutopilotPaths } from './state.js'; export interface AnswerRecord { at: string; fingerprint: string; kind: PendingKind; /** The instance or roadmap item the entry was about. */ subject: string; option: string; by: string; note?: string; result: 'applied' | 'handed-off' | 'recorded'; } export declare const OPTION_RE: RegExp; export declare const NOTE_MAX = 500; export declare const BY_MAX = 100; /** An answers lock older than this belongs to an answer that died. */ export declare const ANSWER_LOCK_STALE_MS = 60000; export declare function answersPath(p: AutopilotPaths): string; /** Every record, in the order written; a line that does not parse is skipped. */ export declare function readAnswers(p: AutopilotPaths): AnswerRecord[]; export declare function answeredSet(p: AutopilotPaths): Set; /** Text a person typed, made safe to write and print: controls removed, one line, capped. */ export declare function cleanNote(text: string, max: number): string; export interface AnswerDeps { paths: AutopilotPaths; /** The primary checkout's project root, where roadmap moves land. */ repo: string; /** The list as it is now; called inside the lock. */ pending: () => PendingEntry[]; /** Who answered, already cleaned. */ by: string; now: () => number; out: (line: string) => void; err: (line: string) => void; /** Put an errored item back on its resume step, under the autopilot lock (AC-24). */ retry: (instance: string) => { ok: true; step: string; } | { ok: false; reason: string; }; /** * Approve the phase an item paused after, under the autopilot lock, recording `by` as the * person who approved it in the watcher (Q1: B). */ approve: (instance: string, by: string) => { ok: true; phase: string; runActive: boolean; } | { ok: false; reason: string; }; } export interface AnswerOptions { note?: string; rank?: number; } /** * Apply `optionId` to the entry `fp` names, and record it. Returns the exit code: 0 applied, * handed off or recorded; 1 refused or failed, with nothing recorded (AC-19..AC-28, AC-30). */ export declare function runAnswer(fp: string, optionId: string, opts: AnswerOptions, deps: AnswerDeps): number; //# sourceMappingURL=answers.d.ts.map