UNPKG

framework

Version:

The (AI) Framework: turnkey, zero-config AI orchestration that wraps a coding-agent CLI (Claude Code) as a black box and takes you from an idea to a running app. Vite for AI.

73 lines 3.98 kB
import type { ClaudeCodeDriverOptions, McpServerSpec } from './driver/index.js'; /** * The agent's browser (#793, first slice of #609). * * `--browser` (#452) used to let chrome-devtools-mcp launch its own Chrome. That is fine * while the agent is the only client, but #609 wants a human watching the same page over a * screencast, and a second client cannot attach to a browser whose port we never opened. So * the agent launches Chrome itself with `--remote-debugging-port` and hands the MCP server a * `--browserUrl`. Chrome takes both CDP clients at once, which is what makes the preview and * the step-in relay possible at all. */ export interface SharedBrowser { /** The CDP endpoint both the agent and any preview attach to. */ browserUrl: string; /** Kill Chrome and remove its throwaway profile. Safe to call twice. */ close(): Promise<void>; } /** Whether a path exists. Injectable so a test does not depend on what the host has installed. */ export type ExistsFn = (path: string) => boolean; /** * The Chrome binary to launch, or undefined when the machine has none. `CHROME_PATH` (and * Puppeteer's variable, since a repo that has one usually means it) wins so a user on a * non-standard install is not stuck. * * `exists` is a parameter rather than a direct `existsSync` call so the lookup can be tested * against a known filesystem: CI runners have Chrome installed, so a test that assumes the * well-known paths are absent passes on a laptop and fails there. */ export declare function resolveChromePath(env?: NodeJS.ProcessEnv, platform?: string, exists?: ExistsFn): string | undefined; /** * The launch flags. Headless by default — the agent has no screen, and a screencast reads a * headless page fine. The profile is throwaway so an agent never inherits (or dirties) the * user's real Chrome session. */ export declare function chromeLaunchArgs(port: number, userDataDir: string, headless?: boolean): string[]; /** A free localhost port, asked of the OS rather than guessed. */ export declare function freePort(): Promise<number>; /** * Poll `/json/version` until Chrome answers. Chrome opens the port a beat after the process * starts, so handing the MCP server a URL that is not listening yet is the obvious race. */ export declare function waitForDebugEndpoint(browserUrl: string, opts?: { timeoutMs?: number; intervalMs?: number; fetchImpl?: typeof fetch; }): Promise<boolean>; /** * Launch the agent's Chrome, or return undefined when this machine has none — in which case the * caller leaves `--browser` exactly as it was (chrome-devtools-mcp launches its own). A * missing browser should cost the agent its preview, never its browser tools. */ export declare function launchSharedBrowser(opts?: { chromePath?: string | undefined; headless?: boolean; timeoutMs?: number; }): Promise<SharedBrowser | undefined>; /** * The `--browser` MCP wiring (#452): chrome-devtools-mcp is a maintained stdio * server that launches its own Chromium and exposes DevTools tools (navigate, * console, network, DOM, screenshot). `npx -y` resolves it on demand so there is * nothing to pre-install. Merged into the build driver only, not the short * preset-router turn. */ export declare const BROWSER_MCP_SERVERS: Record<string, McpServerSpec>; /** * The same server, pointed at a Chrome the agent already launched (#793). `--browserUrl` makes * it attach instead of launching, which is what lets a second client (the screencast (#609)) * watch the very page the agent is on. Without a URL this is the old spec unchanged. */ export declare function browserMcpServers(browserUrl?: string | undefined): Record<string, McpServerSpec>; /** Fold the `--browser` MCP server into driver options when the flag is set. */ export declare function withBrowser(base: ClaudeCodeDriverOptions, browser: boolean, browserUrl?: string | undefined): ClaudeCodeDriverOptions; //# sourceMappingURL=browser.d.ts.map