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

pi-control-chrome

v0.3.9

Published

Codex-aligned Chrome and Edge browser control for Pi

Readme

pi-control-chrome

English · 简体中文

Codex-aligned Chrome and Edge browser control for Pi. It reuses the user's existing Chromium profile through a local WebSocket Bridge and a Manifest V3 extension.

The Stage 1/2 core implementation is complete. Later-stage capabilities remain tracked separately in FEATURES.md.

What it provides

  • Reuses the current Chrome or Edge profile, login state, cookies, extensions, and tabs.
  • Lets Pi inspect and claim explicitly selected existing tabs without moving them by default.
  • Places Agent-created tabs in a dedicated blue Pi tab group.
  • Tracks Agent ownership, sessions, handoff, and deliverable lifecycle states.
  • Closes unmarked Agent temporary tabs at turn end, releases claimed user tabs without closing them, and preserves only handoff or deliverable tabs marked for the current turn.
  • Provides DOM, accessibility, locator, coordinate, and native CDP controls.
  • Supports screenshots, page extraction, Console, Network, JavaScript dialogs, file upload, downloads, and clipboard text.
  • Captures ordinary active-tab viewport screenshots without opening a DevTools debugger session; full-page and background-tab captures use a short session-owned debugger lease.
  • Includes a reusable pi-control-chrome Skill. Browser tool schemas are hidden until that Skill is explicitly loaded for the current session; the bundled CLI remains available for explicit human/developer workflows and tests.

Architecture

Pi Extension
     ↕ WebSocket
127.0.0.1 Local Bridge
     ↕ WebSocket
Chrome / Edge Manifest V3 Extension
     ↕
Current Chromium Profile

The Bridge binds to loopback and requires a local pairing token. Host-launched instances expose a non-secret instance id, launcher label and capability list; any paired DSH or Pi Host in the same local-user control domain may request a cooperative restart when the Bridge exposes capabilities.localUserRestart: true and has no pending browser request. The instance id prevents stale restart races, and a restart lock serializes concurrent requests. Unknown legacy Bridges remain untouched when they do not expose the local-user capability. Installing the extension and completing local pairing are the trust steps; normal browser operations do not request repeated per-action authorization.

Installation

From npm (recommended)

pi install npm:pi-control-chrome

From GitHub

pi install git:github.com/lyd123qw2008/pi-control-chrome

From a local checkout

pi install <path-to>/pi-control-chrome

The package registers the Pi extension and the bundled Skill through its package.json pi manifest. It requires Node.js 22 or newer.

DSH integration

This repository also contains the standalone @lyd123qw2008/dsh-tool-control-chrome package. It registers the same browser-control surface as model-facing DeepSeek Harness tools and routes calls through the local Bridge. Install the DSH package in the active DSH Profile, merge the insert entry from its config/cordis.patch.yml.example into the existing cordis.patch.yml, and keep Bridge settings in <DSH_HOME>/settings.yaml.

The DSH package reuses this project's Bridge and Manifest V3 extension. Its default lazyTools: true mode exposes only the pi-control-chrome Skill metadata initially; after a successful Skill load, all 39 browser_* tools are registered in that Agent and remain active across turns in the current Agent session. At turn end, the host closes unmarked Agent temporary tabs, releases claimed user tabs without closing them, and detaches the session debugger lease. Bridge, browser tools, and Browser binding remain available for later turns. A model must call browser_mark_handoff or browser_mark_deliverable to preserve an Agent tab through the current turn cleanup, and repeat the mark in a later turn when needed. Only an explicit user request to close temporary tabs, release claims, or clean the browser task may trigger browser_cleanup; it performs immediate task cleanup while retaining the lazy tools and healthy Bridge. browser_context_reset is the separate explicit user-requested operation that finalizes resources and deactivates lazy tools. Agent and plugin disposal retry final cleanup; failed recovery blocks a replacement Agent that reuses the same session ID until cleanup succeeds. Set lazyTools: false for eager visibility. Pi registers the same native tools once but hides them with its active-tool set until the explicit /skill:pi-control-chrome expansion or another successful Skill activation. Ordinary web search does not activate browser control. The DSH package also provides human-only /chrome status, /chrome targets, /chrome profile [browserId], /chrome connect, /chrome disconnect, /chrome doctor, /chrome restart, and /chrome tabs commands. It does not install browser extensions automatically, read Chrome Profile files, or expose the Bridge beyond loopback.

Load the browser extension

