DeepSeek Harness Plugin

daisydeng17-hash/dsh-quote-plugin

Stars ★ 0 Category UI Enhancements Added 2026-12-01

Annotate passages of a DSH conversation — select text, write a comment, send several annotations with one message, and read them back as a collapsed card.

Install

# from GitHub (first run asks for allowBuilds approval — follow the hint, retry)

dsh plugin --profile web add github:daisydeng17-hash/dsh-quote-plugin

Any plugin you install runs third-party code with your own permissions — it can read your files, use your credentials, and reach the network, and tool approvals don’t sandbox it. GitHub-sourced plugins also run build scripts at install time — pnpm blocks those until you allow them, so an install can stop with ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED or ERR_PNPM_IGNORED_BUILDS; dsh prints the exact key to add under allowBuilds in your profile’s pnpm-workspace.yaml, and the install works on the next run. Allowing a build is a trust decision: only install sources you trust, and pin a commit (github:owner/repo#sha).

README

This plugin publishes its README in Chinese only.

在 DSH 对话里划词注释:选中一段文字 → 写一条评论 → 变成带编号的注释;多条注释一起随消息发出,发送后消息里折叠成「N 条注释」卡片,悬停展开「所选文本 / 用户评论」的对应关系。

交互

动作 结果
划选对话里的文字 选区上方浮出「添加评论」
鼠标停在某条消息上 右下角浮出「注释整条」,把整条消息作为引用
点它 浮出多行评论框(Enter 换行,Ctrl/⌘+Enter 或 ✓ 确认,Esc 取消)
确认 选区旁出现编号圆标 1 2 3…,输入框上方出现一枚引文胶囊 ❝ 选中片段 ×
再划选、再确认 追加下一条,编号在会话内连续
点胶囊 / 点圆标 就地打开「第 N 条注释」编辑框:看所选文本、改评论、回到原文、删除
点胶囊上的 × 直接删除这条注释
点胶囊行末尾的 ⋯ 菜单:切换发送方式、清空全部注释
正常发送(Enter 或发送按钮) 我接管这一下:先把注释块写进消息,再提交
输入框上方的「随消息发送」 同样效果,作为显式入口

输入框上方只排胶囊(不再有重复的「N 条注释」统计胶囊),注释多了会换行;胶囊只显示前 12 个字,悬停看全文。

发出去的消息长什么样

正文在前,注释块在后:

我按你说的改了三处,第 2 条再确认下。

:::annotation
[1] 我在当前对话里看不到 Autoclaw 的独立会话记录 ⇢ 333
[2] Autoclaw 刚才 ⇢ 222
:::

一行一条:[编号] 所选文本 ⇢ 评论;没有评论就只写 [编号] 所选文本。⇢ 是分隔符(选它是因为正常中文里几乎不会出现)。旧的两行式(所选文本: / 评论:)仍能解析,历史消息照样折叠成卡片。

长引用截断(默认开)

消息里只带引用的头 + 尾,中间用 …[中略 N 字]… 标记,模型因此知道自己在读节选:

引用来源 触发阈值 保留
整条消息 > 200 字 前 160 字 + 后 40 字
划词 > 400 字 前 360 字 + 后 40 字
  • 只影响发出去的文本;胶囊、编辑框、面板里始终是全文。

  • ⋯ 菜单可一键关闭(引用截断:关),关闭后按全文发送。

  • 之所以敢截:引用内容本来就在本会话上下文里,模型缺的通常只是「指的是哪一段」,头尾加标记足够定位;真要逐字分析长引文时把它关掉即可。

  • 模型读到的就是这段结构化文本,能逐条对上「哪句评论针对哪段引用」。

  • 你在 Chat 里看到的是折叠的「2 条注释」胶囊(消息气泡内),悬停展开对应表。

  • 换客户端 / 刷新 / 重新打开历史,仍然是同一段文本,注释不会丢。

两种发送方式(可切换)

胶囊行末尾的 ⋯ 菜单里切换:

  • 发送时注入 · 开(默认):草稿保持干净,注释在发送瞬间拼进去。需要拦截一次 Enter / 发送按钮的点击——只在「有未发送注释」时生效,且跳过 Shift+Enter、Ctrl/⌘+Enter、输入法组合中、注释面板内的按键。
  • 发送时注入 · 关:退回保守模式,确认注释时直接把引用块写进草稿(> 原文 + > 评论:…),不拦截任何按键;外观朴素,但零风险。

安装

从 GitHub 安装(推荐)

dsh plugin --profile desktop add github:daisydeng17-hash/dsh-quote-plugin

也可以在插件页 → 添加插件 → 箭头 → 安装第三方插件,把 github:daisydeng17-hash/dsh-quote-plugin 填进包名框。

装完点 立即启用;没反应就刷新页面。想固定版本可写成 github:daisydeng17-hash/dsh-quote-plugin#<commit>。

本地开发(可选)

想改代码调试时,才需要这一节:把仓库克隆下来,直接装克隆目录。

dsh plugin --profile desktop add "C:\path\to\dsh-quote-plugin"

这种方式 profile 里是 link: 软链,改完刷新页面即生效;代价是别删或移动那个目录,否则插件会加载失败。普通用户用上面的 GitHub 方式安装,不涉及软链。

卸载

插件页 → 已安装插件 → dsh-quote-plugin → 卸载;或:

dsh plugin --profile desktop remove dsh-quote-plugin

结构

文件 作用
package.json 包清单:dsh.bundle.patch 指向 profile patch 层,dsh.client 声明浏览器半侧
cordis.patch.yml 启用时向 profile 插入一行 dsh-quote-plugin
lib/index.js Host 半侧:空实现(全部逻辑在浏览器)
lib/client.js 浏览器半侧:划选采样、评论框、编号圆标、胶囊行、面板、发送注入、消息内注释卡
test/smoke.mjs 无浏览器冒烟测试:bundle 注册、依赖面、三处注册、注释块格式往返

用到的扩展点

  • conversation.input.overlay(list 槽位):输入框上方的胶囊行与面板;
  • ctx.uiConversation.userText.register() + conversation.user.text.node(keyed 槽位):把发送后的注释块渲染成折叠卡片;
  • inputActions.captureInsertion() / insertText() / submit():写草稿与提交,都是公开 API。

安全与隐私

  • 不发网络请求:浏览器半侧没有任何 fetch / XMLHttpRequest / WebSocket / sendBeacon,也不加载远程图片;Host 半侧是空实现(lib/index.js 只有一个空 apply)。
  • 数据只存在本地:注释存在当前浏览器的 localStorage(键前缀 dsh-quote:v1:),发送偏好存在 dsh-quote:mode / dsh-quote:trunc;不上传、不同步、无遥测。
  • 只操作当前页面:读写选区、往输入框插文字、在页面上挂几个按钮,不碰文件系统。
  • 卸载后这些 localStorage 键不会自动清理,可手动删除。

已知限制

  • 消息文本里带标记:注释靠 :::annotation 围栏承载。在队列预览、会话标题这类只取纯文本的地方,会看到这段原文。
  • 发送拦截是启发式的:靠 [data-composer-card] + 发送按钮的 aria-label(含「发送」/send)识别。DSH 改版可能让它失效——失效时注释不会丢,会留在胶囊行,并可用「随消息发送」补发。
  • 注入位置是光标处:正常流程下光标在正文末尾,注释块就落在末尾;如果你把光标停在正文中间再发送,注释块会插在中间。
  • 编辑器改版风险:划选采样依赖浏览器 Selection API 与 [contenteditable] 判定;DSH 若改用非 contenteditable 的编辑器,需要适配。
  • 徽标锚点是 DOM Range:消息重新渲染后 Range 可能失效,圆标随之隐藏;此时点胶囊会退回全文搜索定位。

兼容性

在 DSH 0.2.1-rc.3(Web / Desktop profile)上实测通过;package.json 里声明了 dsh.compatibility.dsh: ">=0.2.1-rc.3"。

只用基座模块表里的 react / react-dom,不请求其他插件行;与官方语音输入(占 conversation.input.activity)不冲突。

依赖的宿主侧约定(改版时最先坏的就是这些):

  • [data-composer-card] 标记输入框卡片;
  • 发送按钮的 aria-label 含「发送」或 send;
  • conversation.input.overlay / conversation.user.text.node 两个 slot;
  • inputActions.captureInsertion / insertText / submit;
  • 聊天行上的 data-chat-flow-key(用于「注释整条」)。

升级 DSH 之后

插件装在 profile(~\.dsh\profiles\desktop),不在应用包里,所以升级 DSH 不会删掉它——package.json 的依赖、dsh.profile.bundles 里的条目、patch 层都留着,正常情况下升级后照常加载。

真正会出问题的是兼容性:客户端 bundle 与 Host 的 release 绑定,大版本变化时可能加载失败。表现是插件页里这个插件显示「加载失败」,而不是消失。处理顺序:

  1. 插件页 → 该插件 → 重试(不改状态,只重新加载产物);
  2. 重启 DSH(release 变了时,页面要刷新才能拿新产物);
  3. 仍然失败,就是 bundle 需要跟着改——源码在本仓库 daisydeng17-hash/dsh-quote-plugin(或你的本地克隆),改完重新安装或刷新即可。

要一次性恢复 profile 里所有插件的依赖:

dsh plugin --profile desktop install

(等价于在 profile 目录跑 pnpm install,按 package.json + lockfile 还原。)想确认插件行还在,可以跑:

dsh --profile desktop --dump-config | Select-String dsh-quote-plugin

GitHub 安装的是仓库的一份副本;只有按上面「本地开发」用 link: 装的时候,profile 才指向你的本地目录。

Content from the project README on GitHub ↗

Links

More in this category

View the whole category →

Community comments

Comments are public GitHub Discussions. Loading them connects to GitHub and Giscus; a GitHub account is required to post.