Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Fetch any URL via Chrome CDP and convert the rendered page to clean markdown with YouTube transcript support.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
scripts/lib/adapters/types.ts
1import type { BrowserSession } from "../browser/session";2import type { CdpClient } from "../browser/cdp-client";3import type { NetworkJournal } from "../browser/network-journal";4import type { ExtractedDocument } from "../extract/document";5import type { MediaDownloadRequest, MediaDownloadResult, MediaAsset } from "../media/types";6import type { Logger } from "../utils/logger";78export interface AdapterInput {9url: URL;10}1112export type LoginState = "logged_in" | "logged_out" | "unknown";13export type InteractionKind = "login" | "cloudflare" | "recaptcha" | "hcaptcha" | "captcha" | "challenge";1415export interface AdapterLoginInfo {16provider: string;17state: LoginState;18required?: boolean;19username?: string;20reason?: string;21}2223export interface WaitForInteractionRequest {24type: "wait_for_interaction";25kind: InteractionKind;26provider: string;27prompt: string;28reason?: string;29timeoutMs?: number;30pollIntervalMs?: number;31requiresVisibleBrowser?: boolean;32}3334export type AdapterProcessResult =35| {36status: "ok";37document: ExtractedDocument;38media?: MediaAsset[];39login?: AdapterLoginInfo;40}41| {42status: "needs_interaction";43interaction: WaitForInteractionRequest;44login?: AdapterLoginInfo;45}46| {47status: "no_document";48login?: AdapterLoginInfo;49};5051export interface AdapterContext {52input: AdapterInput;53browser: BrowserSession;54network: NetworkJournal;55cdp: CdpClient;56log: Logger;57outputFormat: "markdown" | "json";58timeoutMs: number;59interactive: boolean;60downloadMedia: boolean;61}6263export interface Adapter {64name: string;65match(input: AdapterInput): boolean;66checkLogin?(context: AdapterContext): Promise<AdapterLoginInfo>;67exportCookies?(context: AdapterContext, profileDir?: string): Promise<boolean>;68restoreCookies?(context: AdapterContext, profileDir?: string): Promise<boolean>;69downloadMedia?(request: MediaDownloadRequest): Promise<MediaDownloadResult>;70process(context: AdapterContext): Promise<AdapterProcessResult>;71}7273export type { MediaAsset };74