/** * Target and route resolution plus reachability preflight. * * lookout never starts services. When a target is down it reports the fact and * prints the target's startHint so the operator (human or agent) starts it the * way that project intends. */ import { type LookoutConfig, type TargetDef } from "./types.js"; export interface ResolvedRoute { path: string; name: string; url: string; states: string[]; element?: string; /** Absolute path of the route's design hand-off image, when configured. */ design?: string; /** False when the route opted out of navigation discovery. */ navigation?: boolean; /** False when the route opted out of provenance sidecars. */ provenance?: boolean; } export interface ResolvedTarget { def: TargetDef; routes: ResolvedRoute[]; } export interface TargetStatus { name: string; url: string; routes: number; up: boolean; status: number | null; /** * What the server said it served, epoch milliseconds, or null when it said * nothing. Null is the hot-reload case and means no opinion, never fresh. * freshness.ts compares it against the source on disk. */ servedAt: number | null; startHint?: string; } /** Normalize a target's routes ("/x" strings and RouteDef objects) to one shape. */ export declare function resolveRoutes(target: TargetDef, defaultElement?: string, /** Config file path; design references resolve relative to it. */ designBase?: string | null): ResolvedRoute[]; /** Filter config targets by --targets and resolve their routes. */ export declare function resolveTargets(config: LookoutConfig, only?: string[], routesFilter?: string[], /** Config file path; route design references resolve relative to it. */ configPath?: string | null): ResolvedTarget[]; /** Probe each target's readyPath. Never starts anything. */ export declare function preflight(targets: ResolvedTarget[]): Promise; /** * Why the requested targets cannot be captured, or null when they all can. * * Shared so the CLI and the UI say the same thing about the same state. The UI * needs this as a value rather than a throw: it refuses to spawn a doomed run * and shows the reason, where before it spawned one and discarded the stderr * that would have explained it. */ export declare function downReason(statuses: TargetStatus[]): string | null; /** * Throw with start instructions when any requested target is down, or when * the device fold's own probe (native-preflight.ts) found a device missing. * Both reasons print together: a project judged in both folds is told * everything that stands in the run's way at once. */ export declare function requireUp(statuses: TargetStatus[], deviceReason?: string | null): void; /** * Whether a stored shot still describes something the current config asks * for. The capture report accumulates across runs and replaces only same-id * shots, so a route or state removed from the config would otherwise be * judged (and its findings refreshed) forever. Web only: native target * resolution is a different shape, and a conservative predicate that never * prunes a native shot beats one that guesses. * * `plannedStates` is navigation discovery's slice of configured intent: the * synthesized states `.lookout/navigation.json` currently names per * `target|route` key. A state a plan stopped naming is retired here exactly * like one removed from a route's `states`. */ export declare function shotInConfig(shot: { platform: string; target: string; route: string; state: string; }, targets: ResolvedTarget[], plannedStates?: ReadonlyMap>): boolean;