/** * Copyright (c) 2025 Elara AI Pty Ltd * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details. */ /** * The copilot's transitions (B§5 — `Sheet Spec.md` §5 rows 10–13): what the * runner's results do to the state, the ⇥ walk over pending fills (first * press arms the next target, the next writes it and arms the following), * ⏎ taking the next suggestion, ⌘⏎ / ⌘⇧⏎ the row fill and everything, the * esc rungs (a selected proposal → the row fill → every suggestion), ⌫ * rejecting the armed fill or the selected proposal — and the memory of what * was rejected. Pure functions over the machine state. * * @packageDocumentation */ import { type CellRef, type SheetEvent, type SheetMachineCtx, type SheetUiState, type Suggestions, type Transition } from "./sheet-types.js"; /** The pending fills in column order — the order ⇥ walks. */ export declare function fillOrder(sugg: Suggestions | null, ctx: SheetMachineCtx): { key: string; c: number; }[]; /** The anchor's row-space index, if it is still on the sheet. */ export declare function anchorRow(sugg: Suggestions | null, ctx: SheetMachineCtx): number | undefined; /** The one cell a ⇥ press writes next — exactly one, ever: the armed fill, else the first (last, walking back). */ export declare function nextTargetOf(s: SheetUiState, ctx: SheetMachineCtx, back?: boolean): (CellRef & { key: string; }) | null; /** Take one fill: write it, then arm the following target so the next ⇥ writes that one. */ export declare function takeFill(s: SheetUiState, ctx: SheetMachineCtx, key: string, back?: boolean): Transition; /** Fill the whole row in one step (⌘⏎, the gutter's →). */ export declare function fillRow(s: SheetUiState, ctx: SheetMachineCtx): Transition; /** * Take the proposals up to `upTo` (inclusive) — the row fill first, then the * rows in order; the rest re-anchor on the last row inserted so the next one * is already waiting (B§5.2). */ export declare function takeProposals(s: SheetUiState, ctx: SheetMachineCtx, upTo: number): Transition; /** Reject a proposal — and remember the pairing so it is not offered after that driver value again. */ export declare function rejectProposal(s: SheetUiState, ctx: SheetMachineCtx, i: number): Transition; /** Dismiss one fill — remembered per row and key. */ export declare function rejectFill(s: SheetUiState, ctx: SheetMachineCtx, key: string): Transition; /** The runner's result lands — for an anchor still on the sheet. */ export declare function applyReady(s: SheetUiState, ctx: SheetMachineCtx, anchorId: string, sugg: Suggestions | null): Transition; /** An async provider settled — merged when its anchor and key are still pending. */ export declare function applyLanded(s: SheetUiState, e: Extract): Transition; /** The anchor became a real row: the suggestions follow its new id. */ export declare function rekeySuggest(s: SheetUiState, from: string, to: string): SheetUiState; /** Every suggestion dropped. */ export declare function clearSuggest(s: SheetUiState): SheetUiState; /** The rows changed: a suggestion whose anchor left the sheet goes with it; the proposal selection clamps. */ export declare function afterRowsChanged(s: SheetUiState, ctx: SheetMachineCtx): SheetUiState; /** The esc rungs the copilot adds: a selected proposal → the row fill (rows stay) → everything. `null` = nothing to drop. */ export declare function escSuggest(s: SheetUiState): Transition | null; /** * The sheet keys the copilot claims while something is pending (B§6): ⇥ walks * the fills then takes rows, ⏎ takes the next suggestion, ⌘⏎ the row fill, * ⌘⇧⏎ everything, ⌫ rejects the armed fill or the selected proposal. `null` * hands the key back to the sheet. */ export declare function suggestKey(s: SheetUiState, e: Extract, ctx: SheetMachineCtx): Transition | null; //# sourceMappingURL=sheet-suggest-state.d.ts.map