In DeepSeek Harness (DSH), when an agent requests a file modification, the native approval card only displays the original old_string and new_string, lacking context and line numbers, making it difficult to assess quickly. The dsh-approval-diff plugin aims to solve this problem by replacing the native approval card with a review interface that includes real diffs, line numbers, word highlighting, and disk source context.

This is a DSH plugin maintained by joao-paulo-santos. It focuses on the file-change approval flow and provides visual code difference review in the native approval card through the dsh-diff-view dependency library.

Core Features

Visual Diff Review

The plugin directly renders the real diff of the edit contents inside the native approval card. Through dsh-diff-view, the diff display includes:
* Line-level diffs: Shows the modified lines.
* Word highlighting: Highlights specific word differences within changed lines.
* Disk source context: Displays the file contents with real line numbers, providing the surrounding context.

View and Operation Types

  • View switching: Supports split or unified views (GitHub-style switching); in split view, deleted lines are shown on the left and added lines on the right.
  • Write operation: When using the write command, new content is displayed as additions and merged with the existing file.
  • Deletion operations: For deletion commands (such as rm), a review notice is rendered, showing only the command text and not displaying the deleted content.

Approval Flow Optimization

  • Diff anchoring: The diff is anchored to DISK TRUTH (the disk state obtained from the package’s main route at request time), ensuring the review is based on the current file state.
  • Stale operand warning: When the old text being edited no longer exists in the file, the card displays a warning instead of showing a diff that cannot be applied.
  • Merged review: Queued edits to the same file are merged into a single review. If multiple pending edits exist for the same file, the card displays “N edits merged” and renders all changes merged into the disk copy.
  • Multi-file support: When a request involves multiple files, the card displays tabs, one per file, each containing independent merged diffs and independent approval buttons.

Installation and Enablement

This plugin requires a checkout of DeepSeek Harness (DSH) and a profile (web is used in the example). Follow these steps:

  1. Clone the plugin repository
    mkdir -p ~/dsh-plugins && cd ~/dsh-plugins
    git clone https://github.com/joao-paulo-santos/dsh-approval-diff.git
  1. Install the plugin
    pnpm dsh plugin --profile web add ~/dsh-plugins/dsh-approval-diff
  1. Verify the configuration
    pnpm dsh --profile web --dump-config
  1. Restart Harness
    After installation, you need to restart Harness. The host side loads it at startup, while the client side hot-reloads it.

Use Cases and Limitations

  • Use cases: File-change approval only (edit, write, and bash for deletion only). Operations of other types fully fall back to the native card.
  • Dependency requirements:
    • The dsh-diff-view dependency must be installed.
    • DSH version 0.1.2 or higher is required (based on the pending interactive approval model).

Summary

dsh-approval-diff solves the problem of reviewing file changes in DSH’s native approval card by providing intuitive code difference review. It improves review efficiency for bulk edits through merged reviews and view optimization.