import type { Database } from 'better-sqlite3'; import type { WorkItem, WorkItemStatus } from './store.js'; /** * Closing a Todo TREE — the half of a cascade that is the same whichever * terminal it heads for, plus the close-specific rule that is not. * * Both callers run the sweep inside their own transaction, so the roll-up gate * in `transitions.ts` is already satisfied by the time the container itself * moves, and a refusal anywhere leaves the whole tree untouched: * `archiveWorkItem` cancels the descendants, `transition(…, 'done')` closes them. * * The import of `transition` is circular by design — `transitions.ts` reaches * back here for the close. Nothing on either side runs at module scope, so both * bindings are live by the time a cascade actually runs. */ /** An open descendant a cascade is about to close or cancel. */ export interface CascadeRow { id: string; status: WorkItemStatus; depth: number; } /** Every still-open descendant of `item`, deepest first. The indexed `root_id` * sweep does the coarse work and the parent walk narrows it to this branch, * because a root holds sibling branches this cascade must not touch. */ export declare function openDescendantsDeepestFirst(db: Database, item: WorkItem): CascadeRow[]; /** * Close every open descendant of `item` as `done`, deepest first. * * Where this parts company with cascade-cancel: cancel may bury an `escalated` * descendant, because "abandoned" is a truthful thing to say about a question * nobody answered. `done` claims it WAS answered, so this refuses by name until * the caller says otherwise. */ export declare function cascadeCloseDescendants(db: Database, item: WorkItem, actor: string, acknowledgeEscalated: boolean): void; //# sourceMappingURL=cascade.d.ts.map