dsh-live-preview: Real-time Preview of HTML Pages Next to Harness Conversations

Preface

When using DeepSeek Harness to build static pages or simple frontends, the common workflow involves asking the agent to modify files, switching to a browser or local server to check the results, and then returning to continue the conversation. This involves constant window switching and manual refreshing after saves. The community plugin dsh-live-preview (maintainer 2011126630z-commits) adds a live preview panel to the right side of the Harness Web UI: select an HTML file in the workspace to view it while chatting; it auto-reloads upon saving. The agent can also open or focus pages using the live_preview tool.

What is this?

dsh-live-preview is a client-side plugin for DeepSeek Harness (Category: Client). It mounts a preview panel in Harness instances with a Web UI, serving pages via a local read-only preview service. It uses a same-origin API for the interface and an independent origin for the iframe to prevent the preview page from accessing Harness authentication states. The license is MIT; the package version in current documentation is 0.4.1.

Core Features

The following summarizes capabilities listed in the README, without exceeding the documented scope.

Panel & Browsing

  • The preview panel is docked to the right of the Harness UI; drag the left edge to adjust width. Width and device mode are remembered.
  • Workspace → Directory → File tree navigation; HTML files are marked with HTML and clickable to enter preview.
  • Device widths: Full / 768 px (Tablet) / 375 px (Phone); supports opening in a new tab.
  • After a Harness restart, if the panel was previously open, the browser restores the last viewed page.
  • Separate window: Opens the preview in the system default browser and collapses the in-panel view; auto-reload and edit focus remain available (the desktop shell delegates window.open to the Host).

Auto Reload

  • Auto reload is enabled by default: monitors changes via SSE with a version polling fallback; can be disabled, or manually refreshed via the Reload button.
  • Monitoring is established only for files actually loaded in the preview; irrelevant writes in the workspace (logs, data exports, etc.) will not trigger erroneous full-page refreshes.

Edit Focus

  • After saving, it attempts to point out “which part was just changed”: HTML scrolls to and outlines the source line and data-lp-line marker; CSS outlines the selector of the rule containing the changed line (up to 12 elements); other text files display “Editing … · line N” in the panel without outlining the page.
  • Focus is retained across reloads via sessionStorage; the panel provides Locate / clear options, fading out after approximately 15 seconds.
  • The tool side can explicitly call focus / clear (see examples below).

Agent Tool live_preview

  • Actions: open / close / refresh / root / focus / clear.
  • Opened paths are resolved relative to the caller’s session working directory, and the nearest registered workspace is selected as the preview root.

Security & Isolation (as per documentation)

  • The preview service binds only to 127.0.0.1; requests require a one-time token (?t=) or the dshprev HttpOnly cookie.
  • Read-only with no write interfaces; realpath containment rejects .., encoded traversal, and symlink escapes.
  • Not exposed to the local network or remote access.

Environment & Dependencies

  • DeepSeek Harness with Web UI (dsh web or the desktop app).
  • The Harness host requires Node.js 20+.

Installation & Activation

Installation follows the repository README: obtain the plugin directory on the Harness host and install as a local bundle (do not use concatenated commands like dsh plugin add github:… which do not appear in the materials).

  1. Place the dsh-live-preview repository at any path on the host (the README specifies cloning locally; the bundle must be reinstalled if the directory is moved or deleted).
  2. Install the local bundle via the plugin manager, for example:
plugin_manager install_bundle(target: "/absolute/path/to/dsh-live-preview")

UI Path: Plugins → Add → local bundle directory.

  1. Refresh the Web UI (Ctrl+R). An eye icon will appear on the session title bar.

Local directory installation links to the checkout directory in place; reinstallation is required if the path changes.

Typical Usage

Panel Operations

  • Eye icon: Toggle the preview panel.
  • Workspace dropdown: Switch preview root (registered workspaces only).
  • Choose file: Browse and click HTML to preview; click folders to drill down.
  • Full / Tablet / Phone, Auto reload, Reload, Open in a new tab, Separate window function as labeled; drag the panel’s left edge to resize.

Asking the Agent to Open a Page

Say to the agent (README example):

Open the live preview on maas-home-preview/index.html

Corresponding tool call format:

live_preview({ action: "open", path: "maas-home-preview/index.html" })

Focus Examples (JSON)

{ "action": "focus", "selector": "#hero" }
{ "action": "focus", "path": "index.html", "line": 312 }
{ "action": "clear" }

Configuration

Edit the config in the plugin row within the cordis.patch.yml patch layer:

- id: dsh-live-preview
  config:
    port: 8123              # 0 = auto-select free port; falls back if occupied
    autoReload: true        # Broadcast reload by default
    roots: []               # Additional absolute paths allowed as preview roots
    ignore: ["node_modules", ".git", "dist", "build", ".tmp", ".venv"]
    panelWidthRatio: 0.46   # Initial panel width ratio

Architecture Overview

The Harness Web UI drives the panel via a same-origin JSON API (/dsh-live-preview/*); the iframe loads a local loopback preview service (default port 8123, configurable). The Host-side plugin is zero-dependency, responsible for static files, injecting reload scripts, fs.watch on served files, and SSE. See the structure diagram in the README for details.

Use Cases & Notes

Suitable For

  • Static HTML/CSS/JS or pages that can be opened in a browser without npm run dev.
  • Harness frontend/HTML collaboration where you want “conversation on the left, page on the right” with instant visibility upon saving.

Limitations (README)

  • Static files only; projects requiring a dev server are not proxied currently (marked as planned in documentation).
  • Backend interfaces using absolute paths within the page may result in 404s in the preview.
  • If the page’s CSP blocks the injected reload script, the panel side retains a fallback reload; manual page refresh may be required once after plugin installation or upgrade.
  • During major Harness version upgrades, changes in internal boot contracts may require a minor plugin version update.

Before Installation

The plugin runs under the permissions of the current dsh process, opening a local read-only preview service and reading workspace files. Before installation, review the source code and MIT license yourself to ensure the paths and ignore rules comply with your security policy.

Conclusion

dsh-live-preview brings “instant visual feedback after editing” into the Harness interface: panel preview, save-to-reload, edit focus, and the live_preview tool reduce switching between chat and browser. Directory and repository links are below; version and star counts are subject to the site and GitHub.

  • Community Directory Page: https://www.skillhub.cn/plugins/2011126630z-commits/dsh-live-preview
  • GitHub: https://github.com/2011126630z-commits/dsh-live-preview
羽毛球分组比赛记分
小程序二维码

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

Xiaoye