dsh-page-struct: Provide Read-Only Page Structure for DSH

Introduction

When making an agent “view web pages” in DSH, a common approach is to pull a flat snapshot or screenshot. Table row/column coordinates, merged cells, fields inside Shadow DOM, GitHub-style code blocks, and information like “is this content trustworthy” are often lost in the snapshot or difficult to parse reliably. The result is that the model has to guess the structure, and long pages consume the entire context window.

dsh-page-struct (maintained by LISHUANGXI1412) takes a different path: it attaches to the browser already opened by CUA, reads the current page in read-only mode via CDP, and outputs structured results with region indices, table matrices, Shadow DOM fields, code blocks, and confidence labels. It does not handle clicks, input, or navigation; browser lifecycle and login state are managed by CUA.

Below we introduce what it is, how to use it, and its applicability boundaries. The plugin is categorized under “Web Tools” in the DSH community catalog; see the catalog page at SkillHub: dsh-page-struct and the source code and documentation at GitHub Repository.

What Is This

In one sentence: dsh-page-struct is a read-only page structure reader—CUA handles the browser and login, this plugin only reads the page into structure, without performing page operations.

Architecture relationship (excerpted from README):

CUA browser (profile: %LOCALAPPDATA%\CuaDriver\BrowserProfiles\dsh-page-struct)
  │  CDP 127.0.0.1:<port>
  ├── CUA tools: browser_navigate / browser_click / browser_type
  └── dsh-page-struct: page_structure / page_region
        → same process, same cookies, same localStorage

The plugin does not start or keep alive a browser on its own. It reads the port written by browser_prepare for the specified CUA profile, attaches to the same browser instance via CDP, and shares cookies and localStorage with CUA.

The motivations listed in the README include: native snapshots often lose the structure the agent needs—table coordinates and multi-level headers, Shadow DOM component fields, div/grid pseudo-tables that are not <table>, code/log blocks, and region trustworthiness (high / partial / unreliable). The upstream page-struct project, on a “4 pages × 13 questions” benchmark, shows that the structured representation enables 13/13 questions to be answered definitively, whereas the flat snapshot only achieves 2/13, with roughly 10× fewer characters (see the upstream project documentation and limitations for details).

The current package.json version is 0.1.4, licensed under MIT; the embedded vendor/page-struct/ core is also MIT.

Core Features

Tools

Tool Purpose
page_structure Region indices, table matrices, Shadow DOM fields, code blocks, confidence-related evidence.
page_region Retrieves a single block of content by region ID (e.g., T1 / P1 / X1 / S:<host> / C1) after the index has been truncated; reuses the most recent analysis when possible.

Both are read-only. For clicks, input, and navigation, use CUA / browser tools.

Typical Reading Modes

Open and analyze by URL (requires CUA browser to already be running):

{ "url": "https://example.com" }

Read the current tab (does not create a new tab or navigate, suitable for DOM after login or SPA routing):

{ "tab": "current" }

When multiple tabs exist, you can specify precisely using URL or targetId (CDP does not expose the “currently active tab”; when running multiple instances, passing targetId is recommended):

{ "tab": "current", "url": "https://example.com/report" }
{ "tab": "current", "targetId": "A95662CFE231DF63DE2DAEF4049DAB6F" }

The Page: line in the output indicates the actual URL that was read. page_region supports the same tab / targetId parameters and reuses the analysis when the cache key matches.

Installation and Activation

The captured materials do not provide an official DSH installation command such as dsh plugin add …; this article does not fabricate one. Please follow the current documentation on the SkillHub catalog page or the GitHub README to complete installation.

Environment and constraints (from package.json and README):

  • Operating system: Windows only (os: ["win32"]), depending on the CUA native browser profile path layout.
  • Node: >= 22.

The plugin runs inside the DSH Host process, and page content is returned to the model as a tool result; the README states that the plugin does not send page content to third-party services on its own. Before installation, it is recommended to review the repository source code and MIT license, and understand that it reads your logged-in browser pages with the permissions of the current DSH process.

Configuration Example

config:
  proxy: ''
  endpoint: cua:dsh-page-struct
  cuaProfile: dsh-page-struct
  exe: ''
  cacheTtlMs: 120000
  cacheMax: 3
Key Meaning
endpoint Default cua:<profile>; can also be host:port to attach to an existing CDP; "" creates a one-time temporary browser. auto is equivalent to cua:<cuaProfile>.
cuaProfile Named CUA profile, default dsh-page-struct.
proxy Used only when endpoint: "" for the temporary browser; CUA browser proxy must be configured at CUA startup.
exe Optional Edge/Chrome path for the temporary browser.
cacheTtlMs / cacheMax In-memory snapshot cache used by page_region.

Brief overview of Endpoint modes:

  • cua:dsh-page-struct — Attaches to an already running CUA browser, does not start a new instance.
  • host:port — Attaches to any browser that exposes CDP.
  • "" — Launches a one-time temporary browser (can be configured with proxy), suitable for fixtures, offline snapshots, or external sites requiring a proxy.

Typical Usage: Start CUA First, Then Read Structure

1. Prepare the CUA Browser

On the site you need to access, first start the named profile (only needs to be done once; the profile is persistent, and cookies and localStorage are preserved across restarts):

browser_prepare({ profile: { mode: "isolated_named", name: "dsh-page-struct" } })

This opens a visible Chrome window. Complete login on the required site within that window. Session cookies (without Max-Age) will still expire according to browser rules.

If the CUA browser is not running, the tool returns a clear error; you need to call browser_prepare again and then retry. The plugin cannot start or keep alive the browser on your behalf.

2. Call page_structure

When the default endpoint points to cua:dsh-page-struct, simply pass the target URL or tab: "current" (see the JSON examples above).

Large pages may only return the index; use page_region to retrieve details by region ID.

3. Division of Labor with CUA

Navigation, clicks, input: use CUA’s browser_navigate / browser_click / browser_type, etc. Structure reading: page_structure / page_region. Same profile, same CDP session, consistent login state.

Applicable Scenarios and Notes

Who it’s for

  • Scenarios that require stable reading of table coordinates, Shadow DOM fields, code blocks with confidence labels within DSH agent workflows.
  • Teams already working with CUA browser workflows who want to separate “operations” from “structure reading.”

Limitations (key points from the original README)

  • Windows only; CUA must already be running.
  • Read-only: no clicks, input, scrolling, or navigation.
  • With multiple tabs, tab: "current" may select the wrong tab; use targetId.
  • Latency: warm browser approximately 0.6–0.8s; cold navigation approximately 1–2s.
  • Closed Shadow DOM, purely Canvas-rendered content, some virtual lists, etc. may be marked as unreliable.

Security and Privacy

  • CUA uses a real Chrome persistent profile, treated as a logged-in environment; do not expose the CDP port to untrusted local processes.
  • The plugin does not operate on your daily Edge/Chrome configuration, nor does it copy cookies.

The DSH ecosystem emphasizes “everything is a plugin”; SkillHub is a community catalog site with no official affiliation with DeepSeek / 幻方 (High-Flyer).

Conclusion

dsh-page-struct advances “viewing web pages” from flat snapshots to referenceable structure: tables, Shadow DOM, code blocks, and confidence labels, with a clear read-only boundary and dependence on CUA. If you are already doing web-connected tasks with DSH + CUA on Windows, you can check the 0.1.4 version notes and the cordis.patch.yml integration method on the catalog page and GitHub.

  • Catalog page: https://www.skillhub.cn/plugins/LISHUANGXI1412/dsh-page-struct
  • GitHub: https://github.com/LISHUANGXI1412/dsh-page-struct
羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye