dsh-vision-diff: Pixel-level Screenshot Diffing on DSH

Preface

When working with UI or screenshot capabilities in DeepSeek Harness (DSH), common plugins usually focus on “understanding content”: image recognition, OCR, element localization, and multimodal Q&A. However, a more fundamental step in visual regression is often something else: whether two images are identical at the pixel level, and where the differences lie. Furthermore, the conclusion must be scriptable for assertions, rather than relying on human inspection.

dsh-vision-diff targets this specific step: it takes two local PNGs as input and outputs a single machine-readable line of PIXEL_CHANGED=true|false, accompanied by diff regions and a self-contained HTML comparison page. The entire process runs locally with zero external dependencies, no model invocation, and no network access.

What is this

  • Repository: dingchenhui0618-arch/dsh-vision-diff
  • Maintainer: dingchenhui0618-arch
  • Community Category: Workflow (SkillHub Directory: dsh-vision-diff)
  • Positioning: Pixel-level screenshot diff for DeepSeek Harness — input two local PNGs; output PIXEL_CHANGED verdicts, diff regions, and self-contained HTML comparison pages.

It does not perform content recognition (it does not determine “what this button is”); it only answers “has it changed, and where,” using deterministic pixel comparison.

Core Features

Machine-Readable Verdict

The output utilizes a single line of text as the entry point for assertions, for example:

PIXEL_CHANGED=false

false indicates consistency, while true indicates inconsistency. This facilitates grep operations in pipelines or parsing the verdict / pixelChanged fields in JSON.

Agent Tools and Interface

After installation and host restart, a “Vision Diff” tab will appear in the conversation view, allowing the Agent to use the vision_diff tool.

Parameters and Ignore Regions

Parameter Required Description
before ✅ The first PNG (absolute path or relative to cwd)
after ✅ The second PNG
ignore Regions to ignore (clocks, cursors, ads, etc.)
threshold Channel differences must be greater than this value to count as a change; default is 0. Values 2~8 can be used to filter out compression noise.
blockSize Connectivity block granularity for diff pixels; default 16. Only affects region clustering, not region boundaries.
regionLimit Maximum number of diff regions to return; default 20. Sorted by diff pixel count in descending order.
cwd Directory for resolving relative paths
label Description for this comparison, written to the report and comparison page

Ignore regions support various JSON formats (rectangular coordinates, regions array, unit: "fraction" for resolution-independent scaling, etc.). Failed ignore region parsing is not silently discarded; it is listed in ignoreRejected and marked in the verdict, comparison page, and Tab.

Output and Artifacts

Structured results include dimensions, comparison/ignored pixel counts, diffPixels, diffPercent (6 decimal places), regions, threshold, and ignore configuration. Each run leaves an index.html (self-contained comparison page), report.json, diff.png (red=changed, blue=ignored), and optional input copies in $DSH_HOME/vision-diff/runs/<id>/.

When dimensions do not match, the full area of the before image is used as the comparison scope. Missing pixels are counted as changed, and dimensionChanged is set.

PNG Support Range

Supports non-interlaced PNGs with color types 0/2/3/4/6 and bit depths of 8 or 16 (16-bit takes the high byte). Adam7 interlacing, low-bit-depth packing formats, non-PNG files, and CRC failures will result in explicit errors; no approximate decoding is performed.

Privacy and Dependencies

Executed entirely locally; the host half uses only node: built-in modules and modules within the same directory. PNG encoding and decoding are self-implemented (src/png.js) to satisfy the zero-dependency requirement.

Installation and Activation

The plugin runs with DSH process privileges. Please review the repository source code and MIT license before installing. The package.json declares the engine: dsh >=0.2.1-rc.2 <0.3.0.

The commands below are from the repository README. Please replace <插件目录> (plugin directory) with the actual path (do not construct github:owner/repo installation strings based on repository names if they do not appear in the documentation).

For npm-based CLI managed profiles:

dsh plugin --profile <name> add <插件目录>

For Desktop versions (the desktop profile is exclusive to Electron; the npm CLI will be rejected):

You must use the CLI bundled with the application (located at resources/runtime/cli/bin/dsh within the app):

"<app>/resources/runtime/cli/bin/dsh" plugin --profile desktop add <插件目录>

Restart the app once after installation: Changes to the host half require a process restart to load; already loaded ES modules will not be replaced by simply toggling the plugin.

Typical Usage

Invoking via Agent

vision_diff(before: "shots/home-dark.png", after: "shots/home-light.png")

Viewing Artifacts via Command Line

Each comparison leaves evidence in $DSH_HOME/vision-diff/runs/<id>/. You can directly open index.html to view it without needing a local HTTP server.

If the host has registered a webServer, statistics, history, and comparison pages can be accessed via the /dsh-vision-diff prefix (if registration fails, the vision_diff tool remains available).

Configuration (Plugin-Level Defaults)

Items in apply(ctx, config) can be overridden. Examples:

key Default Description
dataDir $DSH_HOME/vision-diff Directory for artifacts and index
baseDir process.cwd() Base directory for relative paths
maxBytes 64 MB Single file size limit
maxPixels 40 million (takes the smaller value compared to host image policy) Single image pixel limit
threshold / blockSize / regionLimit 0 / 16 / 20 Can be overridden by single call
historyKeep 30 Number of records to retain
keepInputs true Whether to keep copies of inputs in the artifact directory

Use Cases and Notes

Suitable for: UI visual regression, comparing two renders of the same page, scenarios requiring PIXEL_CHANGED assertions in Agent workflows, and local archiving of comparison pages and diff images.

Notes:

  • It complements—rather than replaces—content recognition capabilities focused on “what is on this screen” (such as dsh-client-vision type plugins in the community), OCR, or multimodal understanding.
  • The plugin runs within the harness; file reading prioritizes ctx.fs. Pixel limits and single-file size limits apply; requests exceeding limits are rejected before decoding.
  • SkillHub and similar platforms are community directories and have no official affiliation with DeepSeek / High-Flyer. Installing plugins extends host capabilities; please assess trust boundaries independently.

Conclusion

dsh-vision-diff turns “are these two screenshots pixel-identical” into a scriptable local tool: a line of PIXEL_CHANGED, structured JSON, and a comparison page that can be opened by double-clicking. It is suitable for deterministic visual inspection within DSH workflows.

  • Directory Page: https://www.skillhub.cn/plugins/dingchenhui0618-arch/dsh-vision-diff
  • GitHub: https://github.com/dingchenhui0618-arch/dsh-vision-diff
羽毛球分组比赛记分
小程序二维码

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

Xiaoye