跪拜 Guibai
← All articles
Artificial Intelligence

dsh-file-manager turns DeepSeek Harness workspaces into an editable file tree

By 程序员Oak ·
Read original on juejin.cn ↗ Google Translate ↗ Alt translation

DeepSeek Harness developers get a file manager that turns workspace files into a browsable and editable tree without leaving the tool. The plugin's zero-dependency host side and explicit UTF-8 handling set a practical pattern for building safe, locale-aware DSH plugins.

Summary

dsh-file-manager extends DeepSeek Harness with a full file manager. The plugin adds a left-sidebar entry that opens a central panel for browsing workspace files, previewing and editing text, and performing basic file and folder operations. It's built as a host+client bundle using DSH's Cordis scoped bundle mechanism. The host side, written in ESM, registers seven API routes for meta, list, read, mkdir, write, rename, and remove. It uses only Node.js fs/promises with zero third-party dependencies. The client side renders React via window.__ModuleLoader__.load, without JSX, and injects styles using DSH theme tokens.

Path safety comes from resolveRoot and inside() checks, confining operations to registered workspace roots, with a 4MB per-file limit. The UI supports workspace switching, breadcrumb navigation, fuzzy search, hidden file toggle, and skips node_modules and .git. Text preview handles UTF-8 and GBK encodings; editing writes back to disk. On macOS, protected directories may need TCC permission, and the plugin guides users to the right system settings.

Takeaways
— Package name is @oakzhong/dsh-file-manager, version 1.0.2
— Registers seven API routes under /api/dsh-file-manager/
— Uses Node.js fs/promises exclusively, with zero third-party dependencies
— Path operations are restricted to registered workspace roots via resolveRoot and inside() checks
— Single-file read/write limit is 4MB
— Text preview supports switching between UTF-8 and GBK encodings
— macOS protected directories (like ~/Documents) may require TCC permission, and the plugin points users to System Settings
— Installation works via GitHub URL or npm package name
— Automatically skips node_modules and .git directories in file listings
Conclusions

The zero-dependency host side makes the plugin easy to audit and lightweight, a sensible choice for a narrow file management scope.

Explicit UTF-8 decoding on the client side solves a real pain point: Chinese filenames and content garble easily, and relying on implicit charset handling is fragile.

The path traversal protection, based on resolveRoot and inside(), is minimal but adequate for a single-user developer tool, trading breadth for simplicity.

Concepts & terms
DeepSeek Harness (DSH)
A development environment or harness for DeepSeek AI models that supports plugin extensions for tasks like file management.
Host+Client plugin
A plugin pattern where one part runs server-side logic (host) and another runs in the browser UI (client), communicating through HTTP APIs.
Cordis
A plugin framework used by DSH that manages scoped bundles and the lifecycle of plugin components.
Source: juejin.cn ↗ Google Translate ↗ Backup ↗