/** * Vibe MCP Server - chrome-use DevTools backend * * Drives the user's REAL running Chrome directly over the Chrome DevTools Protocol * (autoConnect via the DevToolsActivePort file), replacing the old `--devtools` * path that proxied the external, buggy chrome-devtools-mcp server. * * The CDP driver core under `./chrome-use/` is adapted from the `chrome-use` skill * (skills/chrome-use/scripts). This class exposes a fixed catalog of MCP tools and * dispatches each call to that core. It implements the same connection surface as * DevtoolsFallbackConnection so the MCP server (src/server.ts) can use it * interchangeably in `--devtools` mode. */ import { EventEmitter } from 'node:events'; import { type Channel } from './chrome-use/devtools-port.js'; import type { CdpClient } from './chrome-use/types.js'; import type { ToolDefinition, ToolResult } from './types.js'; /** How a CDP connection is established. Injectable so tests can supply a fake. */ export interface CdpConnector { connect(): Promise; } interface ChromeUseConnectionOptions { /** Override the CDP connector (tests inject a fake here). */ connector?: CdpConnector; channel?: Channel; userDataDir?: string; } export declare const CHROME_USE_TOOLS: ToolDefinition[]; export declare class ChromeUseConnection extends EventEmitter { private readonly debug; private readonly connector; private cdp; private session; private available; private unavailableReason?; constructor(debug: boolean, options?: ChromeUseConnectionOptions); start(): Promise; /** * Probe Browser.getVersion to detect a dead/absent Chrome, but cap the wait so a * pending approval dialog never blocks startup. Resolves on success; rethrows if * the probe fails fast (Chrome gone); resolves as "deferred" if still pending. */ private probeConnection; stop(): Promise; /** Tool catalog is static — refresh is a no-op that returns current tools. */ refreshTools(_timeoutMs?: number): Promise; /** * Wait for tools to be updated. * * ChromeUseConnection has a static tool catalog (discovered at connection time). * This method exists so `awaitStartupToolsWithinBudget()` can call it * uniformly on both connection backends. For a static backend it simply * returns the current tool list immediately — there is no dynamic update to wait for. */ waitForToolsUpdate(_timeoutMs: number): Promise; getTools(): ToolDefinition[]; hasTool(name: string): boolean; isAvailable(): boolean; getUnavailableReason(): string | undefined; callTool(name: string, args: Record, timeoutMs?: number): Promise; private dispatchTool; /** Poll readyState until 'complete'. Returns true if the page loaded within the * window, false if it timed out (so the caller can flag a still-loading page * rather than silently report success). */ private waitForLoad; private normalizeUrl; private navigate; private snapshot; private actOnElement; private fill; private type; private pressKey; private scroll; private screenshot; private evaluate; private getText; private getUrl; private getTitle; private listTabs; private newTab; private selectTab; private closeTab; private log; } export {}; //# sourceMappingURL=chrome-use-connection.d.ts.map