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

dsh-browser-control

v0.1.0

Published

DSH plugin for controlling browsers (CDP / Playwright)

Readme

dsh-browser-control

DeepSeek Harness 插件 · 操控浏览器 / DSH plugin for controlling browsers

通过 CDP(Chrome DevTools Protocol) 驱动浏览器:复用日常 Chrome 登录态、导航、抓 console / pageError / networkError、截图、执行任意 JS。

核心资产:

  • scripts/launch.sh — 登录态复用的 CDP 启动器(起 :9222 调试实例)
  • scripts/drive.mjs — CDP 驱动:导航 / 截图 / console / eval / mobile 仿真

Drives browsers over CDP (Chrome DevTools Protocol): reuse your everyday Chrome login state, navigate, capture console / pageError / networkError, screenshot, and eval JS.

快速开始 Quick start

./scripts/launch.sh   # 起 :9222 调试实例(复用日常 Chrome 登录态;已在跑则复用)

node scripts/drive.mjs "<url>" \
  --out /tmp/shot.png \
  [--mobile] [--wait 4000] [--eval "<expr>"]

输出 JSON:title / url(注意 SPA 跳转后的最终地址)/ bodyPreview / console / pageErrors / networkErrors / screenshot 路径。

为什么绕这一圈(登录态复用原理)

新版 Chrome 禁止在默认 user-data-dir 上开 --remote-debugging-portlaunch.sh 的做法:把日常 Chrome 的登录态文件(Cookies / Login Data / Local Storage / IndexedDB 等)只读拷贝到隔离目录 /tmp/chrome-e2e-profile,再用隔离目录起调试实例。单向不回写、懒同步(仅首次或 --refresh)、端口探测复用、精确 pkill——详见 docs/cdp-login-reuse.md

能力与避坑

  • canvas / 可视化库(G6 / echarts / D3 / WebGL)截图:后台 tab 的 raf 会被节流导致截图空白,修法是新建 tab + Page.bringToFront + 踢 raf,且别用 getImageData 判渲染——见 docs/cdp-canvas-pitfalls.md
  • --mobile:390x844 视口 + iPhone UA 仿真
  • --eval:在页面执行任意 JS(验证 DOM 状态 / 读 window 全局 / 调库 API)

DSH 工具 Tools

安装插件后,以下 browser_* 工具自动注册进 agent 的工具集:

| 工具 | 说明 | |---|---| | browser_status | 探测 CDP 实例是否在跑(默认 9222) | | browser_launch | 幂等启动 CDP 调试 Chrome(复用日常登录态;refresh 强制重同步) | | browser_kill | 关闭 CDP 调试实例 | | browser_open | 导航到 URL 并返回 title / 最终 URL / 文本预览 / console / pageError / networkError / 截图 | | browser_screenshot | 导航并截图,返回截图路径 | | browser_eval | 导航后在页面执行 JS 表达式并返回结果 |

# 安装后直接在 agent 会话里用自然语言触发:
#   "browser_launch 起 Chrome,然后 browser_open 打开 https://example.com 截图给我看"
dsh plugin --profile demo add dsh-browser-control

路线图 Roadmap

  • [x] 登录态复用启动器(scripts/launch.sh,含 --refresh / --kill / --status
  • [x] CDP 驱动(scripts/drive.mjs:导航 / 截图 / console / eval / mobile)
  • [x] 封装为 DSH 工具(6 个 browser_* tools)
  • [ ] 点击 / 填表 / 表单交互
  • [ ] Playwright 后端
  • [ ] 多标签 / 多窗口管理

安装 Install

# 发布到 npm 后
dsh plugin --profile demo add dsh-browser-control

# 或从 GitHub 安装(源码安装需要 prepare 构建)
dsh plugin --profile demo add github:PangYiMing/dsh-browser-control

许可证 License

MIT