dsh-custom-js: Managing Trusted JavaScript / TypeScript Scripts in the DeepSeek Harness

Introduction

DeepSeek Harness (DSH) adopts an “everything is a plugin” architecture. During development or usage, you may encounter scenarios where you need to customize the interface, add shortcuts, or implement specific tool logic. Directly modifying core code or relying on unreliable solutions is unsafe.

The dsh-custom-js plugin provides a centralized environment for loading, editing, and managing trusted JavaScript and TypeScript user scripts. It addresses the lack of a unified script management tool in the DSH Web GUI, allowing you to customize the interface and functionality by writing scripts.

Core Features

1. Built-in Editor and Type Support
The plugin includes a CodeMirror-based editor, providing JavaScript / TypeScript syntax highlighting, line numbers, bracket matching, and code navigation. It supports JavaScript, MJS, and TypeScript file formats.

2. Hot Reloading and Lifecycle Management
It supports hot reloading of scripts, so changes take effect automatically. An explicit save mechanism is provided to prevent executing incomplete code while editing. Built-in ES2022 TypeScript module transpilation and lifecycle management are included.

3. Secure Importing and State Control
A secure import policy is used by default. Newly imported scripts are disabled by default and must be manually verified and enabled. Per-script enabling/disabling is supported, and contextual retry is available when a script fails during execution.

Installation and Enablement

Use the following installation command (replace <profile> with your profile name, for example web):

dsh plugin --profile <profile> add dsh-custom-js

After installation, you must restart the DSH process for the plugin to take effect. After restarting, go to Settings → General → Custom JavaScript / TypeScript to view the management interface.

Typical Usage

  1. Open Settings → General → Custom JavaScript / TypeScript.
  2. Create a script named hello.js and paste the following code:
    console.log('Hello from dsh-custom-js')
  1. Save the script. If automatic reloading is enabled, the Host will detect the change and notify the Client to load the new script.

You can also create files directly under the $DSH_HOME/custom-js/ directory; the plugin will automatically scan that directory.

Applicable Scenarios and Cautions

Applicable Scenarios
This plugin is suitable for developers who need to customize the Web GUI interface, add helper tools, or extend functionality through scripts without modifying the DSH core code.

Important Cautions
* Permission Scope: User scripts run in the browser and have the permissions of the current page (such as DOM manipulation, localStorage, network requests, and so on). They are not sandbox-isolated. Please only load code that you wrote yourself or fully trust.
* Compatibility: The plugin is compatible with DSH versions >=0.2.0-rc.1 <0.3.0-0.
* Recovery Mechanism: If a script causes the Web GUI to crash, you can stop DSH, rename the problematic file under the $DSH_HOME/custom-js/ directory (for example, add a .disabled suffix), and then restart DSH to disable that script.

Conclusion

dsh-custom-js enables you to safely extend the functionality of DSH. For more details, please refer to the GitHub repository.

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

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

Xiaoye