lehhair/dsh-diff-viewer 预览 preview

lehhair/dsh-diff-viewer

DSH Web GUI PiUI风格差异查看器插件:通过ui-tool diff-card链式插槽替换写入/编辑工具调用的默认DiffBlock(包含主机补丁)。私有。

Project Overview项目介绍

This is a native plugin built exclusively for DeepSeek Harness (DSH), serving as a PiUI-style diff viewer for the DSH Web GUI. It replaces the default DiffBlock diff rendering for the built-in write and edit tool calls, adding a range of quality-of-life improvements for viewing generated code changes. It includes support for real file line numbers, word-level change highlighting, context folding for long unchanged sections, and windowed rendering for very large diffs. It also supports nested write and edit calls within PTC/Code Dispatch, correctly handling rendering for child tool calls without breaking core DSH functionality.

The plugin works by hooking into DSH's open keyed tool rendering slot, registering for the edit and write tool keys at a lower priority than the default renderer. It fully reuses DSH's official core components like ToolRow styling and DisclosureRow elements, only swapping out the expanded diff card for the new PiUI-style DiffViewer. It does not modify any core DSH code, so uninstalling the plugin immediately restores the original default diff rendering behavior. It also recalculates real starting line numbers for each diff hunk and passes them to the rendering layer, safely falling back to hiding line numbers for old sessions or nested calls without stored line number metadata.

Two official installation methods are documented: you can install directly from the GitHub repository via the DSH CLI command dsh plugin --profile web add "github:lehhair/dsh-diff-viewer", or install the pre-built tarball from the latest GitHub Release. To develop the plugin from source, you need a local checkout of the DSH core repository, use pnpm to install dependencies and run the build check, and built outputs are committed to the lib directory of the repo. Uninstalling is done via the DSH CLI as well, with a simple dsh plugin --profile web remove @dsh-external/dsh-diff-viewer command that cleans up all plugin files.

这是一款专为DeepSeek Harness(DSH)打造的原生插件,是DSH Web GUI的PiUI风格差异查看器,用于替换write/edit工具调用默认的DiffBlock差异渲染。它支持统一单栏/拆分双栏行号显示、真实文件行号标记、变更条标记、行内词级高亮、未变更上下文折叠、大差异窗口化渲染,同时还支持PTC/Code Dispatch的嵌套调用处理。

插件通过keyed接管方式替换write/edit的工具行渲染,以更低优先级注册对应按键,仅替换展开后的差异卡片为PiUI风格DiffViewer,不修改DSH核心代码,属于纯插件实现,卸载后即可恢复官方默认渲染。它会重新计算hunk的真实起始行号并透传到渲染层,对缺失行号信息的旧会话或嵌套调用会安全降级隐藏行号。

插件支持两种官方安装方式,可通过GitHub仓库直装,也可安装GitHub Release自动构建的压缩包,安装后重启DSH Web即可生效。开发需依赖本地检出的DSH源码,使用pnpm管理依赖和执行构建,构建产物已提交到仓库的lib目录。卸载可通过DSH官方插件命令直接移除,不会残留额外配置。

Pre-install check安装前体检Compatibility · Security兼容性 · 安全性 1 warning1 项注意
  • No license declared - all rights reserved by default; ask the author before commercial use or redistribution未声明开源许可证 —— 默认「保留所有权利」,商用或再分发前先问作者
  • 26 stars - an early-stage project星标 26,属于早期项目
DSH walks through these 9 checksDSH 会逐条核对这 9 项

Compatibility兼容性

  • DSH, Node, OS and profile requirementsDSH 版本 / Node 版本 / 操作系统 / profile 是否满足要求
  • External dependencies and runtimes (Electron / Python / Docker, ...)外部依赖与运行时(Electron / Python / Docker 等)是否齐备
  • Conflicts with installed plugins: command names, skill / tool names, ports, duplicate MCP registration与已装插件是否冲突:命令名、skill / tool 重名、端口占用、重复 MCP 注册

Security安全性

  • Repo matches the facts registered here; archived or abandoned?仓库是否与页面登记一致,是否归档或长期停更
  • Safety of preinstall / install / postinstall and install.sh / setup.ps1preinstall / install / postinstall 与 install.sh、setup.ps1 是否安全
  • curl|bash, download-then-execute, obfuscation, unrelated domains → stop immediatelycurl|bash、下载即执行、混淆代码、无关域名 → 立刻停止
  • Typosquatting or unmaintained packages among the new dependencies新增依赖里有没有 typosquatting 或无人维护的包
  • Requested permissions vs. what the feature actually needs申请了哪些权限、是否超出功能所需(filesystem / network / shell / clipboard)
  • Any sudo / admin requirement, plus uninstall and rollback是否要求 sudo / 管理员权限,以及卸载与回滚方式

