/** * Structured browser action space. * * Adapts the SOTA computer-use / browser-use pattern: instead of authoring raw * JavaScript for every interaction, the model emits a list of structured verbs * (navigate / click / type / …) that reference elements by the numeric `id` * returned from {@link Observation}. Each verb is compiled onto the existing * in-tab `tab.*` helpers and executed through the same worker `run` path, so the * worker protocol is unchanged and the raw-JS `run` escape hatch still works. */ export type BrowserActionVerb = "navigate" | "click" | "type" | "fill" | "select" | "press" | "scroll" | "back" | "wait" | "observe" | "extract" | "screenshot"; export interface BrowserActionStep { verb: BrowserActionVerb; /** Element id from a prior `observe` (preferred for click/type). */ id?: number; /** CSS / puppeteer selector when not addressing by `id`. */ selector?: string; /** Text to type. */ text?: string; /** Value for `fill`. */ value?: string; /** Option value(s) for `select`. */ values?: string[]; /** URL for `navigate`. */ url?: string; /** Key for `press` (e.g. "Enter"). */ key?: string; /** Horizontal scroll delta. */ dx?: number; /** Vertical scroll delta. */ dy?: number; /** Sleep duration for `wait` when no selector is given. */ ms?: number; /** Extract format. */ format?: "markdown" | "text" | "html"; /** Navigation wait condition for `navigate`. */ wait_until?: "load" | "domcontentloaded" | "networkidle0" | "networkidle2"; /** Only return interactive/viewport elements for `observe`. */ viewport_only?: boolean; include_all?: boolean; } /** * Validate a single step's required fields. Returns an error string, or * `undefined` when the step is well-formed. */ export declare function validateActionStep(step: BrowserActionStep, index: number): string | undefined; /** Validate the full step list. Throws on the first invalid step. */ export declare function validateActionSteps(steps: readonly BrowserActionStep[]): void; /** * Compile structured steps into a JS program for the in-tab `run` worker. Steps * are embedded as parsed JSON (no string interpolation, so values cannot inject * code) and dispatched by a fixed interpreter against the `tab` / `page` helpers. */ export declare function compileActionSteps(steps: readonly BrowserActionStep[]): string;