import type { Artifact, Connector, ExportResult, TabScopedResult, TabView } from "../connector/connector.js"; import type { ConsoleEntry, ConsoleQuery, NetworkEntry, NetworkQuery, TabId } from "../connector/store.js"; import type { AuditCategory, AuditReport } from "../lighthouse/types.js"; export interface PageInfo { url: string; tabId: number | string | null; extensionConnected: boolean; connectedTabs: number; } export interface TabListing { tabs: TabView[]; currentTabId: TabId | null; connectedTabs: number; } export type ScopedConsoleQuery = ConsoleQuery & { allTabs?: boolean; }; export type ScopedNetworkQuery = NetworkQuery & { allTabs?: boolean; }; export interface ConnectorStatus { version: string; extensionConnected: boolean; connections: number; tabs: number; currentTabId: TabId | null; screenshotDir: string; counts: { console: number; network: number; }; } export interface ScreenshotResult { path: string; tabId?: TabId | null; url?: string; /** Data URL, carrying whichever format the browser settled on. */ data: string; name: string; mimeType: string; bytes: number; /** False when the image is too large to hand to the model. */ withinBudget: boolean; } /** * The operations the MCP tools need. Implemented both in-process (the normal * single-process setup) and over HTTP (when attaching to a connector that is * already running for another client). */ export interface ConnectorClient { console(query: ScopedConsoleQuery): Promise>; network(query: ScopedNetworkQuery): Promise>; selectedElement(options?: { tabId?: TabId; }): Promise; page(): Promise; status(): Promise; tabs(): Promise; wipe(options?: { tabId?: TabId; }): Promise; screenshot(options: { name?: string; tabId?: TabId; }): Promise; refresh(options?: { tabId?: TabId; }): Promise; storage(kinds: string[], options?: { tabId?: TabId; }): Promise>; audit(category: AuditCategory, options?: { url?: string; tabId?: TabId; }): Promise; exportConsole(options?: { tabId?: TabId; allTabs?: boolean; }): Promise>; exportNetwork(options?: { tabId?: TabId; allTabs?: boolean; }): Promise>; readArtifact(kind: "screenshot" | "audit", name: string): Promise; } /** Talks straight to an embedded connector — no network hop, no discovery. */ export declare class InProcessConnectorClient implements ConnectorClient { #private; constructor(connector: Connector); console(query: ScopedConsoleQuery): Promise>; network(query: ScopedNetworkQuery): Promise>; selectedElement(options?: { tabId?: TabId; }): Promise; page(): Promise; status(): Promise; tabs(): Promise; wipe(options?: { tabId?: TabId; }): Promise; screenshot(options: { name?: string; tabId?: TabId; }): Promise; refresh(options?: { tabId?: TabId; }): Promise; storage(kinds: string[], options?: { tabId?: TabId; }): Promise>; audit(category: AuditCategory, options?: { url?: string; tabId?: TabId; }): Promise; exportConsole(options?: { tabId?: TabId; allTabs?: boolean; }): Promise>; exportNetwork(options?: { tabId?: TabId; allTabs?: boolean; }): Promise>; readArtifact(kind: "screenshot" | "audit", name: string): Promise; } export interface HttpConnectorClientOptions { baseUrl: string; token: string; fetchImpl?: typeof fetch; } /** Talks to a connector running in another process. */ export declare class HttpConnectorClient implements ConnectorClient { #private; constructor(options: HttpConnectorClientOptions); console(query: ScopedConsoleQuery): Promise>; network(query: ScopedNetworkQuery): Promise>; selectedElement(options?: { tabId?: TabId; }): Promise; tabs(): Promise; page(): Promise; status(): Promise; wipe(options?: { tabId?: TabId; }): Promise; screenshot(options: { name?: string; tabId?: TabId; }): Promise; refresh(options?: { tabId?: TabId; }): Promise; storage(kinds: string[], options?: { tabId?: TabId; }): Promise>; audit(category: AuditCategory, options?: { url?: string; tabId?: TabId; }): Promise; exportConsole(options?: { tabId?: TabId; allTabs?: boolean; }): Promise>; exportNetwork(options?: { tabId?: TabId; allTabs?: boolean; }): Promise>; readArtifact(kind: "screenshot" | "audit", name: string): Promise; }