Back to home@HaoyueQin

dsh-diff-stat

DeepSeek Harness web plugin: inline +N −M diff badges on edit/write tool rows and a per-turn file change summary card. Scroll-windowed diffs, PTC/code-dispatch fallback, undo — no git required.

Stars
0
Language
TypeScript
Created
Aug 24, 2026
Updated
Aug 25, 2026
GitHub repo

Introduction

DSH Diff Stat

English | 中文

dsh plugin npm npm downloads dsh platform License: MIT i18n

A DeepSeek Harness Web plugin: inline +N −M badges on edit/write tool rows plus a per-turn file change summary card. Full unified diffs on click. Code Dispatch (PTC) nested sub-calls work via argument fallback — no wire diff view required. No git dependency, no third-party plugin dependencies.

Features

  • Inline +N −M badges: takes over the stock edit/write rows (keyed lower-priority shadow; uninstall restores stock automatically). Counts show while running from the argument-derived estimate, then switch to the exact result-view hunks on settlement
  • Full diff on click: expands a unified diff rendered through the stock DiffBlock primitive (16-line capped collapse, copy, └ +A -R footer, theme tokens)
  • Per-turn summary card: a collapsible "N files changed +X −Y" bar at each turn's tail; expands to per-file rows (per-type file icon · name · directory · ±lines · review · open | ▾). Same-file edits within a turn merge and accumulate
  • PTC / Code Dispatch fallback: nested sub-calls carry no wire diff views; the plugin derives the call-time diff from the tools' own presentCall semantics (edit's old→new, write's whole-file create). rootCallId+subCallId dedup keeps replays from double-counting
  • Undo: reverts the turn's files to their pre-turn state — reverse uniqueness-checked hunk peeling, deletes files the turn created, rejects drifted files before writing, atomic commits
  • Inline view: clicking "open" expands a height-capped file content window below the row (16-line collapse, the stock DiffBlock interaction); the "▾" menu keeps every open-with route
  • Context folding: before rendering, each hunk's sides are LCS-aligned — shared lines become ±3 lines of context around the change and untouched runs fold into ⋯; badge and footer totals stay full-scope
  • Frosted glass (optional): when deepseek-harness-background is installed, every plugin surface joins its shared glass recipe — the diff window, file preview and row IN/OUT card in token mode, the turn summary card in fill mode. +/− diff tints get a small glass-on boost so annotations stay legible. Without it everything keeps the stock opaque look — graceful degradation, zero dependencies
  • Open with: system open (the stock openFile), reveal in Explorer, open in VS Code, copy absolute/relative path
  • zh / en: copy follows the Web UI language (locale service)

Screenshots

Expanded diff under the background glassPer-turn card, file row and inline preview
expanded diffturn card and preview

How it works

  • Inline badges: register the edit/write keys of the tool.call.toolview keyed slot at priority −1 (shadows the shipped rows); diff data follows the authoritative chain resultView → callView → argument fallback (a truncated window that dropped the call head still renders from the result view)
  • Turn summary card: a ConversationNodeDefinition accumulator (turn/start / tool/call / tool/result(append) / tool/code-dispatch) publishes Turn data; the conversation.chat.turnTail chain claims rendering — modeled on the official ui-deliverables plugin
  • Host half (optional): a same-origin prefix route serves a fenced API — realpath containment (checked before and after resolution), symlink rejection, UTF-8 round-trip validation, 512 KiB read cap, atomic writes. When the host half is absent the dependent actions hide themselves
  • Frosted glass bridge (optional): a zero-dependency consumer of the background plugin's window.__DSH_BACKGROUND_GLASS__ registry — [data-diff-window], [data-diff-stat-peek], [data-diff-stat-io] in token mode, [data-diff-stat-card] in fill mode. It subscribes to dsh-background-glass:ready (both arrival orders + hot reload); the bridge never appearing leaves the ordinary UI untouched

Install

# from npm
dsh plugin --profile web add dsh-diff-stat

# or from GitHub
dsh plugin --profile web add github:HaoyueQin/dsh-diff-stat

# restart dsh web to take effect
dsh web

Uninstall:

dsh plugin --profile web remove dsh-diff-stat

Development

pnpm install        # devDependencies; prepare builds lib/ automatically
pnpm build          # host half → lib/index.js + browser half → lib/client.js (one tsdown run)
pnpm typecheck      # both halves via tsc
pnpm check:align    # diff aligner assertions (needs Node >= 23.6)

License

MIT