DeepSeek Harness 插件

nuscior/dsh-long-message-fold

Star 数 ★ 0 分类 UI 增强 收录于 2026-12-02

把对话里过长的用户消息折叠成固定高度,气泡右下角的小箭头可展开/收起。只改显示,模型收到的仍是完整原文。

安装

# GitHub 源码(首次需按提示配置 allowBuilds 构建授权后重试)

dsh plugin --profile web add github:nuscior/dsh-long-message-fold

装任何插件都等于在你的机器上跑第三方代码,权限和你本人一样大——能读你的文件、用你的凭据、访问网络,工具审批管不到它。GitHub 来源的插件还会在安装时执行构建脚本——pnpm 默认拦截,所以安装可能停在 ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED 或 ERR_PNPM_IGNORED_BUILDS;dsh 会打印出需要添加的确切键名,把它加进该 profile 的 pnpm-workspace.yaml 的 allowBuilds 下,重跑一次即可装上。放行构建本身就是一次信任判断:请只安装可信来源,并尽量锁定 commit(github:owner/repo#sha)。

README

DeepSeek Harness 插件:对话里过长的用户消息自动折叠成固定高度,气泡右下角出现一个小箭头,点一下展开全文,再点收起。

只改显示。模型收到的仍然是完整原文,上下文、token 数、导出记录都不受影响。

icon

行为

  • 可见字符数达到 600 才开始折叠,短消息完全不受影响(阈值写死在 client.js 的 MIN_CHARS)。
  • 折叠后高度限制为 320px,约十到十二行正文(CLAMP_PX)。
  • 箭头绘制在气泡右下角,跟随气泡流式增长重新定位;有 aria-label 和 aria-expanded,键盘可操作。
  • 中英文文案跟随宿主语言;拿不到 locale 时回退中文。

安装

DSH 0.2.2-rc.1 及以上。

  • 插件市场:在 插件 → 插件市场 里搜索 dsh-long-message-fold。

  • 发现(索引源):添加本项目所在的索引源,再点安装。

  • 手动:在 profile 目录执行

    dsh plugin --profile <profile> add github:nuscior/dsh-long-message-fold
    

装完在 插件 → 已安装 里确认出现「长消息折叠」,然后开新会话生效。

兼容性

  • 在 DSH 0.2.2-rc.5(Desktop,profile desktop)上验证。
  • 包内声明 engines.dsh: ">=0.2.2-rc.1";更早的版本未测试,安装时会被拦下。
  • 纯 Client 模块,无 Node 依赖、无构建脚本、无网络请求。

实现方式

Host 半部分是空的(index.js 只有 export function apply() {}),渲染全在 Client 模块:

  • 通过 ctx.slots.inject('conversation.chat.user.before') 注册到每条用户消息前的插槽,只对 owner.kind === 'user' 的行渲染。
  • 用 MutationObserver + ResizeObserver 找到同一行里的 [data-message-bubble],给它加 data-ltf-collapsed 属性,CSS 靠这个属性做 max-height 截断,不替换、不改写宿主渲染出来的 DOM 结构。
  • 卸载时移除属性、移除注入的 <style>、恢复被临时设成 position: relative 的行。

已知限制

  • 依赖宿主把消息气泡标记为 [data-message-bubble]。DSH 大版本改动这层结构后可能失效,届时需要跟着更新。
  • 同时修改消息气泡的其它插件理论上可能互相干扰(都在这层 DOM 上做标记)。
  • 折叠高度和字符阈值目前不可配置,改的话在 client.js 顶部两个常量。

License

MIT,见 LICENSE。


English

A DeepSeek Harness plugin that collapses long user messages in chat to a fixed height and adds a small chevron in the bubble's bottom-right corner to expand or collapse them.

Display only — the model still receives the whole message, and nothing about the stored transcript changes.

  • Folds only when the visible text reaches 600 characters; collapsed height is 320px.
  • Renders through the conversation.chat.user.before slot and tags the shipped [data-message-bubble] element with data-ltf-collapsed; the host's DOM structure is not replaced.
  • Client-only: no Node dependencies, no build step, no network access.
  • Verified on DSH 0.2.2-rc.5; engines.dsh is >=0.2.2-rc.1.

Install from the plugin market, from an index source, or with dsh plugin --profile <profile> add github:nuscior/dsh-long-message-fold.

内容来自项目 README(GitHub)↗

链接

同类插件

查看整个分类 →

社区评论

评论公开保存在 GitHub Discussions。加载评论会连接 GitHub 和 Giscus;发表内容需要 GitHub 账号。