Plugin directory / Developer / dsh-turn-diff
dsh-turn-diff
Verified · install-tested on dsh 2436238575
What it does
(no description)
Works — verified, early-stage project
(no description) It installs cleanly and boots without issues in our testing. It's early-stage but functional.
“Verified” means our automated CI actually ran dsh plugin add in a clean profile and it booted — nothing more. Feature descriptions and version compatibility are the author’s claims. This is not a security audit and not an endorsement of third-party code.
README
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 模式运行
安装步骤
``sh
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 安装(发布后):
`sh
dsh plugin --profile web add dsh-turn-diff
`
重启后,每轮对话结束时即可看到改动汇总面板。
卸载
`sh
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
MITInstall
Install the catalog once, then DeepSeek Harness can find and install any plugin from this site automatically:
dsh plugin add dshbase-catalog Then say "install dsh-turn-diff for me" — your agent finds it in the directory and installs it. Docs: dshbase-catalog · verified packs.
Web profile:
dsh plugin --profile web add dsh-turn-diff Headless (CLI) profile:
dsh plugin --profile headless add dsh-turn-diff Package
npm: dsh-turn-diff · version 0.1.0 · tested on dsh 0.1.0-rc.6
Test report
Verified end-to-end: L1 install + L2 load + L3 runtime Q&A on dsh 0.1.0-rc.6.
When to use it
Extend the agent's coding surface — give it a new tool, workflow, or integration so it handles a dev task it couldn't before.
Who it's for
Developers who want dsh to behave like a teammate on real codebases — editing, running, and verifying changes rather than just answering.
For developers — extending it
The tool/command surface is the seam: expose more of the SDK, add smarter context wiring, or tighten the loop between code changes and verification.