Introduction¶
DeepSeek Harness (DSH) uses a plugin-based architecture, but it may be necessary to control tool visibility and invocation permissions uniformly at the host level without relying on a specific preset. dsh-tool-guard is a global tool-blocking plugin designed for this purpose. It achieves this goal through a three-layer mechanism (presentation-layer filtering, execution-layer hard veto, self-protection gate), and provides a WebUI editor to support hot-reload configuration.
Plugin Overview¶
Name: dsh-tool-guard
Maintainer: Tisitan
License: MIT
This is a preset-agnostic global tool-blocking plugin. It is not bound to any preset and intercepts, based on rules, tools that should not be visible to or invocable by the model at the unified plugin layer. The plugin includes presentation-layer filtering, execution-layer hard veto, self-protection gate, and a WebUI editor.
Core Features¶
- Preset-agnostic global tool blocking: Does not depend on a specific preset and performs unified interception at the host level.
- Presentation-layer filtering: Uses the
system-prompt/assemblemechanism to prevent the model from seeing blocked tools. - Execution-layer hard veto: Uses
tools.guardto provide a fallback rejection when a call actually arrives. - Self-protection gate: Protects core tools such as
read/write/edit/bashfrom being blocked. - WebUI editor: Provides a
/dsh-tool-guardRPC channel and supports immediate hot updating of configuration through a graphical interface.
Installation and Enablement¶
- Clone the repository and install dependencies:
git clone https://github.com/Tisitan/dsh-tool-guard.git
cd dsh-tool-guard
npm install
npm test
- Link the repository path to DSH’s web profile:
Add the following todependenciesin~/.dsh/profiles/web/package.json:
"dsh-tool-guard": "link:<绝对路径>"
Append the following to the dsh.profile.bundles array in the same file:
"dsh-tool-guard"
- Install dependencies and restart DSH:
Run the following in the~/.dsh/profiles/webdirectory:
pnpm install
Restart DeepSeek Harness.
Configuration Methods¶
The plugin provides two configuration paths with identical semantics, both supporting hot reload.
1. WebUI Configuration¶
After startup, use the “Tool Blocking” card on the DSH Web settings page. Read and write operations are performed through the /dsh-tool-guard RPC channel, and changes take effect immediately after saving.
2. Manual YAML Editing¶
Edit the dsh-tool-guard.denyTools array in ~/.dsh/settings.yaml.
Note: The configuration plane is never locked; saving a modification immediately triggers a hot-reload update.
Notes¶
- Loader Source Restriction: Plugins with
dsh.clientare allowed only one loader source globally. If mounted at the home level,dsh.clientmust be removed to avoid dual loader sources causing startup failure. - Protection Gate Cannot Be Blocked:
read/write/edit/bashare covered by the self-protection gate and cannot be blocked or intercepted. - Log Location: The log file is located at
$DSH_HOME/dsh-tool-guard.logor~/.dsh/dsh-tool-guard.log(can be overridden by the environment variableDSH_TOOL_GUARD_LOG). - Mounting Methods: Global mounting (single-point mounting in the web profile bundle) and local mounting (writing to a specific preset’s
agent.cordis.yml) are supported.