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

@hanzili/chrome-browser-agent

v0.1.0

Published

Browser automation toolkit for Chrome extensions using CDP (Chrome DevTools Protocol). Powers AI agents that interact with web pages.

Readme

Chrome Browser Agent

Browser automation toolkit for Chrome extensions using CDP (Chrome DevTools Protocol). Powers AI agents that interact with web pages.

Features

  • CDP Integration: Full Chrome DevTools Protocol support for reliable browser automation
  • Accessibility Tree: Semantic page representation for AI navigation (not CSS selectors)
  • Reference-based Targeting: Elements are tracked by refs (ref_1, ref_2) that survive page changes
  • Tool Definitions: Ready-to-use tool schemas for LLM tool calling (Claude, GPT, etc.)
  • Screenshot Support: High-quality screenshots with DPR scaling

Installation

npm install @hanzili/chrome-browser-agent

Setup

1. Add to your manifest.json

{
  "permissions": ["debugger", "scripting", "tabs", "activeTab"],
  "host_permissions": ["<all_urls>"],
  "content_scripts": [
    {
      "matches": ["<all_urls>"],
      "js": [
        "node_modules/@hanzili/chrome-browser-agent/src/content/accessibility-tree.js",
        "node_modules/@hanzili/chrome-browser-agent/src/content/content.js"
      ]
    }
  ]
}

2. Use in your service worker

import {
  cdpHelper,
  executeTool,
  TOOL_DEFINITIONS
} from '@hanzili/chrome-browser-agent';

// Pass TOOL_DEFINITIONS to your LLM
const response = await callLLM(messages, { tools: TOOL_DEFINITIONS });

// Execute tools returned by LLM
for (const toolUse of response.tool_calls) {
  const result = await executeTool(toolUse.name, toolUse.input, {
    tabId: currentTabId,
    sendToContent: (tabId, type, payload) => chrome.tabs.sendMessage(tabId, { type, payload })
  });
}

Core Concepts

Accessibility Tree

Instead of fragile CSS selectors, this toolkit uses an accessibility tree representation:

button "Submit Application" [ref_1]
textbox "Email" [ref_2] placeholder="Enter email"
combobox "Country" [ref_3]
  option "United States" value="us"
  option "Canada" value="ca" (selected)

The LLM sees semantic roles and can reference elements by ref_1, ref_2, etc.

Available Tools

| Tool | Description | |------|-------------| | read_page | Get accessibility tree of current page | | computer | Click, type, scroll, screenshot | | form_input | Fill form fields by reference | | navigate | Go to URL, back, forward | | find | Natural language element search | | file_upload | Upload files to inputs |

API Reference

cdpHelper

// Attach debugger to tab
await cdpHelper.attachDebugger(tabId);

// Take screenshot
const base64 = await cdpHelper.takeScreenshot(tabId);

// Click at coordinates
await cdpHelper.click(tabId, x, y);

// Type text
await cdpHelper.type(tabId, "Hello world");

executeTool

const result = await executeTool('click', { ref: 'ref_1' }, {
  tabId,
  sendToContent,
  cdpHelper
});

Content Scripts

The content scripts must be injected into pages. They provide:

  • accessibility-tree.js: Generates the semantic tree, manages element refs
  • content.js: Handles messages from service worker (form fill, click, etc.)
  • agent-visual-indicator.js: Shows visual feedback during automation

License

MIT