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

@hera-al/browser-server

v1.0.5

Published

Hera Browser Server — local browser automation via Playwright and CDP

Readme

@hera-al/browser-server

Part of Hera Artificial Life — an opinionated AI assistant platform that runs locally on your machine. This package provides the browser automation layer used by Hera agents to interact with the web. It can also be used independently in any Node.js project.

Local browser automation server powered by Playwright and the Chrome DevTools Protocol (CDP).

Exposes a lightweight HTTP API on 127.0.0.1 that lets AI agents — or any local process — launch, control, and inspect browser sessions without embedding a full browser SDK.

Features

  • Launch or attach to a local Chrome/Chromium instance via CDP
  • Multi-profile support (separate CDP ports, colors, isolated sessions)
  • Tab management — open, list, focus, close tabs
  • Page actions — click, type, hover, scroll, drag, select, fill forms, press keys, navigate
  • Snapshots — role-based (Playwright), ARIA, DOM, text/HTML extraction, CSS query, AI-digest
  • Screenshots & PDF — full-page or element-level capture
  • Storage — read/write cookies, localStorage, sessionStorage
  • JavaScript evaluation — run arbitrary JS in page context
  • Wait conditions — wait for text, selector, URL, load state, or custom function
  • Standalone or embedded — run as a standalone process or import into your own Node.js app

Install

npm install @hera-al/browser-server

Peer dependency: Requires playwright-core ≥ 1.50 and a Chromium-based browser available on the system.

Quick start

Standalone (CLI)

npx hera-browser --port 3002 --headless false

All CLI flags:

| Flag | Default | Description | | ------------------ | ------- | ---------------------------------------- | | --port | 3002 | HTTP control port | | --headless | false | Run Chrome headless | | --noSandbox | false | Disable Chrome sandbox (CI/Docker) | | --attachOnly | false | Never launch Chrome, only attach via CDP | | --executablePath | — | Custom Chrome/Chromium binary path |

Programmatic

import { startBrowserServer, stopBrowserServer } from "@hera-al/browser-server";
import { resolveBrowserConfig, BrowserConfigSchema } from "@hera-al/browser-server/config";

const config = resolveBrowserConfig(
  BrowserConfigSchema.parse({
    enabled: true,
    controlPort: 3002,
    headless: false,
  })
);

await startBrowserServer(config);

// ... your app logic ...

await stopBrowserServer();

HTTP API Reference

All endpoints listen on http://127.0.0.1:{port}. Responses are JSON with an ok boolean.

Status & lifecycle

| Method | Path | Description | | ------ | -------- | --------------------------------- | | GET | / | Check browser status (running / stopped) | | POST | /start | Launch or attach to the browser | | POST | /stop | Stop the browser |

Tabs

| Method | Path | Description | | ------ | ------------- | ------------- | | GET | /tabs | List all open tabs | | POST | /tabs/open | Open a new tab ({ url }) | | POST | /tabs/focus | Focus a tab ({ id }) | | DELETE | /tabs/:id | Close a tab |

Actions (POST /act)

Send { kind, ...params } to perform a page action:

| Kind | Key params | | ------------ | ------------------------------------------------------------- | | navigate | url, timeoutMs? | | click | ref, doubleClick?, button?, modifiers? | | type | ref, text, submit?, slowly? | | press | key, delayMs? | | hover | ref | | scroll | ref | | drag | startRef, endRef | | select | ref, values | | fill_form | fields: [{ ref, type, value }] | | screenshot | ref?, element?, fullPage?, type? (png | jpeg) | | evaluate | fn (JS string), ref? | | wait | timeMs?, text?, textGone?, selector?, url?, loadState?, fn? |

All actions accept optional profile, targetId, and timeoutMs.

Snapshots (GET /snapshot)

Query params:

| Param | Values | Description | | --------------- | ------------------------------------------- | ---------------------------------- | | mode | role (default), aria, dom, text, html, ai, query | Snapshot format | | selector | CSS selector string | Scope to element (for text, html, query) | | frameSelector | CSS selector string | Target iframe | | interactive | true / false | Include interactive elements only | | compact | true / false | Compact output |

Screenshots & PDF

| Method | Path | Description | | ------ | ------------- | -------------------------------------- | | POST | /screenshot | Capture screenshot ({ fullPage?, type?, ref?, element? }) | | POST | /pdf | Export page as PDF |

Storage

| Method | Path | Description | | ------ | ----------------- | ----------------------------- | | GET | /cookies | Get all cookies | | POST | /cookies | Set a cookie ({ cookie }) | | DELETE | /cookies | Clear all cookies | | GET | /storage/:kind | Get localStorage or sessionStorage (kind = local | session) | | POST | /storage/:kind | Set a key ({ key, value }) | | DELETE | /storage/:kind | Clear storage |

Configuration

When using the programmatic API, the full config schema is:

{
  enabled: boolean;           // default: false
  controlPort: number;        // default: 3002
  headless: boolean;          // default: false
  noSandbox: boolean;         // default: false
  attachOnly: boolean;        // default: false
  executablePath?: string;    // custom Chrome path
  remoteCdpTimeoutMs: number; // default: 1500
  profiles: {
    [name: string]: {
      cdpPort?: number;       // default: 9222
      cdpUrl?: string;        // overrides cdpPort
      color?: string;         // hex color, default: "#FF4500"
    }
  }
}

Profiles

Profiles allow managing multiple isolated browser sessions on different CDP ports. The default profile is always available.

const config = resolveBrowserConfig(
  BrowserConfigSchema.parse({
    enabled: true,
    profiles: {
      default: { cdpPort: 9222 },
      social: { cdpPort: 9223, color: "#1DA1F2" },
    },
  })
);

Pass ?profile=social (GET) or { "profile": "social" } (POST) to target a specific profile.

Architecture

┌─────────────────────────────────────────┐
│          HTTP API (Hono)                │
│  basic · tabs · act · snapshot · storage│
└────────────────┬────────────────────────┘
                 │
         ┌───────┴───────┐
         │ BrowserContext │  ← multi-profile manager
         └───────┬───────┘
                 │
    ┌────────────┼────────────┐
    │            │            │
 Chrome      Playwright    CDP
 launcher    session mgr   helpers
  • Hono — lightweight HTTP framework (< 15 KB)
  • Playwright — used for page interactions, snapshots, screenshots (connects to existing Chrome via CDP)
  • CDP direct — used for ARIA/DOM snapshots, tab management, WebSocket resolution

Requirements

  • Node.js ≥ 18
  • Chrome or Chromium installed locally (or provide executablePath)
  • macOS, Linux, or WSL

License

MIT — © 2026 TGP / Hera Artificial Life