/** * The discover loop's LLM-facing surface: the system prompt (the closed action vocabulary), * snapshot ranking (#15), and per-turn prompt assembly. Pure — no driver, no I/O. */ import type { PageElement, Step } from "../types.js"; /** How the model must read the page listing — shared by every loop prompt (discover, explore) * so the perception contract can't drift between them (#99). */ export declare const PERCEPTION_RULES: string; /** The closed executable-action vocabulary — ONE definition for every loop prompt, so a prompt * can't teach an action the freeze/execution logic doesn't know (#99). Loop-terminal actions * (`done`, explore's `note`) are appended by each SYSTEM, not listed here. */ export declare const ACTION_VOCABULARY: string; /** How the model must choose targets — shared by every loop prompt (#99). */ export declare const ACTION_RULES: string; export declare const SYSTEM: string; export declare const ELEMENT_LIMIT = 60; /** * #15 — rank the snapshot before the cutoff so it keeps what matters on a heavy page: interactive * controls first, then intent-relevant names. A flat `slice(0, N)` can drop the one control a flow * needs when a page has thousands of elements (seen in dogfooding) — ranking is correctness, not just cost. * Up to EVIDENCE_SLOTS of the cap are reserved for intent-matching non-interactive text (#115); * with no such matches (or when they fit anyway) the ranking is unchanged. */ export declare function rankElements(elements: PageElement[], intent: string, limit: number): PageElement[]; /** Ranked, capped listing with an explicit truncation notice — a silently cut list reads as * "that control doesn't exist" and sends the model wandering instead of scrolling. Duplicate * ordinals are computed over the FULL snapshot before ranking (#127): the driver resolves nth * against the whole tree, so if the cap drops one duplicate, the survivor must still show its * true position, not a renumbered one. */ export declare function renderRankedElements(elements: PageElement[], intent: string, limit?: number): string; /** 0-based position among same role+name duplicates, in snapshot order — exactly the pool a * driver's nth resolution indexes. Elements without a duplicate are absent from the map. */ export declare function dupeOrdinals(elements: PageElement[]): Map; /** Same role+name duplicates carry a `(nth=K)` marker — the 0-based address the model echoes * back and the loop/driver refuse to act without (#127). `nthOf` defaults to ordinals over the * given list; pass the full-snapshot map when rendering a ranked subset. */ export declare function renderElements(elements: PageElement[], nthOf?: Map): string; export declare function buildPrompt(intent: string, render: string, prevRender: string, steps: Step[], failures: string[], currentUrl?: string): string;