import type { BrowserContext, Page } from 'playwright-core'; import type { ResolvedContextOptions } from './utils/presets'; export interface GeolocationConfig { latitude: number; longitude: number; } export interface ViewportConfig { width: number; height: number; } export interface PresetConfig { locale: string; timezoneId: string; geolocation: GeolocationConfig; viewport?: ViewportConfig; } export interface ContextOverrides { preset?: string; locale?: string; timezoneId?: string; geolocation?: GeolocationConfig; viewport?: ViewportConfig; } export interface LinkInfo { text: string; url: string; } export interface RefInfo { role: string; name: string; nth: number; } export interface TabState { page: Page; refs: Map; visitedUrls: Set; toolCalls: number; consoleMessages: ConsoleEntry[]; pageErrors: PageErrorEntry[]; lastSnapshot?: string | null; } export interface ConsoleEntry { timestamp: number; type: 'log' | 'warning' | 'error' | 'info' | 'debug' | 'trace'; text: string; location?: { url: string; lineNumber: number; columnNumber: number; }; } export interface PageErrorEntry { timestamp: number; message: string; stack?: string; } export interface SessionData { context: BrowserContext; tabGroups: Map>; lastAccess: number; } export interface WaitForPageReadyOptions { timeout?: number; waitForNetwork?: boolean; } export type AllowedUrlScheme = 'http:' | 'https:'; export interface CookieInput { name: string; value: string; domain: string; path?: string; expires?: number; httpOnly?: boolean; secure?: boolean; sameSite?: string; } export interface ScrollElementParams { selector?: string; ref?: string; deltaX?: number; deltaY?: number; scrollTo?: { top?: number; left?: number; }; } export interface ScrollPosition { scrollTop: number; scrollLeft: number; scrollHeight: number; clientHeight: number; scrollWidth: number; clientWidth: number; } export interface EvaluateParams { expression: string; timeout?: number; } export interface EvaluateResult { ok: boolean; result?: unknown; resultType?: string; truncated?: boolean; error?: string; errorType?: 'js_error' | 'timeout' | 'validation'; } export interface DownloadInfo { id: string; contentUrl: string; tabId: string; userId: string; suggestedFilename: string; savedFilename: string; mimeType: string; size: number; status: 'pending' | 'completed' | 'failed' | 'canceled'; error?: string; url: string; createdAt: number; completedAt?: number; } export interface DownloadListFilters { tabId?: string; userId: string; status?: string; extension?: string; mimeType?: string; minSize?: number; maxSize?: number; sort?: string; limit?: number; offset?: number; } export interface ExtractedResource { url: string; filename: string | null; mimeType: string | null; tagName: string; type: 'image' | 'link' | 'media' | 'document'; alt: string | null; width: number | null; height: number | null; isBlob: boolean; isDataUri: boolean; hasDownloadAttr: boolean; text: string | null; ref: string | null; parentSelector: string | null; } export interface ContainerInfo { selector: string; tagName: string; childCount: number; } export interface ExtractionMetadata { extractionTimeMs: number; lazyLoadsTriggered: number; blobsResolved: number; } export interface ExtractResourcesParams { userId?: string; selector?: string; types?: ('images' | 'links' | 'media' | 'documents')[]; extensions?: string[]; resolveBlobs?: boolean; triggerLazyLoad?: boolean; } export interface ExtractResourcesResult { ok: boolean; container: ContainerInfo; resources: { images: ExtractedResource[]; links: ExtractedResource[]; media: ExtractedResource[]; documents: ExtractedResource[]; }; totals: { images: number; links: number; media: number; documents: number; total: number; }; metadata: ExtractionMetadata; } export type StructuredScalarKind = 'text' | 'html' | 'attr' | 'url' | 'number'; export interface StructuredExtractScalarSchema { kind: StructuredScalarKind; selector?: string; required?: boolean; trim?: boolean; join?: string; coerce?: 'number' | 'url'; attr?: string; } export interface StructuredExtractObjectSchema { kind: 'object'; selector?: string; required?: boolean; fields: Record; } export interface StructuredExtractListSchema { kind: 'list'; selector?: string; required?: boolean; item: StructuredExtractSchema; } export type StructuredExtractSchema = StructuredExtractScalarSchema | StructuredExtractObjectSchema | StructuredExtractListSchema; export type StructuredExtractRootSchema = StructuredExtractObjectSchema | StructuredExtractListSchema; export interface StructuredExtractMetadata { extractionTimeMs: number; matchedRoots?: number; } export interface StructuredExtractResult { ok: true; data: unknown; metadata: StructuredExtractMetadata; } export interface BatchDownloadParams { userId: string; selector?: string; types?: ('images' | 'links' | 'media' | 'documents')[]; extensions?: string[]; resolveBlobs?: boolean; concurrency?: number; maxFiles?: number; } export interface BatchDownloadResult { ok: boolean; batchId: string; downloads: DownloadInfo[]; errors: { url: string; error: string; }[]; totals: { completed: number; failed: number; total: number; }; } export interface YouTubeTranscriptResult { status: 'ok' | 'error'; code?: number; message?: string; transcript?: string; video_url: string; video_id: string; video_title?: string; title?: string; language?: string; total_words?: number; available_languages?: Array<{ code: string; name: string; kind: string; }>; } export type GeoMode = 'explicit-wins' | 'proxy-locked'; export interface RawProxyOverride { host: string; port: string; username?: string; password?: string; } export interface ProxyProfileConfig { server: string; username?: string; password?: string; locale?: string; timezoneId?: string; geolocation?: GeolocationConfig; } export interface SessionProfileInput extends ContextOverrides { proxyProfile?: string; proxy?: RawProxyOverride; geoMode?: GeoMode; } export interface ResolvedProxyConfig { source: 'server-default' | 'named-profile' | 'raw-override'; server: string; username?: string; password?: string; profileName?: string; locale?: string; timezoneId?: string; geolocation?: GeolocationConfig; } export interface ResolvedSessionProfile extends ResolvedContextOptions { sessionKey: string; geoMode: GeoMode; proxy: ResolvedProxyConfig | null; signature: string; } declare global { namespace Express { interface Request { reqId?: string; startTime?: number; } } } //# sourceMappingURL=types.d.ts.map