/** * Deterministic execution of a cached navigation plan. No AI here: the plan * was written earlier (by `check`'s refresh step), this module turns it into * ordinary StateRecipes the capture loop runs, plus the link-verification * clicks that produce findings instead of shots. * * Policy (the user's choice): everything planned gets actuated, destructive * controls included. Risk classification orders the clicks (risky last, * session-killers last of all) and triggers sign-in recovery; it never * blocks. The only belts are structural: an entry must still exist in the * fresh harvest, must be on-origin, must carry a filename-safe non-colliding * name, and must fit the cap. */ import type { Page } from "playwright"; import type { DeterministicFinding, NavigationConfig, StateRecipe } from "../types.js"; import type { Affordance, AffordanceRef, RouteHarvest, RoutePlan } from "./store.js"; import { type Interaction } from "./indicate.js"; export declare const DEFAULT_MAX_STATES = 5; export declare const DEFAULT_MAX_CHECKS = 8; /** A planned control that is invisible at the current form factor: skip, no finding. */ export declare class NavSkip extends Error { } /** A planned interaction that went wrong: capture-error on the rest shot, route continues. */ export declare class NavStateError extends Error { } /** Selector first (it came from the fresh harvest), role+name as the fallback. */ export declare function matchAffordance(ref: AffordanceRef, harvest: RouteHarvest): Affordance | null; /** Form factors a state must not be attempted at, by state name. */ export type SkipAt = Map>; export interface SynthesizedStates { states: [string, StateRecipe][]; /** State names whose click ends the session; capture re-runs signIn after them. */ sessionDestructive: Set; /** * States a form factor must not attempt. Hovering is not an interaction a * phone has, so a hover state there is skipped outright: no shot, no finding, * no ledger entry, rather than a phone shot that photographs nothing. */ skipAt: SkipAt; /** How a state was reached, for the states reached by focus or hover. */ interaction: Map; /** Navigation-outcome names: their shots show another page, so the route's design reference must not ride along. */ suppressDesign: Set; /** What was clicked to reach each state, and what was expected, for the shot record. */ affordances: Map; } export declare function synthStates(args: { plan: RoutePlan; harvest: RouteHarvest; navigation: NavigationConfig; /** Config recipe names; a hand-written recipe always wins a name collision. */ recipeNames: readonly string[]; routeUrl: string; /** * The selector this route is photographed through, when it has one. An * indicator state is only meaningful inside the frame that gets captured, so * the actuation needs to know what that frame is. */ routeElement?: string | null; }): SynthesizedStates; /** * Verification clicks: links the plan routed to `checks` (their destinations * are configured routes, already judged under their own identity at rest). * Each click must demonstrably work; what it must not do is produce a shot. */ export declare function runNavChecks(args: { page: Page; plan: RoutePlan; harvest: RouteHarvest; navigation: NavigationConfig; routeUrl: string; }): Promise;