a179-sanae/dsh-auto-collapse
Project Overview项目介绍
dsh-auto-collapse is a native plugin built exclusively for DeepSeek Harness (DSH) that automatically organizes and collapses session context to keep long conversation interfaces clean. It preserves DSH's native first-level turn structure, groups thoughts, tool calls, and injected context into collapsed second-level entries, and shows the original native third-level details only when a second-level entry is expanded. Released versions can be installed directly via the DSH CLI command dsh plugin --profile web add dsh-auto-collapse, and users can also build a tgz package from source and install it locally. After installation, you need to reload the plugin or restart DSH Web and then refresh the page to start using it.
This plugin uses message content as the grouping boundary, so all thoughts, tool calls, and context around the same body of text are grouped into a single second-level work segment, and a new segment is created when new body content appears. By default, all second-level segments are collapsed, and streaming new content will not change the expanded state that a user has already set manually. System prompts are also grouped into adjacent work segments and hidden behind second-level collapse, so they only show when the second-level is expanded. This keeps long contexts from taking excess screen space, ideal for DSH users who want to clean up long conversation histories and keep interfaces uncluttered.
Developing this plugin requires Node.js 22 or higher, and if you want to run browser validation tests, you also need to install Playwright Chromium. Different versions of this plugin correspond to different compatible DSH versions: the 0.2.x version is compatible with the latest DSH 0.1.2-rc.1 and 0.1.5-rc.2, while older plugin versions work with older DSH releases. The plugin is licensed under MIT, it does not modify original message content, does not take over native rendering logic, and keeps native display for any unknown DOM nodes. It also preserves the original expand/collapse state for existing native detail toggles.
dsh-auto-collapse 是专为 DeepSeek Harness(DSH)开发的原生会话上下文折叠插件,用于重新整理对话工作段结构,保留DSH原生一级回合结构,将思考、工具调用、注入上下文等内容整理为默认收起的二级条目,展开二级后才会显示原生顺序的三级详情。已发布版本可通过 dsh plugin --profile web add dsh-auto-collapse 命令一键安装,也可从源码构建tgz安装包后本地安装。安装后需重载插件或重启DSH Web再刷新页面即可使用。
该插件以正文作为分组边界,将同一段正文前后的思考、工具调用、上下文都归入同一个二级工作段,新正文出现后另起新段。默认所有二级段都是收起状态,流式追加内容不会改变用户已经手动展开的条目状态。系统提示词也会归入相邻工作段,隐藏在二级折叠之后,只有展开二级才能查看,避免过长的上下文占用过多显示空间。适合需要整理长会话历史,让对话界面更简洁清晰的DSH用户使用。
开发该插件需要 Node.js 22 及以上版本,如果要运行浏览器端验证测试,还需要安装 Playwright Chromium。不同版本的插件对应不同兼容的DSH版本,0.2.x版本兼容最新的DSH 0.1.2-rc.1 和 0.1.5-rc.2,低版本插件对应旧版DSH。该插件采用MIT许可,不修改原消息内容,不接管原生渲染逻辑,未知DOM节点会保留原生展示方式。
请帮我安装这个 DSH 插件。安装前先完成【兼容性检查 + 安全性检查】,检查通过再动手。
插件:dsh-auto-collapse(a179-sanae/dsh-auto-collapse)
仓库:https://github.com/a179-sanae/dsh-auto-collapse
本站详情页:https://www.yhbd.top/plugins/a179-sanae-dsh-auto-collapse/
本站登记:类型 plugin · 归类 原生 DSH 插件 · 许可证 MIT · ⭐ 64 · 最近提交 2026-09-14 · 主语言 JavaScript
按下面顺序执行,每步先把结论告诉我,再进入下一步:
【1 兼容性检查】
① 我这边:DSH 版本、Node 版本、操作系统、当前 profile(web / desktop)。
② 读它的 README、package.json、插件 manifest,列出它要求的 DSH 版本 / Node 版本 / 操作系统 / 外部依赖 / 需要另外先装的运行时。
③ 逐条比对,结论只写「满足 / 不满足 / 未知」三种;不满足的给出可行替代方案。
④ 检查是否和我已装的插件冲突:命令名重复、skill / tool 重名、端口占用、重复注册的 MCP server。
【2 安全性检查】
① 仓库可信度:和上面「本站登记」是否一致;star / fork 数、创建时间、最近提交,是否归档或长期停更。
② 安装脚本:逐行看 package.json 的 preinstall / install / postinstall,以及 install.sh、setup.ps1 之类脚本。出现 curl|bash、下载后直接执行、混淆代码、访问与插件功能无关的域名,立刻停下来告诉我,不要继续装。
③ 依赖:列出新增依赖,标出无人维护、或与知名包拼写近似的可疑包(typosquatting)。
④ 权限与副作用:它会读写哪些目录、访问哪些域名、需要哪些 DSH 权限(filesystem / network / shell / clipboard 等),以及怎么卸载和回滚。
⑤ 如果它要求 sudo / 管理员权限,或权限明显超出功能所需,先停下来问我。
【3 安装】
上面两步没有「不满足」和「高危项」时才执行;用官方推荐方式安装,不要自行提权。
【4 汇报】
用表格输出:检查项 / 结论 / 依据 / 是否需要我决策。拿不准的一律写「未知」并说明要我怎么确认——不要猜,也不要替我决定。
Send this message to DSH in your current session: it verifies compatibility and security first (answering met / not met / unknown item by item) and only installs once everything checks out — it will stop and ask you if it finds a high-risk item. The box scrolls; the copy is the full prompt. CLI install commands may not be accurate across systems, so DSH is the safer route.把上面这条消息直接发给当前会话里的 DSH:它会先核对兼容性与安全性(逐条给「满足 / 不满足 / 未知」),确认没问题再安装,有高危项会停下来问你。框内可滚动,复制到的是完整提示词;安装命令不一定准确,发给 DSH 更稳。
- This site's static screen found no obvious risk signal (stars, license, activity, manifest)本站静态筛查没发现明显风险信号(星标、许可证、更新活跃度、清单完整度)
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 dsh-auto-collapse
把 a179-sanae/dsh-auto-collapse 加入你的 DSH 配置(web profile)即可启用。
READMEREADME
dsh-auto-collapse
DSH Web 工作段折叠:保留原生一级,把正文之间的思考、工具和上下文合成一个二级;展开后显示原生三级。
展示方式
正文 A
▸ 已思考 · 使用了浏览器 · 已注入上下文 · 编辑了文件
正文 B
▸ 正在运行 npm run check
正文 C
每段只有一个二级入口。思考变成工具调用、工具后追加上下文,都继续归入当前段;新正文出现后,后续工作另起一段。只有思考、只有上下文或单条工具也可以成段。
- 一级:DSH 原生回合摘要。 完成判断、计数、过程正文与最终回答由宿主负责。
- 二级:插件工作段。 工作中可见,展开原生一级后也保留;默认收起,流式追加保持手动展开意图。
- 三级:原生工作行。 二级展开后按原顺序展示思考、工具、上下文;每行自己的详情开合保持原样。