Anything uncertain must be marked unknown with a note on how to confirm it. This site's signal screen is a static snapshot, not a security audit.拿不准的必须标「未知」并说明要我怎么确认。本站的信号筛查是静态快照,不能替代安全审计。

Or use CLI install (for developers)或使用命令行安装(适合开发者)

CLI Install命令行安装

dsh plugin --profile web add "github:lehhair/dsh-diff-viewer"

把 lehhair/dsh-diff-viewer 加入你的 DSH 配置(web profile)即可启用。

READMEREADME

dshfind

dsh-diff-viewer

DSH Web GUI 的 PiUI 风格 diff 查看器插件:替换 write/edit 工具调用的 diff 渲染(原 DiffBlock)。

  • 统一/并排行号:unified 单栏默认(同一 gutter 并排显示旧/新行号),split 双栏可选(viewMode)
  • 真实文件行号:已完成的 edit/write 顶层调用,行号 gutter 显示文件中的真实行号(GitHub 式 @@ 位置),不是片段内 1..N 重新计数;新建文件(create)显示 1..N
  • 变更条:新增实心绿条、删除条纹红条;行背景色带统一延伸到最宽行
  • 词级高亮:行内改动叠加绿/红标记,shiki 语法着色(highlightLines)
  • 上下文折叠:长段未变更行折叠为"N 行未变更",向上/向下/全部展开
  • 窗口化渲染:固定行高窗口化,大 diff 不挂载全部行;sticky 横向滚动条(hover 显现)
  • 复制 + └ +A -R · N file(s) 页脚
  • edit 结果默认展开:settled 的 edit 结果卡展开即见替换 diff(write 保持默认收起)
  • PTC/Code 嵌套支持:Code Dispatch 内的 write/edit 子卡片同样接管——嵌套子调用核心短路 meta(exec.parent 时不执行 presentationMeta),插件按工具参数推导调用时 diff(edit 的 old_string→new_string、write 的整文件新增),错误子调用保持通用错误路径

机制

插件通过 keyed 接管替换 write/edit 的工具行渲染:ui-tool 的 tool.call.toolview 槽是开放 key 域,同一 key 以更低 priority 阴影(最低优先渲染)。插件注册 edit/write 键(priority -1),接管后的行完全复刻官方 FileMutationRow(复用官方 ToolRow 样式 + DisclosureRow/StateDot 等平台组件),只把展开后的 diff 卡换成 PiUI 风格 DiffViewer——不改任何核心,纯插件,卸载即还原官方行。

  • 真实行号机制:核心的 FileDiff 契约只有 { path, oldText, newText },工具执行时 hunk 的真实起始行(structuredPatch 的 oldStart/newStart)被核心丢弃。插件的 host 半(lib/index.js)监听 agent/created,在每个 agent 自己的 layer 上 re-register 一份 edit/write shadow 定义(官方 schedule 插件同款模式):schema/render/execute 全部原样复用原定义(...original),只替换 output.presentationMeta 为带行号的版本——用与核心相同的 structuredPatch(context 3)复算 hunk,把 oldStart/newStart 镌进 meta 的 diffs。零额外 diff 计算(同一次 structuredPatch 多带两个字段),文件读写语义不变(execute 引用原闭包)。
  • 行号透传:oldStart/newStart 随 tool/result 的 meta 落盘,穿过核心 diffsFromMeta 的窄化(只校验三个固定字段、额外字段原样保留)与插件自身的 narrowDiffs(畸形值拒绝),到达 DiffViewer 渲染真实行号。
  • 无锚点安全降级:老会话日志(meta 无行号)与 PTC 嵌套子调用(核心在 exec.parent 存在时短路 presentationMeta,meta 恒缺失)没有锚点 → 行号 gutter 隐藏(回到无行号的 diff 块),绝不显示编造的假行号。create(oldText: null)的 newText 即整个新文件,1..N 真实 → 显示。
  • 不限制高度:展开的 diff 直接撑开显示完整内容(不套滚动容器),窗口化渲染保证超大 diff 依然高效
  • diff 数据(dsh 0.1.2+ 契约):Host 的 presentCall/presentResult 视图不再进入 Client,diff 卡完全从原始事件字段派生——running 用参数推导的调用时 diff(edit 的 old_string→new_string、write 的整文件内容),settled 用 tool/result 落盘的 meta.diffs(应用后的 hunks,即行号所在的通道);执行错误走官方行的错误摘要 + IN/OUT 卡
  • 嵌套兜底:Code Dispatch 子调用(PTC 模式)的 meta 恒缺失(同上),插件回退到参数的调用时 diff——与官方行渲染同一调用的 running 态一致

Showing the opening section of the README — the full document lives in the repository以上为 README 开头摘要,完整文档在仓库内 · View the full README on GitHub →在 GitHub 查看完整 README →

← 上一个 Prev dsh-balance 下一个 Next SmartMoney-Cub →