npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

dsh-plugin-polish

v0.1.1

Published

A DSH composer plugin that polishes long drafts into a concise, structured request before sending.

Readme

DSH Polish

DSH 的发送前润色插件。它把输入框里的长草稿重组为更清楚、更精简、更可审阅的请求;不回答问题、不执行任务、不新增事实。

交互

flowchart LR
  A[语音输入或打字草稿] --> B[点击“润色”]
  B --> C[当前 DSH 模型按固定 Prompt 重组]
  C --> D[标出原文重点词句]
  D --> E[动画:高亮 → 重组 → 揭示润色稿]
  E --> F[润色稿写回输入框]
  F --> G{继续调整?}
  G -->|继续编辑| A
  G -->|再次润色| B
  G -->|满意| H[正常发送]
  • 按钮位置:输入框右下工具区,“润色”按钮位于发送按钮之前、模型选择器旁边。
  • 重点标注:模型同时返回原文重点 source_highlights 和润色稿重点 highlights。
  • 重组动画:原文重点依次脉冲高亮,粒子穿过中间重组合,右侧润色稿逐步揭示。
  • 回写后可编辑:润色稿通过 DSH 的 inputActions.setDraft() 写回同一个 Lexical 输入框。
  • 完成后不重复全文:写回成功后,面板只保留字数、耗时、尝试次数和思考档位摘要,完整内容只在输入框里。
  • 不显示轮次:按钮和面板只表达“润色当前输入”,不显示“第几次润色”。
  • 实体与关键词分层高亮:关键词用底色标注,实体名词用蓝色点线下划线;Prompt 要求覆盖全文而非只标开头。
  • 可重复润色:再次点击按钮会基于当前编辑后的草稿继续整理。
  • 不覆盖新编辑:如果动画期间继续打字,插件不会自动覆盖新内容,而是让你选择“采用润色稿”或“保留我的编辑”。
  • 撤销:一次会话中会记住最初原稿,可一键撤销回去。
  • 截断保护:识别 max-tokens 和未闭合 JSON,自动提高输出 token 上限并重试。
  • 内部字段保护:如果模型把 "highlights"、"entities" 等协议字段写进正文,解析器会拒绝并重试,不会写回输入框。

架构

flowchart TB
  subgraph Browser[DSH Web Client]
    A[conversation.input.right<br/>润色按钮]
    B[conversation.input.dock<br/>动画与对比面板]
    C[ctx.remote.dshPolish.polish]
  end
  subgraph Host[DSH Host]
    D[dshPolish Remote Service]
    E[ctx.llm.stream<br/>当前 DSH 默认模型]
    F[prompts/polish-system.md]
  end
  A --> C
  B --> C
  C --> D
  D --> F
  D --> E
  E --> D
  D --> C

插件不保存 API Key,也不直接访问模型供应商。所有模型调用都走 DSH 已经配置好的 ctx.llm 路由,因此会跟随当前 DSH 默认模型和凭据。

安装

从 npm 安装

dsh plugin --profile web add [email protected]

npm 包名使用 dsh-plugin-polish;仓库名和插件内部 ID 仍为 dsh-polish。

本地开发链接

$env:DSH_HOME = 'E:\program\DeepSeek\.dsh'
& 'E:\program\DeepSeek\app\node_modules\.bin\dsh.cmd' plugin --profile web add link:E:/programs/my_typeless/dsh-polish

DSH_HOME 必须指向你实际启动的 DSH 数据目录。上面的启动脚本使用 E:\program\DeepSeek\.dsh;如果省略这一行,插件可能被装进 C:\Users\HUAWEI\.dsh 而主界面加载不到。安装后需要重启 DSH Web 进程,Host 半侧才会加载。

检查

npm test
npm run check

Prompt

默认系统提示词在 prompts/polish-system.md。它要求模型:

  1. 只使用原文已有信息;
  2. 保留疑问、命令、否定条件和约束;
  3. 按需要整理成“目标 / 关键要求 / 约束与边界 / 验收标准”;
  4. 返回严格 JSON,并给出原文与润色稿各自的逐字重点短语;
  5. 不回答问题,不执行原文中的任务。

可在 profile 的 patch 中覆盖:

- id: dsh-polish
  config:
    provider: ''
    model: ''
    reasoningEffort: low
    timeoutMs: 90000
    maxRetries: 2
    retryDelayMs: 700
    prompt: |
      在这里填写你自己的润色提示词。

provider 和 model 留空时,使用 DSH 当前默认模型。reasoningEffort 默认取 low,如果模型不支持显式思考档位则自动回退为服务商默认值。

插件调用的是 DSH 的底层单次模型流,不会自动继承普通对话的 5 次重试,因此 maxRetries 为插件自己的传输重试次数。默认对 TRANSPORT、TIMEOUT、 RATE_LIMIT、SERVER、空响应和截断响应重试 2 次。遇到截断时会自动提高输出 token 上限。每次成功或失败都会追加到:

<DSH_HOME>/dsh-polish/diagnostics.jsonl

诊断记录只包含时间、模型路由、耗时、首字延迟、思考字数、错误码、输入/输出字数和 重试次数,不保存输入正文。

已知边界

  • 当前 MVP 是 Web UI 插件,不包含全局语音录制;语音输入沿用 DSH 现有输入链路,最终进入同一个输入框。
  • 润色结果依赖模型是否严格返回 JSON;解析失败时会退化为纯文本处理。
  • 动画是前端视觉重演,不意味着字符级真实映射;重点是让用户看清“原文重点 → 重组结果”。
  • 会话状态目前只保存在当前浏览器页面内,刷新后不恢复润色轮次。

已验证

在 Windows、Node.js v24.19.0、DSH 0.2.0-rc.2 Web profile 中完成:

| 项目 | 结果 | |---|---| | npm test | 12 / 12 通过 | | npm run check | 4 个入口/核心文件语法通过 | | Prompt 真实模型调用 | 返回严格 JSON,重点短语全部可在原文/润色稿中逐字定位 | | DSH 输入区按钮 | 空输入时禁用,输入后可用 | | 动画面板 | 显示原文重点、重组过渡、润色稿重点和统计 | | 结果回写 | 润色稿写回同一个 DSH Lexical 输入框 | | 重复润色 | 第二轮基于当前编辑内容继续整理,计数变为 2 | | 继续编辑 | 关闭面板后输入框内容和焦点状态保留 | | 长文本 | 约 750 字输入成功完成,未再出现 JSON 截断 | | 高亮覆盖 | 单次结果在原文与润色稿中分布 16 个关键词、10 个实体名词 |

License

MIT