DeepSeek Harness plugin

dsh-webui-perf

WebUI 性能优化开关:设置面板一键开/关长代码流式渲染、历史加载、高亮/KaTeX/渲染缓存等优化

Jump to install

Source facts

Repository
awa-123-cw/dsh-webui-perf
Latest update
Aug 15, 2026
Category
Memory
GitHub stars
2
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/awa-123-cw/dsh-webui-perf
Plugin: dsh-webui-perf
Author: awa-123-cw

Check the source files

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

File explorer2 files
README.mdSource · read only

dsh-webui-perf 🐳⚡

DeepSeek Harness Web GUI 性能优化开关插件:长代码流式渲染、历史加载、语法高亮/公式/渲染缓存的优化,全部收敛到一个设置面板开关,随时一键开启或回退原始实现。

✨ 优化内容(开关开启时生效)

场景优化
流式输出长代码未闭合代码块增量解析(每帧只处理新增字节,O(n²)→O(n))
长代码写完瞬间大代码块(>3000 字符)改空闲回调懒高亮,不再同步阻塞主线程
载入长历史会话增量可见性判断(去掉每 chunk 的全文本 trim/rope 展平);工具调用树深度检查去 BFS
长思考(Think 块)展开正文 100ms 节流更新,折叠摘要保持实时
重复渲染shiki 高亮 / KaTeX / settled markdown 渲染三层 LRU 缓存
读大文件ReadBlock 折叠时只高亮可见窗口(head/tail 16 行)
内存/显存消息列表 content-visibility(离屏行跳过渲染/布局,长会话内存有界 + 滚动流畅);历史图片缩略图降采样到 ≤640px + 可见性门控(离屏图不加载);缓存上限收紧(>64KB 不缓存)
主动内存清理右上角常驻 系统可用/总内存指示 + 🧹/♻️ 双档清理(PCL「内存优化」的 WebUI 对应):🧹 由 host 执行系统级 PowerShell 清理(EmptyWorkingSet 清 dsh 自身 + Edge 缓存进程 + 页面缓存/GC);♻️ 二次确认后深度清理(清所有 Edge 渲染进程工作集 + 刷新页面),实测 Edge 渲染进程单次释放 405MB(多标签可达数 GB)

实测:打开长代码历史会话的主线程冻结从 8.3s → 0.3s(-96%)。

📦 结构

dsh-webui-perf/
├── package.json            # 插件清单(host + client 双面)
├── cordis.patch.yml        # bundle patch(挂载到 web profile)
├── lib/
│   ├── index.js            # host half:注册 webui-perf 设置命名空间
│   └── client.js           # 浏览器 half:设置开关行 + localStorage/事件广播
└── patches/
    ├── dsh-webui-perf.patch        # 对 deepseek-harness 源码的补丁(git apply)
    ├── apply-patches.mjs           # 源码补丁应用/回滚脚本
    ├── apply-runtime-patches.mjs   # 已安装环境的运行时补丁(api-proxy allowlist)
    └── check-patches.mjs           # 补丁健康检测(升级后必跑)

> 为什么需要补丁:优化代码在官方包内部(ui-primitives 是 shell 平台模块、ui-conversation/ui-trajectory 是官方 client bundle,插件无法替换),因此优化以带开关的源码补丁形式随插件发布;插件本体负责开关 UI 与状态广播(localStorage + dsh:webui-perf-change 事件,cordis-free 通道)。关闭开关即回退官方原始实现。

🚀 安装

1. 应用官方包补丁

方式 A:源码构建(推荐,可长期维护)

# 在 deepseek-harness 源码 checkout 里
git clone --depth 1 https://github.com/deepseek-ai/deepseek-harness.git
cd dsh-webui-perf/patches
node apply-patches.mjs <源码路径>      # git apply --check + apply(自动备份语义,可 --reverse 回滚)

# 重新构建
cd <源码路径>
npm run build:lib:client
pnpm --filter @deepseek-ai/dsh-web-frontend run build
# 部署 dist 到 dsh-web-frontend/dist,lib/client.js 到各 client 包 lib/

方式 B:已安装环境(免构建)

node patches/apply-runtime-patches.mjs    # 打 api-proxy allowlist(自动备份)
# 再把构建好的 dist 与 client bundle 部署到 node_modules 对应包

2. 安装插件本体

dsh-webui-perf 加入 web profile:

// D:\dsh\profiles\web\package.json
{
  "dependencies": { "dsh-webui-perf": "link:D:/dsh-plugins/dsh-webui-perf" },
  "dsh": { "profile": { "bundles": [ /* ... */, "dsh-webui-perf" ] } }
}

(或使用 super-injector 的 dev_install_package 热装配。)

3. 重启 dsh

dsh web

🎛️ 使用

设置 → 通用 → WebUI 性能优化 开关:

  • :全部优化生效(默认)
  • :立即回退官方原始实现(无需刷新页面)

开关状态持久化在用户设置文档(webui-perf.enabled),切换通过 localStorage + CustomEvent 实时广播给运行中的优化代码。

↩️ 回滚

# 源码补丁回滚
node apply-patches.mjs --reverse <源码路径>

# 运行时补丁回滚
node patches/apply-runtime-patches.mjs --reverse

# 插件移除
# 从 profile package.json 的 dependencies/bundles 移除 dsh-webui-perf,重启即可

🔍 升级后检测(重要)

dsh 官方升级会覆盖 node_modules 产物,补丁可能悄悄失效(开关不再起作用,且设置面板会显示「补丁缺失」警告)。升级后请运行健康检测:

node patches/check-patches.mjs          # 检测三类补丁痕迹(allowlist / client bundle / dist)
node patches/check-patches.mjs --fix    # 缺失时自动重打 api-proxy allowlist

检测项: 1. api-proxy allowlist 是否仍含 webui-perf(设置开关暴露的前提) 2. ui-conversation / ui-trajectory client bundle 是否含优化开关代码 3. web dist(index.html 实际引用的 chunk)是否含 ui-primitives 优化代码

检测结果也实时显示在设置面板:官方补丁缺失时,开关行变为红色警告(「补丁缺失:请重跑 patches/apply-runtime-patches.mjs 后重启 dsh」),不会假装生效。

✅ 兼容性

  • deepseek-harness 0.1.0-rc.5 / 0.1.0-rc.6
  • 随插件附带的 1021 项官方测试全部通过(ui-primitives / ui-conversation / ui-trajectory)

📄 License

MIT