DeepSeek Harness plugin

dsh-turn-diff

DSH Web UI 插件:每轮结束时汇总本轮所有文件修改差异

Jump to install

Source facts

Repository
2436238575/dsh-turn-diff
Latest update
Aug 21, 2026
Category
Tools & Capabilities
GitHub stars
0
Format
plugin
Catalog evidence
Upstream dsh.bundle evidence
Evidence path
package.json#dsh.bundle
Checked against
0.1.0-rc.8
Upstream check date
2026-08-20

This evidence comes from the upstream catalog. This site has not installed, run, or security-reviewed the plugin.

Install

Start with a prompt that asks an agent to review the GitHub repository and source. Switch to the command if you want to install it yourself.

Copy this prompt into DSH, Codex, or another agent and ask it to review the GitHub repository and source first.

Do not install or run any commands yet. Read this plugin's GitHub repository, README, and relevant source code. Then answer the questions below clearly and directly so I can decide whether it fits my needs:

1. What is this plugin, and what problem does it solve?
2. Who is it for, and what are its typical use cases?
3. How is it used after installation? Include one minimal example.
4. What known limitations or privacy, security, compatibility, or maintenance risks does it have?
5. Give a clear recommendation: recommend, conditionally recommend, or do not recommend, with reasons.

Distinguish statements documented by the repository, inferences from source code, and unknowns. If evidence is insufficient, say so explicitly. Do not guess or simply repeat the README.

GitHub: https://github.com/2436238575/dsh-turn-diff
Plugin: dsh-turn-diff
Author: 2436238575

Check the source files

Read the README and other files from this plugin directory before installing.

File explorer2 files
README.mdSource · read only

dsh-turn-diff

> 此插件由 AI 生成,未经人工代码审查(Code Review)。使用前请自行审查源码,确保符合你的安全要求。

DeepSeek Harness (DSH) Web UI 插件:每轮对话结束时,汇总本轮所有文件修改差异

效果

在每轮对话最后一条 assistant 消息下方,新增一个可折叠的"改动汇总"面板:

  • 折叠状态:显示 N 个文件 · M 处修改
  • 展开状态:按文件分组展示所有 Write/Edit 调用的 diff hunk
  • 每个文件路径可点击,通过宿主的文件打开器直接跳转
  • 使用 DSH 内置的 DiffBlock 组件渲染,与工具调用内联 diff 样式一致

动机

DSH 已有 ui-deliverables 插件,在每轮结束时显示"修改了哪些文件"的文件芯片清单。但没有一个地方能一次性查看本轮所有改动的 diff 内容——你得回到对话流里,逐个展开每个工具调用的 diff 卡片。

本插件补上这个缺口:数据来源与 ui-deliverables 相同(工具自身的 diff 渲染意图),但把所有 hunk 按文件合并,在一个面板里展示。

构建产物:

  • lib/index.js (0.4 KB) — Node 端插件入口
  • lib/client.js (12.4 KB) — 浏览器端 bundle(__ModuleLoader__.load 格式)
  • lib/types/ — TypeScript 类型声明

安装

前提

  • DeepSeek Harness >= 0.1.0-rc.5(已验证 rc.5 构建通过)
  • dsh web 模式运行

安装步骤

# 1. 克隆仓库到 harness 的 workspace 同级目录,或直接放在 harness 仓库目录下
git clone https://github.com/<你的用户名>/dsh-turn-diff.git
cd dsh-turn-diff

# 2. 暂时将插件注册为 harness 的 workspace 成员,以便依赖解析
#    编辑 <harness>/pnpm-workspace.yaml,在 packages: 列表末尾添加一行:
#    注意缩进,与 `- vendor/*` 对齐
#      - dsh-turn-diff

# 3. 在 harness 根目录安装依赖
cd <harness-root>
pnpm install --no-frozen-lockfile

# 4. 构建插件
pnpm --filter dsh-turn-diff run build

# 5. 安装进 web profile
dsh plugin --profile web add link:$(pwd)/dsh-turn-diff

# 6. 重启 dsh web
dsh web

或者直接从 npm 安装(发布后):

dsh plugin --profile web add dsh-turn-diff

重启后,每轮对话结束时即可看到改动汇总面板。

卸载

dsh plugin --profile web remove dsh-turn-diff

重启 dsh web 即可。

架构

dsh-turn-diff/
├── cordis.patch.yml       # bundle 入口:挂载 node 端和 client 端插件
├── src/
│   ├── index.ts           # Node 端(无操作,仅作为插件入口)
│   ├── invariant.ts       # 运行时不变式
│   └── client/
│       ├── index.ts       # 浏览器端入口:注册节点和槽位
│       ├── turn-diff.ts   # ConversationNodeDefinition:聚合 tool/result diff 数据
│       ├── TurnDiffPanel.tsx   # React 组件:可折叠的差异面板
│       └── TurnDiffPanel.module.css
├── tsconfig.json
├── tsdown.config.ts
└── package.json

数据流

tool/result (card: 'diff', diffs: FileDiff[])
    │
    ▼
turnDiffDefinition.match()  → 匹配 turn/start 和 tool/result
    │
    ▼
turnDiffDefinition.update() → 合并 hunk 到按路径索引的状态
    │
    ▼
turnDiffDefinition.buildLocationData() → 发布 turn-diff 到回合数据 { files: [...] }
    │
    ▼
TurnDiffPanel 从 turn.data.get('turn-diff') 读取 → 渲染展开/折叠面板

依赖

  • @deepseek-ai/dsh-client-runtime — 会话节点和数据存储
  • @deepseek-ai/dsh-client-ui-conversation — turnTail 槽位
  • @deepseek-ai/dsh-client-ui-slots — 槽位注册
  • @deepseek-ai/dsh-client-ui-primitives — DiffBlock 组件
  • @deepseek-ai/dsh-tools/presentation — FileDiff 类型
  • react / clsx — UI 渲染

已知限制

  • diff 仅覆盖 Write/Edit 工具调用:通过终端命令间接修改的文件不在统计范围内(与 ui-deliverables 一致,因为 presentResult 产生的 diff 视图只在这些工具上定义)
  • 回放/历史页面:通过 viewFor 函数重算视图,应该能正常渲染;但如果某个工具在回放时没有注册,view 会缺失
  • 默认不编译:需要先 pnpm run build 再安装

License

MIT