import type { QuestionData, QuestionnaireResult } from "../tool/types.js"; import type { WrappingSelectItem } from "../view/components/wrapping-select.ts"; import type { QuestionnaireAction } from "./key-router.ts"; import type { QuestionnaireState } from "./state.ts"; /** Session-lifetime constants. No live-component reads — peripheral values live on canonical state. */ export interface ApplyContext { questions: readonly QuestionData[]; itemsByTab: ReadonlyArray; chatAsOption?: boolean; } /** * Declarative side-effects emitted by `reduce`. The runtime executes them after * committing the new state, then asks the props-adapter to re-project. Closed set — * adding an effect requires updating both the union AND the runtime's `runEffect` switch * (compiler-enforced exhaustive). No string-keyed escape hatch. */ export type Effect = { kind: "set_input_buffer"; value: string; caret: number; } | { kind: "set_notes_value"; value: string; } | { kind: "set_notes_focused"; focused: boolean; } | { kind: "forward_notes_keystroke"; data: string; } | { kind: "done"; result: QuestionnaireResult; }; export interface ApplyResult { state: QuestionnaireState; effects: readonly Effect[]; } /** * Pure reducer: (state, action, ctx) → (state, Effect[]). Mirrors `rpiv-todo`'s `applyTaskMutation`. * Delegates to `HANDLERS` — per-kind handlers above are pure, named, and individually testable. * `ignore` is also handled outside the reducer by `handleIgnoreInline` in the runtime fast path. */ export declare function reduce(state: QuestionnaireState, action: QuestionnaireAction, ctx: ApplyContext): ApplyResult; //# sourceMappingURL=state-reducer.d.ts.map