预览来自浏览器验收场景,使用 DSH 0.1.2-rc.1 原生 disclosure、思考和回合摘要组件。
行为
正文是分组边界,同一 assistant-step 内的“思考—正文—思考”也会切开;Markdown 换行不拆组。纯图片、SVG 和其他正文内容保持原生展示。用户消息、steering、不同 turn 和未知语义节点不会被跨越。
原生一级收起时,受它控制的二级入口一起隐藏,但二级状态保留。若上下文位于原生折叠范围之外,仍保留可访问的二级入口;点击展开会按需打开原生一级。Normal 模式没有原生一级时,二级仍生效。
系统提示词也归入相邻的上下文工作段。有明确回合归属时,它跟随原生一级收起;一级展开后先显示二级,展开二级才显示系统提示词的原生行,详情开关保持原样。
工作摘要显示已发生的动作类型和当前运行信息,不复制推理全文。查找隐藏内容时通过 hidden="until-found" / beforematch 展开所属层级。选中、焦点和需要用户输入的工作保持可达。HMR、切换会话或异常恢复会释放插件控制。
设置 → 插件 → 插件配置仍可编辑“状态提示词”,默认 Deep sleeping...。保存空值恢复官方文字;用时后缀保留。该功能独立于分组,服务晚到或重连不会影响二级。
兼容性与升级
| 插件 | 验证的 DSH |
|---|---|
| 0.2.x | 0.1.2-rc.1;0.1.5-rc.2(当前浏览器组件测试夹具) |
| 0.1.8 | 0.1.2-rc.1,旧折叠实现 |
| ≤ 0.1.6 | 0.1.1.x |
0.2.0 完全重写了折叠核心。升级后保留并统一二级,删除自建“已处理 X秒”一级行和三级推理全文副本;上下文不再单独拆成二级。旧 statusText 配置继续使用。未知 DOM 节点保留原生展示,其他宿主版本需要另行验证。
安装
已发布版本可用:
dsh plugin --profile web add dsh-auto-collapse
从源码安装时,先生成完整安装包,再安装命令输出的 tgz:
npm ci
npm run package
dsh plugin --profile web add <生成的-tgz-绝对路径>
安装后按宿主方式重载插件或重启 Web,再刷新页面。回退时安装完整旧版包,例如 dsh-auto-collapse@0.1.8。
npm run package 与兼容别名 npm run deploy 只构建 tgz,不再逐文件覆盖安装目录、读取凭据或自动停止/启动 DSH。
开发与验证
Node.js 22+。首次浏览器验证需要 Playwright Chromium;Windows 可自动使用已安装的 Chrome/Edge,也可通过 DSH_TEST_BROWSER 指定可执行文件。
npm ci
npx playwright install chromium
npm run check
Linux CI 使用 npx playwright install --with-deps chromium 安装浏览器依赖。
npm run test:unit # 纯分组、身份、状态摘要
npm run test:browser # 当前构建的真实浏览器验收
npm run preview # 本地合成场景:http://127.0.0.1:43190
npm run package # artifacts/ 下完整 tgz
修改源码后先 npm run build 再单独运行浏览器测试或刷新预览。npm run check 自动执行 typecheck、构建、单元测试、浏览器测试和安装包检查。
浏览器测试使用真实 React、DSH 0.1.5-rc.2 原生组件快照和当前发布 bundle,覆盖混合分组、同消息正文边界、原生一级、详情状态、搜索、焦点、SVG、异常恢复、设置生命周期及 100/1,000/5,000 个历史节点。pwsh 场景使用官方工具渲染 bundle 和终端组件,覆盖失败重试、错误正文切换及缺失调用头等情况。完整测试还包含 30 秒无轮询检查。fixture 不依赖用户会话或凭据;完整后端部署不在隔离 fixture 的验证范围内,详见 夹具说明。
代码结构
| 文件 | 职责 |
|---|---|
src/work-model.ts / host-contract.ts |
识别正文边界和原生工作项,缓存宿主结构 |
src/work-groups.ts / summary.ts |
纯分组规则、稳定身份、二级展开意图和动作摘要 |
src/dom-view.ts / styles.css |
唯一二级入口、受限显隐、恢复和样式 |
src/controller.ts / scheduler.ts |
脏工作段协调、原生一级联动、生命周期 |
src/status-text.ts / settings.ts |
独立状态文案及设置卡 |
src/client.ts / index.ts |
客户端与宿主接线 |
不修改消息内容,不移动原生节点,不接管原生 renderer,不推断 final,不扫描“空 div”,不回写主滚动容器。
许可
MIT。测试中的原生组件快照保留 DeepSeek 的 MIT 许可。
liangmianya/dsh-synapse
alaliqing/claude-paper
acryldev/acryl
omdsh-dev/dsh-annotation
Anionex/dsh-turn-rewind
Tyan66666/billion-context-dsh
qkycir-123/dsh-run2skill