In DeepSeek Harness (DSH) Web development scenarios, when an agent modifies files or runs shell commands, developers often struggle to track the exact changes in real time and lack effective ways to block destructive operations. The dsh-edit-guardian plugin is designed to fill this gap.

This is a DeepSeek Harness Web plugin maintained by LWLAymh. It adds file change visualization, retain/undo controls, and a safe approval workflow for dangerous commands to the browser UI, helping developers more clearly monitor agent actions.

Core Features

1. File Change Bar

When the agent modifies files using write, edit, or str_replace_editor, the tool row displays file +N lines -M lines [show diff]. Clicking the button expands a context-aware inline diff. The change summary appears in a persistent bar above the input box and updates in real time even while the agent continues working.

2. Retain and Undo

The change summary bar allows fine-grained control for each file. Each row contains:
* A clickable file path
* Line statistics (+N / -M)
* A toggle to show/hide the diff
* Retain button: marks the change as accepted and removes it from the summary
* Undo button: executes the /undo <path> command and removes it from the summary

The “Retain All” and “Undo All” buttons at the top of the bar correspond to batch operations. Undo operations rely on the backend /undo command, which records successful results from write and edit tools and restores the file state or deletes newly created files when undoing.

3. Dangerous Command Approval and Highlighting

The plugin listens to the tools/pre-execute event and performs safety checks for bash and pwsh commands. If a command matches a destructive pattern (such as rm, Remove-Item, git reset --hard, curl|sh, etc.), the execution flow is routed to an approval process, and a prompt appears before the command runs.

In the shell tool row, matched dangerous text is highlighted in red. When a tool call requests sandbox permission elevation (sandbox_permissions), affected paths or working directories are also highlighted in red and display a “requires permission” badge. If the user rejects the approval or cancels the operation, the command will not be executed.

Installation and Enablement

Use the official install command to add the plugin to the Web profile:

dsh plugin --profile web add dsh-edit-guardian

After installation, restart the Web process for the plugin to take effect:

dsh --profile web

The plugin does not support hot reloading into an already running process.

Typical Usage

  • Skip approval: Switch to the “Full access” preset in the Web UI (danger-full-access sandbox mode) to skip approval prompts for dangerous commands, matching DSH’s existing semantics.
  • View changes: Click the “show diff” button on the tool row to view detailed context-aware changes.
  • Undo operations: Use the /undo command to revert changes produced by write or edit. Note that this feature only applies to results from the write and edit tools; changes made by str_replace_editor and shell commands cannot be restored with this command.

Notes

  • Undo limitations: The /undo command can only restore changes produced by the write or edit tools. Files modified via str_replace_editor cannot be restored through undo; changes produced by shell commands are also not restorable.
  • Restart requirement: After modifying the plugin source code, you must rerun the install command and restart the Web process for changes to take effect.
  • Uninstall: To remove the plugin, use the following command:
    dsh plugin --profile web remove dsh-edit-guardian

Summary

dsh-edit-guardian addresses the visibility and security issues of agent operations through UI-level enhancements. To learn more or view the source code, visit the plugin directory or the GitHub repository.