dsh-sidebar-image-zoom: Cursor anchor zoom and drag pan for images in the DSH right sidebar

Introduction

When opening bitmaps from screenshots, architecture diagrams, or logs in DeepSeek Harness (DSH), the right sidebar uses the built-in image panel: the bitmap is first scaled to fit the panel, and the interaction space is limited afterward. The built-in controls are a floating bar with + / − / Fit to window that is often invisible unless you move your mouse to the bottom edge; zoom is anchored at the panel center, so the area you are viewing does not follow the cursor, and there is no drag panning either. For scenarios that require reading small text or comparing local details, this experience tends to become everyday friction.

Below is a community-maintained client plugin, dsh-sidebar-image-zoom (maintainer MYX-0211): it directly replaces the built-in bitmap renderer through DSH’s document preview extension mechanism, providing cursor-anchored wheel zoom and pointer-capture drag panning. The plugin is not published to npm; it must be manually staged into your profile per the repository instructions; DSH loads plugins at boot, so you need to restart once after installation.

What Is This

dsh-sidebar-image-zoom is a client-side plugin for DSH (category: client), current version 0.1.0, license MIT. In one sentence: it provides pointer-anchored wheel zoom (wheel zoom anchored on the pixel under the cursor) and drag-to-pan for images in the DSH right sidebar, replacing the built-in image viewport.

DeepSeek Harness’s ecosystem philosophy is “everything is a plugin”; community directories such as SkillHub are independent sites with no official affiliation with DeepSeek / High-Flyer. The installation and usage instructions in this article are based on the repository README.

Differences from the Built-in Viewer

The built-in panel scales the bitmap to fit the window and basically stops there; this plugin also starts from the “Fit to window” state when opening an image, but subsequent behavior is driven by the gestures below and the persistent bottom control bar. A zoom level you set with the mouse wheel yourself will not be reset when the panel size changes; only clicking “Fit to window” or switching to another image returns to the fit state.

Core Features

Gestures and Keyboard Shortcuts

Gesture / Key Effect
Mouse wheel Zoom, anchored on the pixel under the cursor
Drag Pan (pointer capture; cursor can move outside the panel)
Double-click Toggle between “Fit to window” and 1:1
F / Esc Fit to window
1 100%
+ - = _ Step zoom anchored at the panel center

The bottom control bar is persistently displayed: Fit to window · 1:1 · − · percentage · +. The percentage reading updates in real time with the current scale.

Takeover Mechanism (No Extra Configuration Required)

The plugin claims the same image extensions as the built-in one via ctx.documentPreviews and registers with priority: "extension". In DSH’s matching order, a non-builtin priority ranks ahead of the built-in bitmap viewer (priority: "builtin"), so no configuration is needed, there is no user switch, and the extension directly takes over the right-side image panel. The main body registers in the keyed subslot sidebar.right.tab.document, with the key matching the registry id.

Implementation notes: binaryExtensions must be a subset of extensions; SVG is intentionally excluded from binaryExtensions, so the plain-text renderer can still be used to read vector source code. The renderer has an error boundary wrapper to prevent a single image error from blanking out the entire sidebar.

Degradation and Hints

If the bytes do not match a known signature, the extension does not match the actual format, or the tab has not yet received content, the corresponding short hint is displayed instead of leaving an empty panel.

Installation and Enabling

The plugin is not published to npm, so DSH’s “Plugins → Add Plugin” flow that resolves package names via registry cannot find it. The official method is: clone the repository, place the package where the profile can resolve it (generally <profile>/node_modules/dsh-sidebar-image-zoom/), and add it to both dependencies and dsh.profile.bundles in the profile’s package.json, then restart DSH.

git clone https://github.com/MYX-0211/dsh-sidebar-image-zoom.git

After cloning, place the package directory at the node_modules path above and manually edit the profile’s package.json (dependencies + dsh.profile.bundles).

On Windows, the repository provides install.ps1 / uninstall.ps1, which automatically stage and modify the manifest for standard profile paths; underneath, it uses tools/manifest_edit.py to edit the manifest line by line (not a JSON round-trip), and generates a timestamped package.json.bak-* before writing to disk. If execution policy blocks .ps1, you can read the file as UTF-8 and execute it per the README:

Invoke-Expression ([IO.File]::ReadAllText(".\install.ps1", [Text.Encoding]::UTF8))
Invoke-Expression ([IO.File]::ReadAllText(".\uninstall.ps1", [Text.Encoding]::UTF8))

The uninstall and reinstall scripts are designed to be idempotent; the README states that an uninstall-then-install round trip can be byte-for-byte identical to the original manifest.

Compatibility (repository declaration): built and tested for DSH 0.2.0-rc.2, desktop profile; package.json declares dsh.compatibility.dsh as >=0.2.0-rc.2, with profiles including web and desktop. The plugin depends on DSH internal slot names and registry semantics; if it breaks after a DSH upgrade, the symptom may be a blank sidebar panel. The workaround is to disable the bundle and reload; this usually does not take down the rest of the UI.

Please read the source code and the MIT license yourself before installing; the plugin runs under the current DSH process privileges, and like any third-party extension, the trust boundary depends on the bundle you install.

Typical Usage

  1. Complete installation per the previous section and restart DSH.
  2. Open any supported bitmap in the DSH right sidebar (the extensions claimed by the plugin match the built-in bitmap preview; vector SVGs can still be viewed as source by text-based renderers).
  3. When you need to see local details: mouse wheel to zoom in on the target area (anchor follows the cursor); drag to pan the image; double-click to toggle between fit-to-window and 1:1; or use the bottom bar and shortcuts like F / 1 / + -.
  4. When resizing the window or panel, if you have not clicked “Fit to window” or switched images, the current zoom level is preserved.

In the repository’s test cases, the wheel-zoom test asserts “the image point under the cursor moves 0.00px”; the drag-pan test asserts that the displacement matches the pointer delta (e.g., (-140, -90)), which can serve as a reference for expected behavior.

Development and Self-Testing (Optional)

If you fork and modify lib/client.js, you can run the following in the repository root:

npm install
npm test

Tests use puppeteer-core to drive a local Edge/Chrome (no bundled Chromium); the browser path can be specified via PUPPETEER_EXECUTABLE_PATH, for example:

PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium npm test

package.json requires Node >= 20. The full test suite contains about 30 assertions, covering the registration contract, the control bar, the double-click toggle, corrupted-file hints, etc.

Conclusion

dsh-sidebar-image-zoom addresses the zoom anchor and panning gap when reading images in DSH’s right sidebar: it replaces the built-in viewport via extension priority, binds wheel zoom to the pixel under the cursor, makes drag-to-pan available by default, and keeps shortcuts like fit-to-window and 1:1. It is suitable for developers who frequently compare screenshots, UI mockups, or images with small text in Harness; installation is primarily via manual staging, so remember to restart DSH after installation.

羽毛球分组比赛记分
小程序二维码

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

Xiaoye