DeepSHPlugins
dsh-cdp-browser 项目预览
GITHUB / COMMUNITY PROJECT

dsh-cdp-browser

工具与集成JavaScriptMIT

通过 CDP 连接已运行的 Chrome/Edge:为 DSH 提供截图、像素断言、DOM/CSS 检查与页面 JS 执行,全程 HTTP + WebSocket、零子进程、零 npm 依赖、无需逐次授权。

2 StarszaiwenJ 更新时间 2026-08-16
访问 GitHub 仓库
dsh-cdp-browser 项目预览

项目介绍

中文

通过 CDP 连接已运行的 Chrome/Edge:为 DSH 提供截图、像素断言、DOM/CSS 检查与页面 JS 执行,全程 HTTP + WebSocket、零子进程、零 npm 依赖、无需逐次授权。

English

CDP bridge to an already-running Chrome/Edge for DSH: screenshots, pixel assertions, DOM/CSS checks, and page JS evaluation over HTTP + WebSocket, with zero child processes, zero npm dependencies, and zero per-use approval.

项目信息与收录信号

快照 2026-09-11
作者 / 组织
zaiwenJ
仓库
zaiwenJ/dsh-cdp-browser
GitHub Stars
2
Forks
0
开发语言
JavaScript
许可证
MIT
最近推送
2026-08-16
Manifest
数据中检测到声明

公开仓库不自动等于可商用;许可证与当前兼容性以原项目文档为准。Manifest 和数据评分不构成安装安全认证。

数据评分

48/ 100
维护活跃
82
文档与实用信息
50
生态关注度
14
安装便捷信号
75
项目声明信号
100

关注度尚低(2)。

评分来自已有数据快照的五维模型,仅作浏览参考,不是实际使用评测或安全检测结论。

安装与使用

所有项目资料与许可均以对应 GitHub 仓库为准。

dsh plugin --profile web add github:zaiwenJ/dsh-cdp-browser

复制命令不会自动执行。请先阅读仓库文档,确认环境要求与许可证。

项目截图

仓库 README

GitHub 原文

已保存的仓库文档快照;文档抓取时间未记录,可能与上方目录介绍处于不同版本。安装前请核对当前仓库说明。

dsh-cdp-browser

Zero-spawn browser automation + pixel-level visual verification as a DeepSeek Harness plugin. Drives an already-running Chrome/Edge over CDP using Node built-ins only: global fetch + global WebSocket (Node ≥ 22) + zlib PNG decode. No child_process, no npm dependencies, no per-use approval.

Why zero-spawn

Plugins that spawn an engine and pipe its stdio (e.g. modlens) collide with the harness sandbox's pipe ban (EPERM/EINVAL) on every call. Connecting to a browser the user started themselves is plain network I/O — allowed in confined mode. The one manual step (launching the browser) happens outside the harness, so the model never needs approval again for visual checks.

Setup (once)

  1. Install into the profile (done via dsh plugin --profile web add file:<path>).
  2. Start your browser with CDP (the provided edge-debug.cmd does this):
   msedge.exe --remote-debugging-port=9222 --remote-allow-origins=* --user-data-dir=<dir> <url>
  1. Restart the Web GUI. The cdp_* tools appear in the next session.

Tools

ToolWhat it does
cdp_statusList tabs/targets of the CDP browser + browser version
cdp_openOpen (or reuse) a tab for a url; returns target id
cdp_evalEvaluate JS in a page (awaitPromise, returnByValue)
cdp_shotNavigate + PNG screenshot, saved to an absolute path
cdp_assertScripted interaction + deterministic checks (pixel / css / dom / js) with a pass/fail report

cdp_assert check shapes

checks: [
  { type: 'pixel', x: 0.5, y: 0.96, color: '#245edb', tolerance: 16 },  // relative coords 0..1 or absolute px
  { type: 'css', selector: '#taskbar', property: 'background-color', equals: 'rgb(36, 94, 219)' },
  { type: 'css', selector: '.xp-window', property: 'border-radius', matches: '^\\d+px' },
  { type: 'dom', selector: '.xp-desk-icon', text: 'My Computer' },
  { type: 'js', expression: 'window.__XP.selfTest()', equals: { ok: true } },
]
// every check accepts click: '#start-btn' | { selector } | { x, y } and waitMs

Development

node plugins/dsh-cdp-browser/test/e2e.mjs   # needs dev server + CDP Edge, starts nothing

Determinism notes (learned from the XP app's first plugin e2e):

  • Reload the page per test run. A long-lived tab accumulates state across

scripted sweeps (windows, dialogs, menus) and can wedge openApp; a fresh navigate + skipBoot per suite is deterministic. probe-apps.mjs bisects per-app hangs when an app regresses.

  • Synthetic clicks toggle state. el.click() runs the real handlers —

clicking a toggle twice flips it twice. One click per assertion.

  • Gradient surfaces need stop-aware sampling. Sample where a gradient stop

dominates (flat zones or edges), not mid-gradient blends, or use tolerance-aware nearColor against computed-style values.

The package exposes ./cdp (targets, openTarget, withPage, Cdp, decodePng, samplePixel, nearColor, runChecks, savePng) for reuse outside the harness.

使用前核对

安装步骤、兼容版本与授权范围以原项目当前文档为准。Stars 和评分是快照中的导航信号。

安装与排错 · 项目问题反馈

同类项目