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 和評分是快照中的導航訊號。

安裝與排錯 · 專案問題反饋

同類專案