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

@eduwork/dsh-annotation

v0.1.0

Published

Numbered response annotations using native DSH composer references

Readme

选段引用与批注

English

@eduwork/dsh-annotation 是一个可选的 DSH 插件:选中已完成回复中的文字,添加批注,在原回复底部查看编号,并与问题一起发送。引用、草稿保存与发送沿用 DSH 原生机制。

安装

在 EduWork 的「插件」页选择「添加插件」,填写 @eduwork/dsh-annotation,安装后启用。停用和卸载在同一页面完成。其他兼容 DSH 客户端也可以通过插件管理器安装这个独立 npm 包。

需要提供官方 Chat 视图与输入框扩展的 DSH 客户端(>=0.2.1-rc.2 <0.3.0-0)。已发送批注在气泡上方显示编号,需要 EduWork 的 conversation.chat.user.decorate 扩展入口;未提供该入口的客户端通过官方文本插槽显示引用卡片,仍可独立使用。排队等原生文本界面也使用卡片显示。

使用

  1. 在已结束回合的最终回复中选中文字,点出现的「+ 批注」按钮。
  2. 写批注(可留空),点「加入输入框」或按 Enter;Shift+Enter 换行。拼音组词时,Enter 只确认候选词,结束组词后再按 Enter 加入输入框。
  3. 原回复底部出现批注编号;输入框保留原生引用块,并显示「N 条批注」。点击编号、引用块或汇总列表,可查看完整摘录、编辑或删除批注。
  4. 可以继续添加多处批注,再输入问题一起发送;也可以只发送批注。发送后,当前草稿对应的编号与汇总自动清空。
  5. 已发送消息在气泡上方显示「批注 1、2…」,悬停、点击或键盘聚焦编号可查看摘录与批注。气泡内只展示问题正文;只有批注时不生成空白气泡。

引用块随草稿保存,可与普通文字、文件引用混用。刷新页面后会恢复待发送批注与来源编号。编号按当前输入框中的批注顺序排列,删除和原生撤销会同步更新。发送仍由客户端的原生流程完成,排队与插入运行中回合的行为遵循你的设置。

编辑批注不会覆盖输入框里的其他内容;「取消」保留原批注。编辑时切换焦点不会自动关闭编辑框。若引用已变化或输入框正处于命令、提交状态,保存或删除会拒绝执行,保留输入供重试。只读预览可通过点击弹窗外、切换窗口或 Escape 关闭。

如果输入框暂时无法接收引用,批注编辑框会保留原文与输入内容,可稍后重试。浮层会跟随选中文字的位置,包括滚动和图片加载等排版变化。

功能边界

  • 编号显示在原回复底部,随消息自然滚动;不在选中的每个字上绘制高亮或浮动编号。
  • 待发送批注在原回复底部编号;已发送批注从用户消息里的结构化前缀还原,在该消息气泡上方显示,不维护另一套历史批注库。
  • 新批注限定为官方 Chat 中已完成回合的最终回复;不对流式内容、工具输出、用户输入或侧栏文件挂编号。
  • 摘录本身是完整快照。新增引用还会保存来源消息 ID 和选区前后各最多 320 字符的可见上下文,不代表读取了完整来源。来源暂未加载时,仍能查看和发送;旧版无来源信息的引用仍兼容。旧的 Markdown 引用消息保持原样。

开发

node scripts/packages/manage.mjs install dsh-annotation
node scripts/packages/manage.mjs check dsh-annotation

插件通过官方 conversation.chat.turnTail、conversation.input.left 和 conversation.input.overlay 插槽添加界面。待发送批注和顺序来自公开的 InputState.occurrences;编辑、删除通过带版本校验的原生输入区间操作完成,不直接修改 Lexical 或整段草稿。src/client/draft.js 集中处理引用坐标换算及公开 Chat 快照中的来源消息解析。

选区只通过官方 Chat 行的 data-chat-node-key 查找消息身份,并以 DOM Range 截取同一行的有限前后文;不修改正文 DOM、不全局扫描文字。宿主更换 Chat 行结构时需重新核对此适配点,不能回退为猜测来源。

发送时,引用 codec 生成带版本的中间片段,宿主 agent/pre-step 将同一条用户消息里的片段整理成一次固定 prompt、<eduwork-response-annotations> JSON 和问题正文。消息角色、ID、附件以及原生 Queue/Steer 流程保留。JSON 对 XML 边界和原生引用符号转义;摘录与前后文明确作为引用材料处理。重试不会重复包装。

agent/pre-step 整理后的内容会由官方 Agent 写入会话历史,不是仅存在于临时模型请求中。展示组件只投影消息文本;编号、摘录、批注与上下文都从消息自身恢复,不维护第二套存储。未知版本、未知字段、损坏格式、代码示例保留原文,不静默删除额外数据。src/protocol.js 是发送与展示共用的协议实现;原生文本卡片沿用 uiConversation.userText 和 conversation.user.text.node,也兼容旧版测试消息。

通用气泡装饰入口由 scripts/patch-chat-user-content-runtime.mjs 对锁定的 Runtime 副本适配,并写入构建回执。补丁不含批注业务逻辑,插件未启用时回到原生渲染;正文、附件与消息操作仍由原生组件负责。补丁严格核对包版本和文件 SHA-256,上游文件变化时停止装配,必须重新评估或移除适配,不能跳过检查。未加补丁的官方客户端使用上述卡片回退;上游提供等价扩展入口后应移除此补丁。

许可证:MIT。