npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@jiweiyuan/runbrowser-server

v0.0.6

Published

RunBrowser server — bridges Chrome extension WebSocket to CDP clients

Downloads

299

Readme

@jiweiyuan/runbrowser-server

CDP (Chrome DevTools Protocol) relay server for RunBrowser. This package bridges Chrome extension WebSocket connections to Playwright CDP clients, enabling browser automation over your running Chrome browser.

Architecture

┌──────────────┐     WebSocket      ┌─────────────────┐     WebSocket      ┌────────────────┐
│   Chrome     │ ◄─────────────────►│  Relay Server   │ ◄─────────────────►│   Playwright   │
│  Extension   │    /extension      │  (this package)  │    /cdp/:clientId  │  CDP Client    │
└──────────────┘                    └─────────────────┘                    └────────────────┘
                                          │
                                          │  HTTP API
                                          │  /version, /json, /extension/status
                                          │  /cli/*, /recording/*
                                          ▼

The relay server:

  • Accepts WebSocket connections from the RunBrowser Chrome extension
  • Accepts WebSocket connections from Playwright CDP clients
  • Routes CDP commands/events between them
  • Manages extension connections, target tracking, and session state
  • Provides HTTP endpoints for discovery, status, CLI execution, and recording

Installation

npm install @jiweiyuan/runbrowser-server

Usage

Programmatic

import { startRunBrowserCDPRelayServer } from '@jiweiyuan/runbrowser-server'

const server = await startRunBrowserCDPRelayServer({
  port: 19988,
  host: '127.0.0.1',
  logger: console,
})

// Later...
server.close()

With CLI Execute Endpoints

To enable /cli/* endpoints, provide an executor manager factory:

import { startRunBrowserCDPRelayServer } from '@jiweiyuan/runbrowser-server'

const server = await startRunBrowserCDPRelayServer({
  port: 19988,
  executorManagerFactory: async ({ cdpConfig, logger }) => {
    const { ExecutorManager } = await import('runbrowser/executor')
    return new ExecutorManager({ cdpConfig, logger })
  },
})

Standalone Binary

npx @jiweiyuan/runbrowser-server

Client Utilities

The package also provides client-side utilities for connecting to the relay server:

import { ensureRelayServer, RELAY_PORT, waitForConnectedExtensions } from '@jiweiyuan/runbrowser-server/client'

// Start relay server if not running
await ensureRelayServer({ logger: console })

// Wait for Chrome extension to connect
const extensions = await waitForConnectedExtensions({
  timeoutMs: 10000,
  logger: console,
})

Exports

| Subpath | Description | |---------|-------------| | @jiweiyuan/runbrowser-server | Core server, state management, types, utilities | | @jiweiyuan/runbrowser-server/client | Client utilities (ensureRelayServer, version checks) | | @jiweiyuan/runbrowser-server/types | CDP protocol types | | @jiweiyuan/runbrowser-server/protocol | Extension message protocol types | | @jiweiyuan/runbrowser-server/utils | Shared utilities (EXTENSION_IDS, VERSION, log paths) | | @jiweiyuan/runbrowser-server/logger | File logger |

Key Types

// Server configuration
interface RelayServer {
  close(): void
  on<K extends keyof RelayServerEvents>(event: K, listener: RelayServerEvents[K]): void
  off<K extends keyof RelayServerEvents>(event: K, listener: RelayServerEvents[K]): void
}

// Executor dependency injection (for CLI endpoints)
interface ExecutorManagerLike { ... }
interface ExecutorLike { ... }
type ExecutorManagerFactory = (config: { cdpConfig, logger }) => Promise<ExecutorManagerLike>

// Relay state
interface ExtensionEntry { id, info, stableKey, connectedTargets, ws, ... }
interface PlaywrightClient { id, extensionId, ws }
interface RelayState { extensions, playwrightClients }

Environment Variables

| Variable | Description | |----------|-------------| | RUNBROWSER_PORT | Relay server port (default: 19988) | | RUNBROWSER_AUTO_ENABLE | Auto-create initial tab for Playwright | | RUNBROWSER_LOG_FILE_PATH | Custom relay server log path | | RUNBROWSER_CDP_LOG_FILE_PATH | Custom CDP log path |

License

MIT