/** * Interactive automation + output operations for the browser plugin. * * Every function here drives the one persistent page held by a BrowserSession * (cdp-session.ts). They never throw to the MCP layer — each returns a * structured ActionResult so the agent always sees a named outcome instead of a * 500. Element targeting is by CSS selector run through Runtime.evaluate (raw * CDP has no Playwright selector engine); the snapshot tool emits a unique CSS * selector per interactive node so the agent clicks exactly what it read. * * ensure() live? ──no──▶ outcome "session-lost" ("call browser-navigate first") * │yes (only navigate() re-attaches a dead page) * ▼ * Runtime.evaluate / Input.* / Page.* ──▶ structured ActionResult */ import { BrowserSession, type CdpDeps, type CdpOutcome } from "./cdp-session.js"; export type ActionOutcome = CdpOutcome | "selector-not-found" | "option-not-found" | "wait-timeout" | "pdf-failed" | "screenshot-failed" | "unsupported-key"; export interface ActionResult { ok: boolean; outcome: ActionOutcome; detail?: string; /** Tool-specific payload (snapshot tree, console lines, tab list, file bytes…). */ data?: unknown; } export interface ActionCtx { deps: CdpDeps; commandTimeoutMs: number; loadTimeoutMs: number; /** Injected so pdf-save / screenshot are testable without touching disk. */ writeFile: (path: string, data: Buffer) => Promise; } export declare function navigate(session: BrowserSession, params: { url: string; loadTimeoutMs?: number; }, ctx: ActionCtx): Promise; export declare function snapshot(session: BrowserSession, _params: Record, ctx: ActionCtx): Promise; export declare function click(session: BrowserSession, params: { selector: string; }, ctx: ActionCtx): Promise; export declare function fill(session: BrowserSession, params: { selector: string; value: string; }, ctx: ActionCtx): Promise; export declare function fillForm(session: BrowserSession, params: { fields: Array<{ selector: string; value: string; }>; }, ctx: ActionCtx): Promise; export declare function hover(session: BrowserSession, params: { selector: string; }, ctx: ActionCtx): Promise; export declare function selectOption(session: BrowserSession, params: { selector: string; value?: string; label?: string; }, ctx: ActionCtx): Promise; export declare function type(session: BrowserSession, params: { text: string; selector?: string; }, ctx: ActionCtx): Promise; export declare function pressKey(session: BrowserSession, params: { key: string; }, ctx: ActionCtx): Promise; export declare function waitFor(session: BrowserSession, params: { selector?: string; text?: string; timeoutMs?: number; }, ctx: ActionCtx): Promise; export declare function handleDialog(session: BrowserSession, params: { accept: boolean; promptText?: string; }): ActionResult; export declare function evaluate(session: BrowserSession, params: { expression: string; }, ctx: ActionCtx): Promise; export declare function consoleMessages(session: BrowserSession): ActionResult; export declare function tabs(session: BrowserSession, params: { action: "list" | "new" | "select" | "close"; id?: string; url?: string; }, ctx: ActionCtx): Promise; export declare function pdfSave(session: BrowserSession, params: { path: string; landscape?: boolean; scale?: number; printBackground?: boolean; }, ctx: ActionCtx): Promise; export declare function screenshot(session: BrowserSession, params: { path: string; selector?: string; fullPage?: boolean; }, ctx: ActionCtx): Promise; export declare function resize(session: BrowserSession, params: { width: number; height: number; }, ctx: ActionCtx): Promise; //# sourceMappingURL=cdp-actions.d.ts.map