import { RpcTarget, type RpcStub } from 'capnweb'; import { type WebSocket as WsWebSocket } from 'ws'; import type { ServerRegistry } from './registry.js'; interface BrowserStub { id: string; getPageInfo(): Promise<{ id: string; title: string; url: string; type: string; }>; screenshot(selector?: string): Promise<{ data: string; width: number; height: number; } | { error: string; }>; click(selector: string): Promise<{ clicked: string; tag: string; } | { error: string; }>; fill(selector: string, value: string): Promise<{ filled: string; value: string; } | { error: string; }>; selectOption(selector: string, value: string): Promise<{ selected: string; value: string; text: string; } | { error: string; }>; hover(selector: string): Promise<{ hovered: string; } | { error: string; }>; pressKey(key: string, modifiers?: { ctrl?: boolean; shift?: boolean; alt?: boolean; meta?: boolean; }, selector?: string): Promise<{ key: string; target: string; } | { error: string; }>; scroll(selector?: string, x?: number, y?: number): Promise<{ scrolledTo: string | { x: number; y: number; }; } | { error: string; }>; getVisibleText(selector?: string): Promise<{ text: string; length: number; } | { error: string; }>; eval(expression: string): Promise; queryDom(selector: string, options: { max_depth?: number; attributes?: string[]; text_length?: number; }): Promise<{ html: string; element_count: number; truncated: boolean; }>; } type BrowserEventCallback = (event: 'connect' | 'disconnect', data: { connId: string; browserId: string | null; serverId: string | null; }) => void; export declare function onBrowserEvent(cb: BrowserEventCallback): () => boolean; type LogEventCallback = (data: { channel: string; payload: any; browserId?: string; }) => void; export declare function onLogEvent(cb: LogEventCallback): () => boolean; export declare function emitLogEvent(data: { channel: string; payload: any; browserId?: string; }): void; /** Get the latest browser stub, optionally filtered by serverId */ export declare function getBrowserStub(serverId?: string): RpcStub | undefined; /** Disconnect and remove all browsers associated with a given serverId */ export declare function removeBrowsersByServer(serverId: string): number; export declare function getAllBrowsers(): Array<{ connId: string; browserId: string | null; serverId: string | null; connectedAt: number; }>; export declare function setupRpcWebSocket(httpServer: { on(event: string, listener: (...args: any[]) => void): void; }, rpcPath: string): import("ws").Server; export declare class ProjectBrowserApi extends RpcTarget { private serverId?; constructor(serverId?: string); get document(): any; get window(): any; get localStorage(): any; get sessionStorage(): any; navigate(url: string): any; getPageMarkdown(selector?: string): any; getVisibleText(selector?: string): any; screenshot(selectorOrOpts?: string | Record): any; click(selector: string): any; fill(selector: string, value: string): any; eval(expression: string): Promise; } export declare class GatewayApi extends RpcTarget { private registry?; constructor(registry?: ServerRegistry); getBrowserCount(): number; getBrowserList(): { connId: string; browserId: string | null; serverId: string | null; connectedAt: number; }[]; listProjects(): string[]; /** Get a project-scoped browser handle */ getProject(serverId?: string): ProjectBrowserApi; /** Read historical logs for a project from NDJSON files */ getProjectLogs(serverId: string, options?: { limit?: number; sinceId?: number; channels?: string[]; }): { entries: { channel: string; id: number; ts: number; payload: any; browserId?: string; }[]; }; subscribeEvents(browserId?: string): ReadableStream; } export declare function setupAgentRpcWebSocket(httpServer: { on(event: string, listener: (...args: any[]) => void): void; }, agentPath: string, registry?: ServerRegistry): import("ws").Server; export {}; //# sourceMappingURL=rpc-server.d.ts.map