function browserResponsive
browserResponsive(
browser:
Pick<PlaywrightBrowser, "isConnected">
& { newBrowserCDPSession?: PlaywrightBrowser["newBrowserCDPSession"]; },
browserName: string,
timeoutMs?: number
): Promise<boolean>

Actively confirms the browser's CDP channel is alive, unlike the passive isConnected() flag which lags a killed browser under load. Does a real newBrowserCDPSession round-trip bounded by timeoutMs — a dead or wedged channel resolves false within the budget rather than hanging. Chromium-only: firefox/webkit use a pipe transport whose 'disconnected' fires promptly on process exit, so isConnected() is already reliable there.

import type * as Server from './server.ts';

import type { Browser } from 'playwright-core';
// Defined, not invoked: bounded CDP round-trip against the daemon's persistent browser.
async function probeBeforeRun(probe: typeof Server.browserResponsive, browser: Browser) {
  return await probe(browser, 'chromium'); // false within 3s when the channel is dead
}

Parameters

browser:
Pick<PlaywrightBrowser, "isConnected">
& { newBrowserCDPSession?: PlaywrightBrowser["newBrowserCDPSession"]; }
browserName: string
optional
timeoutMs: number = BROWSER_PROBE_TIMEOUT_MS

Return Type

Promise<boolean>

Usage

import { browserResponsive } from "lib/commands/daemon/server.ts";