import type { BrowserActionInput, BrowserControlResult, BrowserObservation, BrowserTarget } from '@xopcai/browser-control-contract'; import type { Config } from '../../config/schema.js'; import { type BrowserHostFacts } from '../host-facts.js'; import { BrowserUploadStaging } from '../upload-staging.js'; import type { BrowserDriver, ManagedBrowserLiveHandle } from '../drivers/browser-driver.js'; export interface BrowserRuntimeOptions { getConfig: () => Config['browser']; createDriver: () => Promise; /** Optional fingerprint for the active driver configuration; when it changes while idle, the cached driver is recycled. */ getDriverKey?: () => string; allowedUploadRoots?: string[]; uploadStaging?: BrowserUploadStaging; requireStagedUploads?: boolean; canRestoreSetupSession?: (taskKey: string, sessionId: string) => boolean; isTrustedSetupUrl?: (taskKey: string, url: string) => boolean; emit?: (type: string, payload: unknown) => void; publishPreview?: (taskKey: string, source?: { endpointId: string; browserSessionId: string; tabId: number; origin: string; }) => void; publishManagedLive?: (taskKey: string, source?: { browserSessionId: string; handle: ManagedBrowserLiveHandle; url: string; title: string; }) => void; isSessionPinned?: (taskKey: string) => boolean; isHumanControlled?: (taskKey: string) => boolean; resolveTarget?: (taskKey: string) => BrowserTarget | undefined; retainSessionsUntilStopped?: boolean; } export declare class BrowserRuntime { private readonly options; private driver; private driverKey; private connecting?; private readonly opening; private readonly pendingSessionTaskKeys; private sessionsByTask; private readonly activeActions; private readonly pinnedTasks; private readonly humanControlledTasks; private readonly hostFacts; constructor(options: BrowserRuntimeOptions); beginHostAudit(taskKey: string): void; getHostFacts(taskKey: string): BrowserHostFacts | undefined; recordTakeover(taskKey: string, event: { browserSessionId: string; reason: string; url: string; }): void; getUploadStaging(): BrowserUploadStaging | undefined; pinSession(taskKey: string): void; unpinSession(taskKey: string): void; setHumanControlled(taskKey: string, controlled: boolean): void; getSessionId(taskKey: string): string | undefined; getTaskKeyForSession(sessionId: string): string | undefined; getLastObservationForTask(taskKey: string): BrowserObservation | undefined; getLiveHandle(taskKey: string): ManagedBrowserLiveHandle | undefined; waitForIdle(taskKey: string, timeoutMs?: number): Promise; execute(taskKey: string, input: BrowserActionInput, signal?: AbortSignal): Promise; hasSessions(): boolean; shutdown(): Promise; closeTaskSession(taskKey: string, target?: BrowserTarget): Promise; private closeSession; private dispatchCancellable; private dispatch; private executeSequence; private actionDenied; private validateUrl; private validateRedirect; private blockedRedirect; private crossDomainPolicy; private invalidUploadPath; private resolveSession; private openSession; /** Disconnect a cached driver whose configuration no longer matches when no sessions are active. */ reloadDriverIfIdle(): Promise; private currentDriverKey; private getDriver; private constrainResult; private evictExpiredSessions; }