import type { HttpClient } from "./client.js"; import { ReadonlySessionLiveView } from "./readonly-live-view.js"; import type { LocalWebSocketConstructor } from "./types.js"; import { ServiceMapKnowledge } from "./workflow-maps.js"; import type { ActionReference, BrowserOperation, EntryReference, MapReference, Observation, Recognition, SessionInfo, TextRead, WaitCondition } from "./workflow-types.js"; export declare function operationId(): string; /** Options for establishing a workflow's initial page, not per-step recognition. */ export type SessionPreparationOptions = { timeoutMs?: number; stateIds?: string[]; operationId?: string; onProgress?: (operation: BrowserOperation) => void; }; export type OpenSessionOptions = { capacityId: string; map: MapReference; profileRef?: string; entryId?: string; controllerId?: string; }; export declare class BrowserOperationError extends Error { readonly operation: BrowserOperation; constructor(operation: BrowserOperation); get observation(): Observation | undefined; } export declare class PageObservation { readonly raw: Observation; constructor(raw: Observation); get recognition(): Recognition; get stateId(): string; get controls(): Record[]; is(state: string | { ref: string; }): boolean; text(selector?: string): TextRead; read(binding: Record): TextRead | unknown; } export declare function waitForOperation(http: HttpClient, accepted: BrowserOperation, onProgress?: (operation: BrowserOperation) => void): Promise>; export declare class BrowserSession { private readonly http; readonly id: string; readonly controllerId: string; private latest?; private epoch; readonly liveView: ReadonlySessionLiveView; constructor(http: HttpClient, id: string, controllerId: string, webSocket?: LocalWebSocketConstructor); info(): Promise; /** Last policy-accepted page. Reading it never starts a scan or grants input authority. */ get currentPage(): PageObservation; takeControl(): Promise; observe(map?: MapReference | ServiceMapKnowledge): Promise; /** Read rendered text now, not only the content included in a state scan. * The selector addresses the top document; its open-shadow descendants are included. * This takes no input action and does not add volatile text to state recognition. */ readText(selector: string, options?: { map?: MapReference | ServiceMapKnowledge; }): Promise<{ value: string; captured_at: string; url: string; document_generation: string; selector: string; operation_id: string; }>; openEntry(entry: EntryReference): Promise; restart(options?: { onProgress?: (operation: BrowserOperation) => void; operationId?: string; }): Promise>; beginEntryRecording(entry: EntryReference): Promise; beginBaselineRecording(): Promise>; discardRecording(options: { expectedVersion: number; recordingId?: string; legacyOperationId?: string; }): Promise>; perform(action: ActionReference, args?: Record, options?: { until?: WaitCondition; timeoutMs?: number; operationId?: string; onProgress?: (operation: BrowserOperation) => void; }): Promise; interact(action: { kind: string; payload: Record; inputValue?: unknown; }, options?: { map?: MapReference | ServiceMapKnowledge; until?: WaitCondition; timeoutMs?: number; operationId?: string; onProgress?: (operation: BrowserOperation) => void; }): Promise; demonstrate(actionKind: string, actionPayload: Record, inputValue?: unknown): Promise>; beginActionRecording(actionKind: string, actionPayload: Record, inputValue?: unknown): Promise>; confirmStable(options?: { mapId?: string; revision?: string; actionId?: string; recordingId?: string; baseline?: boolean; identity?: Record; }): Promise>; close(): Promise; desktop(operation: "open" | "return" | "extend" | "status" | "confirm_baseline", generation?: string): Promise>; askForHelp(message: string): never; private requireControl; private page; private command; } export declare class BrowserSessionsResource { private readonly http; private readonly webSocket?; readonly controllerId: string; constructor(http: HttpClient, webSocket?: LocalWebSocketConstructor | undefined); list(options: { capacityId: string; }): Promise<{ sessions: SessionInfo[]; }>; attach(sessionId: string, controllerId?: string): BrowserSession; prepareForWorkflow(options: OpenSessionOptions & SessionPreparationOptions & import("./developer-takeovers.js").DeveloperTakeoverOptions & { profileRef: string; entryId: string; sessionId?: string; }): Promise; open(options: OpenSessionOptions): Promise; openRecording(options: OpenSessionOptions): Promise; private openSession; }