import type { CdpPage, ElementInfo, PageInfo, PageText, PageLink } from './cdp'; /** Persistent Chrome profile for TeamShare-driven browsing (research reads). */ export declare const DEFAULT_BROWSER_PROFILE_DIR: string; export interface BrowserSessionOptions { /** CDP port (default 9222). Ignored when autoLaunch is true. */ port?: number; /** Automatically launch Chrome if not reachable (default false). */ autoLaunch?: boolean; /** Run headless when auto-launching (default false: real profile). */ headless?: boolean; /** Persistent user-data-dir when auto-launching (default TeamShare profile). */ profileDir?: string; /** Extra Chrome args for auto-launch. */ chromeArgs?: string[]; } export declare class BrowserSession { private readonly id; private page; private chrome; private _port; private _autoLaunch; private _headless; private _profileDir; private _chromeArgs; private _connected; constructor(id: string, opts?: BrowserSessionOptions); /** Whether the session has an active CDP connection. */ get connected(): boolean; /** The CDP port this session targets. */ get port(): number; /** The underlying page handle (for advanced use). */ get cdpPage(): CdpPage | null; /** * Connect to Chrome. If autoLaunch and Chrome is not reachable, * launches a headless instance automatically. */ connect(port?: number): Promise; /** * Connect to a specific tab by targetId. */ connectToTab(targetId: string): Promise; /** * Navigate to a URL. Returns page info after navigation. */ navigate(url: string): Promise; /** * Capture a screenshot. Returns base64-encoded data. */ screenshot(format?: 'jpeg' | 'png', quality?: number): Promise; /** * Click at (x, y) coordinates. */ click(x: number, y: number): Promise; /** * Type text at the current cursor position. Refuses to type into a password * field: research tooling must never attempt logins / credential entry. */ type(text: string): Promise; /** * Press a keyboard key (Enter, Tab, Escape, etc.). */ press(key: string): Promise; /** * Scroll the page by delta (positive = down). */ scroll(delta: number): Promise; /** * Read the current page's text (prefers article/main). Text-only: cheap * token-wise, works on JS-heavy/blocked pages where web_fetch fails. */ getText(maxChars?: number): Promise; /** Extract links (href + text) - used to find downloadable document URLs. */ getLinks(): Promise; /** Read title + url + text + links in one round trip (research default). */ readPage(maxChars?: number): Promise; /** * Evaluate JavaScript in the page context. */ evaluate(expression: string): Promise; /** * Get the list of interactive DOM elements. */ getElements(): Promise; /** * Get current page info. */ pageInfo(): Promise; /** * Detect the active code editor on the page. */ detectEditor(): Promise<{ type: string; selector: string; } | null>; /** * Focus an element by CSS selector. */ focus(selector: string): Promise; /** * Disconnect from Chrome. Releases the CDP connection only. * * The debug browser window is NEVER closed here: `chrome.kill()` is a no-op * for the persistent-profile debug browser (`surviveStop`, the default), so * `browser_close`, session end and daemon shutdown all leave it open for the * human. Only an explicitly disposable instance (`surviveStop: false`) is * terminated. Close the window yourself, or run `teamshare-agent browser * stop`. */ disconnect(): void; private ensureConnected; }