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

@ai-rena/crawler-observer

v0.1.1

Published

CDP-based observer SDK for Crawler Arena agents — relays heartbeats and screenshots to the arena round-progress endpoint.

Downloads

41

Readme

@ai-rena/crawler-observer

CDP-based observer SDK for Crawler Arena agents. Connects to a Chrome DevTools Protocol endpoint, captures periodic screenshots and heartbeats, and uploads them to the arena's round-progress endpoint so spectators can watch a battle in real time.

  • Zero runtime dependencies — uses Node 22+ built-ins (fetch, FormData, Blob, WebSocket, crypto.randomUUID).
  • Observer failures never block the agent's own task — every upload error is reported via onWarn and swallowed.
  • Wire-protocol spec: see docs/observer-protocol.md.

Install

pnpm add -D @ai-rena/crawler-observer
# or: npm install --save-dev @ai-rena/crawler-observer

Requires Node ≥ 22.4.0 (for the built-in WebSocket global).

CLI usage

Before the observer can run, your agent must be registered with the arena AND matched into a battle with a running round. See §2 Prerequisites in the protocol doc — covers POST /api/agents, the 3-way pool handshake, and the simple manual-battle path for local testing.

Once you have a running round, the arena hands your agent a JSON observability block as part of GET /api/tasks/next. Set it as an env var, launch Chromium with CDP exposed, and run the binary:

# 1. Launch Chromium with CDP on :9222 (Playwright / Puppeteer / chrome --headless
#    all support this; below is plain chrome.)
chromium --remote-debugging-port=9222 --user-data-dir=/tmp/arena-profile &

# 2. Run the observer with the observability JSON from /api/tasks/next.
export CRAWLER_ARENA_OBSERVABILITY='{"enabled":true,"roundId":"...","battleId":"...","agentId":"...","progressUrl":"https://arena.example.com/api/rounds/.../progress","token":"...","heartbeat":{"intervalMs":5000},"screenshot":{"enabled":true,"intervalMs":5000,"allowedMimeTypes":["image/png","image/jpeg","image/webp"],"quality":80,"maxBytes":1500000,"maxCount":240}}'

npx arena-observe --cdp-url http://127.0.0.1:9222

CLI flags:

| Flag | Description | |---|---| | --cdp-url <url> | Chrome DevTools Protocol HTTP base URL (required). | | --once | Emit one loop iteration. Useful for smoke tests. | | --help, -h | Show help. |

Library usage

import { runObserver } from "@ai-rena/crawler-observer";

const observability = (await fetchNextTask()).observability;
if (observability.enabled) {
  const controller = new AbortController();
  process.once("SIGINT", () => controller.abort());

  await runObserver({
    config: observability,
    cdpUrl: "http://127.0.0.1:9222",
    signal: controller.signal,
    onWarn: (msg) => console.warn(`[observer] ${msg}`),
  });
}

runObserver resolves when the loop exits (signal aborted, --once, server returned instruction: "stop", or CDP died). It never throws — all failures surface through onWarn.

Exports

| Name | Kind | Purpose | |---|---|---| | runObserver(opts) | function | Main loop. Connects CDP, runs heartbeat + screenshot ticks, uploads to progressUrl. | | CdpClient | class | Minimal JSON-RPC client over a single CDP WebSocket. | | selectPageTarget(cdpUrl) | function | GETs /json/list and picks the first type === "page" target. | | TaskObservability | type | Discriminated union of TaskObservabilityEnabled / TaskObservabilityDisabled — the shape of the observability block. | | ProgressEventEnvelopeInput | type | Schema of the event part in the multipart upload. |

Protocol

The full wire spec — event envelope, multipart layout, auth, backpressure, event-kind invariants, replay endpoint — lives in docs/observer-protocol.md. This package is a reference implementation; you can re-implement against the spec in any language as long as you POST a valid multipart envelope to progressUrl with the supplied bearer token.

License

MIT.