import type { CardFieldGuard, OwnerApproval, UntrustedContentPort } from './browser-types.js'; export declare const DEFAULT_NAVIGATION_TIMEOUT_MS = 30000; export declare const DEFAULT_ACTION_TIMEOUT_MS = 15000; export declare const DEFAULT_TEXT_LIMIT = 20000; export interface BrowserTarget { readonly sessionId?: string | undefined; readonly pageId?: string | undefined; } export interface BrowserEngineOptions { /** Where screenshots are written. Must be a directory the product's read path can open. */ readonly screenshotDirectory: string; /** * The product's untrusted-content contract. Required, and deliberately not * defaulted: an engine with no port would read pages and label nothing, which * is the boundary silently absent rather than a compile error. The * implementation is expected to be backed by the process-wide ledger every * other surface that reads stranger-written text also writes to, the email * surface most of all, so "read a page, then send a message" is visible as * one composition rather than two unrelated acts. */ readonly untrusted: UntrustedContentPort; /** An owner approval covering an outward action in this turn, when one exists. */ readonly approval?: OwnerApproval | null; /** * Records that this session wrote a file, so the product's read path can open * it afterwards. Optional: a surface with no session write ledger passes * nothing and screenshots are simply written and reported. */ readonly recordSessionWrite?: ((path: string) => void) | undefined; /** * Keeps card material out of everything a page hands back. * * Optional here so every existing caller keeps working, and NOT optional in * practice: `payments.checkout.fillCard` refuses to type into an engine that * has none. A browser used for ordinary automation needs no guard; a browser * used to pay for something cannot be made to run without one. */ readonly cardFieldGuard?: CardFieldGuard | undefined; } /** Fields the extraction contract can ask for. Nothing here can invoke anything. */ export type BrowserExtractField = 'text' | 'html' | 'value' | 'attributes'; /** * Runs in the page. Fixed, shipped in this file, and never assembled from * caller input: the caller only chooses which of these fields it wants. */ export declare function readElementData(element: Element, fields: string[]): Record; export declare class UntrustedEffectError extends Error { readonly fix: string; constructor(message: string, fix: string); } /** * Whether the current page is a credential-entry page this engine should * refuse to drive. * * Two independent signals, either sufficient on its own: * - a password-type field is present right now, which works for any site * and needs no provider list at all; * - the URL is on a known identity provider's own sign-in route, which * catches the page before a password field has necessarily rendered yet * (an email/identifier step, an account picker). * * `hasPasswordField` is supplied by the caller rather than computed here: the * engine already has either a stored snapshot or a live page to ask, and * which one it uses is a decision this pure function should not have to make. */ export declare function looksLikeCredentialPage(url: string, hasPasswordField: boolean): boolean; /** * The message/fix pair for refusing an interactive action on a credential * page, or null when the page is not one. * * `elements` is whatever the last snapshot recorded, a plain `{ role, name }` * shape rather than the full `BrowserElementRef`, so this stays a pure * function with no dependency on the snapshot module. The engine is the only * caller, and it is the one place that knows whether a snapshot exists at all. */ export declare function credentialPageRefusal(url: string, elements: readonly { readonly role: string; readonly name: string; }[], action: string): { readonly message: string; readonly fix: string; } | null; /** * What `launch()` tells the caller happened. Reuse is called out explicitly, * only one managed session runs at a time, so a second launch call getting * the same session back is a normal outcome, not a silent no-op. */ export declare function launchNote(session: { readonly reused: boolean; readonly headless: boolean; readonly sessionId: string; }): string; export declare function normalizeUrl(rawUrl: string): string; //# sourceMappingURL=browser-engine-contract.d.ts.map