dsh-stl-preview: Preview STL mesh and view print metrics in the DSH right sidebar

Introduction

When developing agents or scripts in DeepSeek Harness (DSH), .stl models often pile up in the workspace: part prototypes, scanned meshes, or intermediates before slicing. Previously, viewing models within DSH required switching to external viewers or slicing software, and dimensions, volume, and watertightness had to be calculated separately. The dsh-stl-preview introduced below registers STL as a document preview type: clicking a file in Workspace files brings up an interactive 3D viewport in the right-hand Sidebar, accompanied by values for dimensions, volume, surface area, and watertightness. Parsing is completed entirely within the browser, without relying on Blender, slicers, or additional network uploads.

What is this

dsh-stl-preview is a client-side plugin published by maintainer 439436269-ctrl. It registers a document preview renderer for .stl files. It streams file bytes to the frontend via an authenticated /api/stl-preview route, parses binary and ASCII STL within the page, renders the triangle mesh using a dependency-free WebGL viewport, and outputs statistics relevant to 3D printing. The viewport interactions are consistent with dsh-blend-preview: orbit rotation, panning, scroll wheel zoom, double-click reset, wireframe, auto-rotate, contact shadows, and axis triads.

Core Features

Document Preview & Data Flow

  1. Click a .stl file in Workspace files; the document preview in the right-hand Sidebar opens the file.
  2. The client requests GET /api/stl-preview?path=…. The host reads the raw bytes in chunks (default 1 MiB per chunk). The connection service completes authentication (Host/Origin and session cookie) before reading.
  3. The browser uses parseStl to parse the mesh; no files are uploaded to third parties, nor is any format conversion performed on the host.

3D Viewport

  • The STL convention is Z-axis up; it is rotated to the viewport’s Y-up orientation before rendering.
  • Supports orbit, pan, scroll zoom, double-click reset, wireframe, auto-rotate, contact shadow, and axis triad.
  • The default mesh color is #c7d2e2 (STLs do not inherently carry materials); this can be modified in the configuration.

Statistics & Analysis

The plugin reports the following in the panel:

Category Content
Format binary / ASCII and header information
Scale File size, triangle count, welded vertex count
Geometry Bounding box (mm), Volume (cm³), Surface Area (cm²)
Watertightness Boundary edges, non-manifold edges, degenerate faces; determined by welding the vertex mesh and counting edge usage.

Volume is calculated using signed tetrahedron summation (|Σ v0·(v1×v2)/6|), and area is the sum of triangle face areas. If the triangle count exceeds analysisMaxTriangles (default 400,000), watertightness analysis is skipped, and the interface will explain the reason to prevent the tab from freezing on large meshes.

Unitless STL

STL files do not carry length units. unitScale specifies “how many millimeters correspond to one STL unit”: the default 1 implies interpretation in millimeters; if a model was modeled in centimeters, set it to 10, or 25.4 for inches. Dimensions, volume, and area are all affected by this scaling.

Environment & Requirements

  • DeepSeek Harness 0.2.x; declared compatible with 0.2.0-rc.2 and 0.2.1-rc.2 within the package.
  • The browser or desktop client must support WebGL (usually already satisfied by the DSH desktop application).
  • The plugin package requires Node >= 22 (for development and building); the runtime side does not depend on Node for previewing.
  • Current npm package version 0.1.0, License MIT.

Installation & Activation

Execute the official installation command under the corresponding profile:

dsh plugin --profile <profile> add dsh-stl-preview

Desktop profiles are managed by the Electron application: you can install it via the plugin management UI, or manually write to compose and restart. The package includes cordis.patch.yml, which automatically merges the plugin line into the configuration.

Behavior can be adjusted in Settings → Plugins → STL preview (namespace stl-preview). Common configuration items are as follows:

Key Default Meaning
enabled true Whether to register the renderer and byte routing
routePath /api/stl-preview Authenticated mesh route; must remain under /api, otherwise falls back to default path
extensions ["stl"] Suffixes that trigger 3D preview
maxBytes 536870912 Maximum STL size allowed for streaming (512 MiB)
chunkBytes 1048576 Host-side chunked read size
unitScale 1 Millimeters per STL unit
color #c7d2e2 Viewport mesh color
analysisMaxTriangles 400000 Skip watertightness analysis if exceeded

Typical Usage

  1. Install and ensure enabled is true. Set unitScale as needed (especially if the model was not exported in millimeters).
  2. Place a .stl into the DSH workspace and single-click the file in Workspace files.
  3. Once the viewport loads in the right Sidebar, use the mouse to rotate, pan, and zoom to view the model; check the volume, surface area, and watertightness entries when verifying print feasibility.
  4. If the triangle count is extremely high and watertightness is not displayed, check against analysisMaxTriangles; simplify the mesh locally with other tools if necessary before previewing.

The data path can be summarized as:

Workspace file click
        │
        ▼
document preview body (lib/client.js)
        │  GET /api/stl-preview?path=…
        ▼
parseStl(bytes)  →  analyzeStl + setGeometry(Z-up → Y-up)

Use Cases & Notes

Suitable for: Quickly verifying STL appearance and bounding boxes within DSH; checking volume, surface area, and watertightness hints before submitting to slicing or printing; sharing the same workspace with agent workflows to reduce the frequency of switching out of DSH.

Limitations & Notes (from the upstream README):

  • Parse of million-triangle meshes on the main thread may be slow; there is a triangle limit for watertightness analysis.
  • ASCII STLs exceeding standard syntax (e.g., extra vertex colors, non-standard facet attributes) are processed solely by position and normal.
  • Extremely large files are constrained by maxBytes.

Security & Permissions: The plugin runs with the permissions of the current DSH process and can register routes under /api to read workspace files. Before installing, please read the source code and MIT License of the GitHub Repository to confirm it meets your environment policies. The DSH community plugin directory is an independent site and has no official affiliation with DeepSeek / High-Flyer.

Conclusion

dsh-stl-preview makes STL a first-class citizen in the DSH right sidebar: local authenticated streaming, in-browser parsing, dependency-free WebGL preview, and a centralized display of values commonly cared about in printing. For directory descriptions or issues, please visit the plugin page and repository:

  • Directory Page: https://www.skillhub.cn/plugins/439436269-ctrl/dsh-stl-preview
  • GitHub: https://github.com/439436269-ctrl/dsh-stl-preview
羽毛球分组比赛记分
小程序二维码

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

Xiaoye