Pi cannot install an unpacked browser extension automatically. Load the shared extension/ directory once in Chrome or Edge:

  1. Open chrome://extensions or edge://extensions.
  2. Enable Developer mode.
  3. Select Load unpacked.
  4. Choose the repository or installed package's extension/ directory.
  5. Start or reload Pi.

Check the connection in Pi:

/chrome status
/chrome targets
/chrome profile <browserId>
/chrome tabs

The extension is shared by Chrome and Edge and uses Chromium Manifest V3 capability detection rather than separate browser-specific implementations. One Bridge can now keep multiple identified browser targets connected at once. Each target is keyed by its stable browserId; requests use target-qualified routing and connection-generation fencing, so a newer connection for Profile A cannot replace Profile B or satisfy Profile A's stale requests. When multiple targets are available, select one explicitly with /chrome profile <browserId> or browser_status/the Skill CLI --browser-id; the runtime never guesses from the newest connection or active window.

Skill CLI

The bundled scripts are for explicit human/developer workflows and automated tests. They connect to the Bridge directly and must not be invoked by a model shell as a substitute for the Skill-gated native tools:

node skills/pi-control-chrome/scripts/browser.mjs status --browser-id <browserId>
node skills/pi-control-chrome/scripts/browser.mjs tabs --browser-id <browserId> --json
node skills/pi-control-chrome/scripts/browser.mjs group --browser-id <browserId> --json
node skills/pi-control-chrome/scripts/browser.mjs view https://example.com --browser-id <browserId> --session example-session --turn 1 --screenshot "$env:TEMP\example.png"
node skills/pi-control-chrome/scripts/browser.mjs cleanup --browser-id <browserId> --session <session-id>

Managed CLI commands use explicit lifecycle identity: open and cleanup require --session <id>, and view requires both --session <id> and --turn <n> unless it is explicitly temporary. The CLI does not derive ownership from a process id, so a later invocation can address the same tabs safely.

The bundled scripts support these environment variables. The Pi extension also accepts PI_CONTROL_CHROME_BRIDGE_PORT when the local Bridge uses another loopback port:

PI_CONTROL_CHROME_BRIDGE_HOST
PI_CONTROL_CHROME_BRIDGE_PORT

The Pi extension keeps the default port at 17318; set PI_CONTROL_CHROME_BRIDGE_PORT only when the local Bridge uses another loopback port.

Use the native browser_* Pi or DSH tools for model browser work. They preserve the current Agent session, target identity, and tab ownership protections.

Development and tests

cd <path-to>/pi-control-chrome
npm install
npm run check
npm test
npm run test:pi:lifecycle
npm run test:skill
npm run pack:check

npm run test:skill requires a connected Chrome or Edge profile and the local Bridge. The high-coverage browser smoke test is:

npm run smoke:e2e

The multi-target acceptance test launches two isolated temporary Edge/Chrome profiles and verifies explicit routing, target disconnect isolation, and same-Profile reconnection fencing:

npm run smoke:e2e:multi-profile

The smoke test defaults to Edge. Run the same coverage against Chrome for Testing with:

$env:PI_CONTROL_CHROME_BROWSER = "<path-to>\chrome-for-testing\chrome.exe"
npm run smoke:e2e

This uses an isolated temporary browser profile and does not touch the normal user profile. The installed Google Chrome may reject command-line unpacked-extension flags; load extension/ manually from chrome://extensions for a normal-profile check.

Design principles

  1. Install once, operate with low friction. Extension installation and local pairing are the user-facing trust steps.
  2. The extension is the browser capability boundary. Pi communicates with it only through the local Bridge.
  3. User tabs are preserved by default. Claiming a tab establishes control ownership; it does not move the tab into the Agent group.
  4. Agent tabs are reclaimable. Agent-created tabs carry ownership and session metadata and are cleaned up according to lifecycle policy.
  5. Chrome and Edge share one implementation. The extension uses Manifest V3 and capability detection.
  6. Observable behavior is aligned without copying private Codex runtime code. Pi uses its own Bridge protocol and Extension API.

Documentation

Current future scope

The following items are planned for later stages and do not block the current browser-control loop:

  • WebMCP, GSuite export, and browsing history APIs.
  • Dedicated media-download interfaces.
  • Capability discovery beyond the current Bridge target and extension capability handshake.
  • Chrome Web Store and Edge Add-ons release packages.
  • Dedicated Brave and Chromium acceptance coverage.
  • Cross-Bridge orchestration and simultaneous multi-target control within one session.

License

MIT. See LICENSE.